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 2015/06/18 23:57:39 UTC

[01/50] [abbrv] qpid-proton git commit: PROTON-781: Added the WrappedHandler class to the Ruby reactor APIs.

Repository: qpid-proton
Updated Branches:
  refs/heads/cjansen-cpp-client aaf0430d7 -> 9f7e34620 (forced update)


PROTON-781: Added the WrappedHandler class to the Ruby reactor APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: aa486b206c9041c34714e4b4e483a677f87eeb09
Parents: 98e27c6
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Feb 23 16:18:01 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/handler/c_adaptor.rb | 47 ++++++++++++
 .../ruby/lib/handler/wrapped_handler.rb         | 76 ++++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  4 ++
 proton-c/bindings/ruby/ruby.i                   | 53 ++++++++++++++
 4 files changed, 180 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa486b20/proton-c/bindings/ruby/lib/handler/c_adaptor.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/c_adaptor.rb b/proton-c/bindings/ruby/lib/handler/c_adaptor.rb
new file mode 100644
index 0000000..ef4852e
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/c_adaptor.rb
@@ -0,0 +1,47 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Handler
+
+  # @private
+  class CAdaptor
+
+    def initialize(handler, on_error = nil)
+      @handler = handler
+      @on_error = on_error
+    end
+
+    def dispatch(cevent, ctype)
+      event = Qpid::Proton::Event::Event.wrap(cevent, ctype)
+      # TODO add a variable to enable this programmatically
+      # print "EVENT: #{event} going to #{@handler}\n"
+      event.dispatch(@handler)
+    end
+
+    def exception(error)
+      if @on_error.nil?
+        raise error
+      else
+        @on_error.call(error)
+      end
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa486b20/proton-c/bindings/ruby/lib/handler/wrapped_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/wrapped_handler.rb b/proton-c/bindings/ruby/lib/handler/wrapped_handler.rb
new file mode 100644
index 0000000..6d55dee
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/wrapped_handler.rb
@@ -0,0 +1,76 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Handler
+
+  class WrappedHandler
+
+    # @private
+    include Qpid::Proton::Util::Wrapper
+
+    def self.wrap(impl, on_error = nil)
+      return nil if impl.nil?
+
+      result = self.fetch_instance(impl) || WrappedHandler.new(impl)
+      result.on_error = on_error
+      return result
+    end
+
+    include Qpid::Proton::Util::Handler
+
+    def initialize(impl_or_constructor)
+      if impl_or_constructor.is_a?(Method)
+        @impl = impl_or_constructor.call
+      else
+        @impl = impl_or_constructor
+        Cproton.pn_incref(@impl)
+      end
+      @on_error = nil
+      self.class.store_instance(self)
+    end
+
+    def add(handler)
+      return if handler.nil?
+
+      impl = chandler(handler, self.method(:_on_error))
+      Cproton.pn_handler_add(@impl, impl)
+      Cproton.pn_decref(impl)
+    end
+
+    def clear
+      Cproton.pn_handler_clear(@impl)
+    end
+
+    def on_error=(on_error)
+      @on_error = on_error
+    end
+
+    private
+
+    def _on_error(info)
+      if self.has?['on_error']
+        self['on_error'].call(info)
+      else
+        raise info
+      end
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa486b20/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 467d959..2791538 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -82,6 +82,10 @@ require "messenger/tracker"
 require "messenger/selectable"
 require "messenger/messenger"
 
+# Handler classes
+require "handler/c_adaptor"
+require "handler/wrapped_handler"
+
 module Qpid::Proton
   # @private
   def self.registry

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa486b20/proton-c/bindings/ruby/ruby.i
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i
index 678a085..3d4090e 100644
--- a/proton-c/bindings/ruby/ruby.i
+++ b/proton-c/bindings/ruby/ruby.i
@@ -559,4 +559,57 @@ VALUE pni_address_of(void *object) {
 int pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *OUTPUT, size_t *OUTPUT_SIZE);
 %ignore pn_ssl_get_peer_hostname;
 
+%inline %{
+
+  VALUE pni_ruby_get_proton_module() {
+    VALUE mQpid = rb_define_module("Qpid");
+    return rb_define_module_under(mQpid, "Proton");
+  }
+
+  void pni_ruby_add_to_registry(VALUE key, VALUE value) {
+    VALUE result = rb_funcall(pni_ruby_get_proton_module(), rb_intern("add_to_registry"), 2, key, value);
+  }
+
+  VALUE pni_ruby_get_from_registry(VALUE key) {
+    rb_funcall(pni_ruby_get_proton_module(), rb_intern("get_from_registry"), 1, key);
+  }
+
+  void pni_ruby_delete_from_registry(VALUE stored_key) {
+    rb_funcall(pni_ruby_get_proton_module(), rb_intern("delete_from_registry"), 1, stored_key);
+  }
+
+  typedef struct {
+    VALUE handler_key;
+  } pni_rbhandler_t;
+
+  static pni_rbhandler_t *pni_rbhandler(pn_handler_t *handler) {
+    return (pni_rbhandler_t *) pn_handler_mem(handler);
+  }
+
+  static void pni_rbdispatch(pn_handler_t *handler, pn_event_t *event, pn_event_type_t type) {
+    pni_rbhandler_t *rbh = pni_rbhandler(handler);
+    VALUE rbhandler = pni_ruby_get_from_registry(rbh->handler_key);
+
+    rb_funcall(rbhandler, rb_intern("dispatch"), 2, SWIG_NewPointerObj(event, SWIGTYPE_p_pn_event_t, 0), INT2FIX(type));
+  }
+
+  static void pni_rbhandler_finalize(pn_handler_t *handler) {
+    pni_rbhandler_t *rbh = pni_rbhandler(handler);
+    pni_ruby_delete_from_registry(rbh->handler_key);
+  }
+
+  pn_handler_t *pn_rbhandler(VALUE handler) {
+    pn_handler_t *chandler = pn_handler_new(pni_rbdispatch, sizeof(pni_rbhandler_t), pni_rbhandler_finalize);
+    pni_rbhandler_t *rhy = pni_rbhandler(chandler);
+
+    VALUE ruby_key = rb_class_new_instance(0, NULL, rb_cObject);
+    pni_ruby_add_to_registry(ruby_key, handler);
+
+    rhy->handler_key = ruby_key;
+
+    return chandler;
+  }
+
+%}
+
 %include "proton/cproton.i"


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


[36/50] [abbrv] qpid-proton git commit: PROTON-865: new cjansen-cpp-client branch for fledgling C++ client code using the event reactor

Posted by ac...@apache.org.
PROTON-865: new cjansen-cpp-client branch for fledgling C++ client code using the event reactor


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

Branch: refs/heads/cjansen-cpp-client
Commit: 8c067060493475afad9cad6502caca75bfcf89d9
Parents: bcfa8d4
Author: Clifford Jansen <cl...@apache.org>
Authored: Thu Apr 30 11:22:03 2015 -0700
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/CMakeLists.txt                |   7 +-
 proton-c/bindings/cpp/CMakeLists.txt            | 116 +++++++
 proton-c/bindings/cpp/examples/HelloWorld.cpp   |  62 ++++
 .../bindings/cpp/examples/HelloWorldDirect.cpp  |  70 +++++
 .../bindings/cpp/include/proton/cpp/Acceptor.h  |  50 +++
 .../cpp/include/proton/cpp/Connection.h         |  69 +++++
 .../bindings/cpp/include/proton/cpp/Container.h |  67 +++++
 .../bindings/cpp/include/proton/cpp/Endpoint.h  |  47 +++
 .../bindings/cpp/include/proton/cpp/Event.h     |  60 ++++
 .../bindings/cpp/include/proton/cpp/Handle.h    |  72 +++++
 .../bindings/cpp/include/proton/cpp/Handler.h   |  50 +++
 .../cpp/include/proton/cpp/ImportExport.h       |  50 +++
 proton-c/bindings/cpp/include/proton/cpp/Link.h |  63 ++++
 .../bindings/cpp/include/proton/cpp/Message.h   |  53 ++++
 .../cpp/include/proton/cpp/MessagingAdapter.h   |  57 ++++
 .../cpp/include/proton/cpp/MessagingEvent.h     |  92 ++++++
 .../cpp/include/proton/cpp/MessagingHandler.h   |  73 +++++
 .../cpp/include/proton/cpp/ProtonEvent.h        |  57 ++++
 .../cpp/include/proton/cpp/ProtonHandle.h       |  68 +++++
 .../cpp/include/proton/cpp/ProtonHandler.h      |  83 +++++
 .../bindings/cpp/include/proton/cpp/Receiver.h  |  47 +++
 .../bindings/cpp/include/proton/cpp/Sender.h    |  50 +++
 .../bindings/cpp/include/proton/cpp/Session.h   |  59 ++++
 .../bindings/cpp/include/proton/cpp/Transport.h |  48 +++
 .../cpp/include/proton/cpp/exceptions.h         |  56 ++++
 proton-c/bindings/cpp/src/Acceptor.cpp          |  56 ++++
 proton-c/bindings/cpp/src/Connection.cpp        |  69 +++++
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    | 113 +++++++
 proton-c/bindings/cpp/src/ConnectionImpl.h      |  73 +++++
 proton-c/bindings/cpp/src/Connector.cpp         |  77 +++++
 proton-c/bindings/cpp/src/Connector.h           |  59 ++++
 proton-c/bindings/cpp/src/Container.cpp         |  86 ++++++
 proton-c/bindings/cpp/src/ContainerImpl.cpp     | 301 +++++++++++++++++++
 proton-c/bindings/cpp/src/ContainerImpl.h       |  69 +++++
 proton-c/bindings/cpp/src/Endpoint.cpp          |  37 +++
 proton-c/bindings/cpp/src/Event.cpp             |  71 +++++
 proton-c/bindings/cpp/src/Handler.cpp           |  44 +++
 proton-c/bindings/cpp/src/Link.cpp              |  99 ++++++
 proton-c/bindings/cpp/src/LogInternal.h         |  51 ++++
 proton-c/bindings/cpp/src/Logger.cpp            |  56 ++++
 proton-c/bindings/cpp/src/Message.cpp           |  92 ++++++
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  | 191 ++++++++++++
 proton-c/bindings/cpp/src/MessagingEvent.cpp    | 133 ++++++++
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |  60 ++++
 proton-c/bindings/cpp/src/Msg.h                 |  79 +++++
 proton-c/bindings/cpp/src/PrivateImplRef.h      |  97 ++++++
 proton-c/bindings/cpp/src/ProtonEvent.cpp       | 152 ++++++++++
 proton-c/bindings/cpp/src/ProtonHandler.cpp     |  74 +++++
 proton-c/bindings/cpp/src/ProtonImplRef.h       |  66 ++++
 proton-c/bindings/cpp/src/Receiver.cpp          |  43 +++
 proton-c/bindings/cpp/src/Sender.cpp            |  69 +++++
 proton-c/bindings/cpp/src/Session.cpp           |  64 ++++
 proton-c/bindings/cpp/src/Transport.cpp         |  39 +++
 proton-c/bindings/cpp/src/Url.cpp               |  77 +++++
 proton-c/bindings/cpp/src/Url.h                 |  49 +++
 proton-c/bindings/cpp/src/contexts.cpp          |  92 ++++++
 proton-c/bindings/cpp/src/contexts.h            |  48 +++
 proton-c/bindings/cpp/src/exceptions.cpp        |  33 ++
 proton-c/bindings/cpp/src/platform.cpp          |  79 +++++
 proton-c/bindings/cpp/src/platform.h            |  39 +++
 60 files changed, 4362 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
index 5df4682..f426ef3 100644
--- a/proton-c/bindings/CMakeLists.txt
+++ b/proton-c/bindings/CMakeLists.txt
@@ -20,7 +20,7 @@
 include(UseSWIG)
 
 # Add any new bindings here - the directory name must be the same as the binding name
-set (BINDINGS python ruby php perl javascript)
+set (BINDINGS python ruby php perl javascript cpp)
 
 # All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
 file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/proton-c/include/proton/*.h")
@@ -109,6 +109,11 @@ if (EMSCRIPTEN_FOUND)
   set (DEFAULT_JAVASCRIPT ON)
 endif (EMSCRIPTEN_FOUND)
 
+# C++ client: very experimental.  To try, change this to "ON"
+# or provide -DBUILD_CPP=ON to CMake
+set (DEFAULT_CPP OFF)
+
+
 # Shouldn't need to modify below here when adding new language binding
 foreach(BINDING ${BINDINGS})
   string(TOUPPER ${BINDING} UBINDING)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
new file mode 100644
index 0000000..7e456a5
--- /dev/null
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -0,0 +1,116 @@
+#
+# 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.
+#
+
+project (Proton C CXX)
+
+include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
+include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
+
+set (qpid-proton-cpp-platform
+  "src/platform"
+  )
+
+set (qpid-proton-cpp-core
+    src/Connection.cpp
+    src/ConnectionImpl.cpp
+    src/Connector.cpp
+    src/Connector.h
+    src/Container.cpp
+    src/ContainerImpl.cpp
+    src/Endpoint.cpp
+    src/Event.cpp
+    src/Handler.cpp
+    src/Link.cpp
+    src/Acceptor.cpp
+    src/Url.cpp
+    src/Message.cpp
+    src/MessagingAdapter.cpp
+    src/MessagingEvent.cpp
+    src/MessagingHandler.cpp
+    src/ProtonEvent.cpp
+    src/ProtonHandler.cpp
+    src/Receiver.cpp
+    src/Sender.cpp
+    src/Session.cpp
+    src/Transport.cpp
+    src/Logger.cpp
+    src/contexts.cpp
+    src/exceptions.cpp
+  )
+
+#set_source_files_properties (
+#  ${qpid-proton-cpp-core}
+#  PROPERTIES
+#  COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS}"
+#  )
+
+set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX)
+set_source_files_properties (
+  ${qpid-proton-cpp-platform}
+  PROPERTIES
+  COMPILE_FLAGS "${COMPILE_PLATFORM_FLAGS}"
+  COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
+  )
+
+
+
+add_library (
+  qpid-proton-cpp SHARED
+
+  ${qpid-proton-cpp-core}
+  ${qpid-proton-cpp-platform}
+
+  )
+
+target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
+
+set_target_properties (
+  qpid-proton-cpp
+  PROPERTIES
+  LINKER_LANGUAGE CXX
+  VERSION   "${PN_LIB_SOMAJOR}.${PN_LIB_SOMINOR}"
+  SOVERSION "${PN_LIB_SOMAJOR}"
+  LINK_FLAGS "${CATCH_UNDEFINED}"
+  )
+
+add_executable (HelloWorld examples/HelloWorld.cpp)
+target_link_libraries (HelloWorld qpid-proton-cpp)
+add_executable (HelloWorldDirect examples/HelloWorldDirect.cpp)
+target_link_libraries (HelloWorldDirect qpid-proton-cpp)
+
+install (TARGETS qpid-proton-cpp
+  EXPORT  proton
+  ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+  LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+
+# Install windows qpid-proton-cpp pdb files
+if (MSVC)
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/qpid-proton${CMAKE_DEBUG_POSTFIX}.pdb
+    DESTINATION bin
+    CONFIGURATIONS Debug
+    OPTIONAL)
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/qpid-proton.pdb
+    DESTINATION bin
+    CONFIGURATIONS RelWithDebInfo
+    OPTIONAL)
+endif (MSVC)
+
+# Install header files
+file(GLOB headers "include/proton/cpp/*.h")
+install (FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/proton/cpp)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/examples/HelloWorld.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorld.cpp b/proton-c/bindings/cpp/examples/HelloWorld.cpp
new file mode 100644
index 0000000..1fc124b
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/HelloWorld.cpp
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+class HelloWorld : public MessagingHandler {
+  private:
+    std::string server;
+    std::string address;
+  public:
+
+    HelloWorld(const std::string &s, const std::string &addr) : server(s), address(addr) {}
+
+    void onStart(Event &e) {
+        Connection conn = e.getContainer().connect(server);
+        e.getContainer().createReceiver(conn, address);
+        e.getContainer().createSender(conn, address);
+    }
+
+    void onSendable(Event &e) {
+        Message m;
+        m.setBody("Hello World!");
+        e.getSender().send(m);
+        e.getSender().close();
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+        e.getConnection().close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    HelloWorld hw("localhost:5672", "examples");
+    Container(hw).run();
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp b/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
new file mode 100644
index 0000000..a695dd0
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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/cpp/MessagingHandler.h"
+#include "proton/cpp/Container.h"
+
+//#include "proton/cpp/Acceptor.h"
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+
+class HelloWorldDirect : public MessagingHandler {
+  private:
+    std::string url;
+    Acceptor acceptor;
+  public:
+
+    HelloWorldDirect(const std::string &u) : url(u) {}
+
+    void onStart(Event &e) {
+        acceptor = e.getContainer().listen(url);
+        e.getContainer().createSender(url);
+    }
+
+    void onSendable(Event &e) {
+        Message m;
+        m.setBody("Hello World!");
+        e.getSender().send(m);
+        e.getSender().close();
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+    }
+
+    void onAccepted(Event &e) {
+        e.getConnection().close();
+    }
+
+    void onConnectionClosed(Event &e) {
+        acceptor.close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    HelloWorldDirect hwd("localhost:8888/examples");
+    Container(hwd).run();
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
new file mode 100644
index 0000000..852ca97
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_ACCEPTOR_H
+#define PROTON_CPP_ACCEPTOR_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/cpp/ImportExport.h"
+#include "proton/cpp/ProtonHandle.h"
+#include "proton/reactor.h"
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Acceptor : public ProtonHandle<pn_acceptor_t>
+{
+  public:
+    PROTON_CPP_EXTERN Acceptor();
+    PROTON_CPP_EXTERN Acceptor(pn_acceptor_t *);
+    PROTON_CPP_EXTERN Acceptor(const Acceptor&);
+    PROTON_CPP_EXTERN Acceptor& operator=(const Acceptor&);
+    PROTON_CPP_EXTERN ~Acceptor();
+
+    PROTON_CPP_EXTERN void close();
+  private:
+    friend class ProtonImplRef<Acceptor>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ACCEPTOR_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
new file mode 100644
index 0000000..7d97ebb
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
@@ -0,0 +1,69 @@
+#ifndef PROTON_CPP_CONNECTION_H
+#define PROTON_CPP_CONNECTION_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/cpp/ImportExport.h"
+#include "proton/cpp/Handle.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Transport;
+class Container;
+class ConnectionImpl;
+
+class Connection : public Endpoint, public Handle<ConnectionImpl>
+{
+  public:
+    PROTON_CPP_EXTERN Connection();
+    PROTON_CPP_EXTERN Connection(ConnectionImpl *);
+    PROTON_CPP_EXTERN Connection(const Connection& c);
+    PROTON_CPP_EXTERN Connection& operator=(const Connection& c);
+    PROTON_CPP_EXTERN ~Connection();
+
+    PROTON_CPP_EXTERN Connection(Container &c);
+    PROTON_CPP_EXTERN Transport &getTransport();
+    PROTON_CPP_EXTERN Handler *getOverride();
+    PROTON_CPP_EXTERN void setOverride(Handler *h);
+    PROTON_CPP_EXTERN void open();
+    PROTON_CPP_EXTERN void close();
+    PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
+    PROTON_CPP_EXTERN Container &getContainer();
+    PROTON_CPP_EXTERN std::string getHostname();
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+  private:
+   friend class PrivateImplRef<Connection>;
+   friend class Connector;
+   friend class ConnectionImpl;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
new file mode 100644
index 0000000..fbb1a83
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Container.h
@@ -0,0 +1,67 @@
+#ifndef PROTON_CPP_CONTAINER_H
+#define PROTON_CPP_CONTAINER_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/cpp/ImportExport.h"
+#include "proton/cpp/Handle.h"
+#include "proton/cpp/Acceptor.h"
+#include <proton/reactor.h>
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class DispatchHelper;
+class Connection;
+class Connector;
+class Acceptor;
+class ContainerImpl;
+class MessagingHandler;
+class Sender;
+class Receiver;
+class Link;
+
+class Container : public Handle<ContainerImpl>
+{
+  public:
+    PROTON_CPP_EXTERN Container(ContainerImpl *);
+    PROTON_CPP_EXTERN Container(const Container& c);
+    PROTON_CPP_EXTERN Container& operator=(const Container& c);
+    PROTON_CPP_EXTERN ~Container();
+
+    PROTON_CPP_EXTERN Container(MessagingHandler &mhandler);
+    PROTON_CPP_EXTERN Connection connect(std::string &host);
+    PROTON_CPP_EXTERN void run();
+    PROTON_CPP_EXTERN pn_reactor_t *getReactor();
+    PROTON_CPP_EXTERN pn_handler_t *getGlobalHandler();
+    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Sender createSender(std::string &url);
+    PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
+    PROTON_CPP_EXTERN std::string getContainerId();
+  private:
+   friend class PrivateImplRef<Container>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTAINER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
new file mode 100644
index 0000000..9992eff
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
@@ -0,0 +1,47 @@
+#ifndef PROTON_CPP_ENDPOINT_H
+#define PROTON_CPP_ENDPOINT_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/cpp/ImportExport.h"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Connection;
+class Transport;
+
+class Endpoint
+{
+  public:
+    // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
+    virtual PROTON_CPP_EXTERN Connection &getConnection() = 0;
+    Transport PROTON_CPP_EXTERN &getTransport();
+  protected:
+    Endpoint();
+    ~Endpoint();
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ENDPOINT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Event.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Event.h b/proton-c/bindings/cpp/include/proton/cpp/Event.h
new file mode 100644
index 0000000..47aee2d
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Event.h
@@ -0,0 +1,60 @@
+#ifndef PROTON_CPP_EVENT_H
+#define PROTON_CPP_EVENT_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/cpp/ImportExport.h"
+#include "proton/cpp/Link.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Message.h"
+#include <vector>
+
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+class Event
+{
+  public:
+    virtual PROTON_CPP_EXTERN void dispatch(Handler &h) = 0;
+    virtual PROTON_CPP_EXTERN Container &getContainer();
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    virtual PROTON_CPP_EXTERN Sender getSender();
+    virtual PROTON_CPP_EXTERN Receiver getReceiver();
+    virtual PROTON_CPP_EXTERN Link getLink();
+    virtual PROTON_CPP_EXTERN Message getMessage();
+    virtual PROTON_CPP_EXTERN void setMessage(Message &);
+    virtual PROTON_CPP_EXTERN ~Event();
+  protected:
+    PROTON_CPP_EXTERN PROTON_CPP_EXTERN Event();
+  private:
+    PROTON_CPP_EXTERN Event(const Event&);
+    PROTON_CPP_EXTERN Event& operator=(const Event&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_EVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
new file mode 100644
index 0000000..632e30e
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
@@ -0,0 +1,72 @@
+#ifndef PROTON_CPP_HANDLE_H
+#define PROTON_CPP_HANDLE_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/cpp/ImportExport.h"
+
+namespace proton {
+namespace reactor {
+
+template <class> class PrivateImplRef;
+
+/**
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null,  like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+  public:
+
+    /**@return true if handle is valid,  i.e. not null. */
+    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+    /**@return true if handle is null. It is an error to call any function on a null handle. */
+    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+    /** Conversion to bool supports idiom if (handle) { handle->... } */
+    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+    void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+  private:
+    // Not implemented, subclasses must implement.
+    Handle(const Handle&);
+    Handle& operator=(const Handle&);
+
+  protected:
+    typedef T Impl;
+    PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
+
+    Impl* impl;
+
+  friend class PrivateImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_HANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Handler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handler.h b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
new file mode 100644
index 0000000..231942f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_HANDLER_H
+#define PROTON_CPP_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/cpp/ImportExport.h"
+#include "proton/cpp/Event.h"
+#include "proton/event.h"
+#include <vector>
+
+namespace proton {
+namespace reactor {
+
+class PROTON_CPP_EXTERN Handler
+{
+  public:
+    PROTON_CPP_EXTERN Handler();
+    PROTON_CPP_EXTERN virtual ~Handler();
+
+    PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
+
+    PROTON_CPP_EXTERN virtual void addChildHandler(Handler &e);
+    PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
+    PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
+  protected:
+    std::vector<Handler *>childHandlers;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
new file mode 100644
index 0000000..4a88576
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_IMPORTEXPORT_H
+#define PROTON_CPP_IMPORTEXPORT_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.
+ *
+ */
+#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC)
+  //
+  // Import and Export definitions for Windows:
+  //
+#  define PROTON_CPP_EXPORT __declspec(dllexport)
+#  define PROTON_CPP_IMPORT __declspec(dllimport)
+#else
+  //
+  // Non-Windows (Linux, etc.) definitions:
+  //
+#  define PROTON_CPP_EXPORT
+#  define PROTON_CPP_IMPORT
+#endif
+
+
+// For c++ library symbols
+
+#ifdef protoncpp_EXPORTS
+#  define PROTON_CPP_EXTERN PROTON_CPP_EXPORT
+#else
+#  define PROTON_CPP_EXTERN PROTON_CPP_IMPORT
+#endif
+
+// TODO:
+#define PROTON_CPP_INLINE_EXTERN
+
+#endif  /*!PROTON_CPP_IMPORTEXPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
new file mode 100644
index 0000000..21b1ca2
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Link.h
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_LINK_H
+#define PROTON_CPP_LINK_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/cpp/ImportExport.h"
+#include "proton/cpp/ProtonHandle.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Link : public Endpoint, public ProtonHandle<pn_link_t>
+{
+  public:
+    PROTON_CPP_EXTERN Link(pn_link_t *);
+    PROTON_CPP_EXTERN Link();
+    PROTON_CPP_EXTERN ~Link();
+    PROTON_CPP_EXTERN Link(const Link&);
+    PROTON_CPP_EXTERN Link& operator=(const Link&);
+    PROTON_CPP_EXTERN void open();
+    PROTON_CPP_EXTERN void close();
+    PROTON_CPP_EXTERN bool isSender();
+    PROTON_CPP_EXTERN bool isReceiver();
+    PROTON_CPP_EXTERN int getCredit();
+    PROTON_CPP_EXTERN pn_link_t *getPnLink() const;
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+  protected:
+    virtual void verifyType(pn_link_t *l);
+  private:
+    friend class ProtonImplRef<Link>;
+    bool senderLink;
+};
+
+
+}} // namespace proton::reactor
+
+#include "proton/cpp/Sender.h"
+#include "proton/cpp/Receiver.h"
+
+#endif  /*!PROTON_CPP_LINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
new file mode 100644
index 0000000..51ca731
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Message.h
@@ -0,0 +1,53 @@
+#ifndef PROTON_CPP_MESSAGE_H
+#define PROTON_CPP_MESSAGE_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/cpp/ImportExport.h"
+#include "proton/message.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+class Message
+{
+  public:
+    PROTON_CPP_EXTERN Message();
+    PROTON_CPP_EXTERN ~Message();
+    PROTON_CPP_EXTERN Message(const Message&);
+    PROTON_CPP_EXTERN Message& operator=(const Message&);
+
+    PROTON_CPP_EXTERN pn_message_t *getPnMessage();
+    PROTON_CPP_EXTERN void setBody(const std::string &data);
+    PROTON_CPP_EXTERN std::string getBody();
+    PROTON_CPP_EXTERN void encode(std::string &data);
+    PROTON_CPP_EXTERN void decode(const std::string &data);
+
+  private:
+    pn_message_t *pnMessage;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
new file mode 100644
index 0000000..8551c9c
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -0,0 +1,57 @@
+#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/cpp/ProtonHandler.h"
+#include "proton/cpp/MessagingHandler.h"
+
+#include "proton/cpp/MessagingEvent.h"
+#include "proton/event.h"
+#include "proton/reactor.h"
+
+namespace proton {
+namespace reactor {
+
+// For now, stands in for Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
+
+
+class MessagingAdapter : public ProtonHandler
+{
+  public:
+    PROTON_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
+    PROTON_CPP_EXTERN virtual ~MessagingAdapter();
+    PROTON_CPP_EXTERN virtual void onReactorInit(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkFlow(Event &e);
+    PROTON_CPP_EXTERN virtual void onDelivery(Event &e);
+    PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+  private:
+    MessagingHandler &delegate;  // The actual MessagingHandler
+    pn_handler_t *handshaker;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
new file mode 100644
index 0000000..d8d5c7f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
@@ -0,0 +1,92 @@
+#ifndef PROTON_CPP_MESSAGINGEVENT_H
+#define PROTON_CPP_MESSAGINGEVENT_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/cpp/ProtonEvent.h"
+#include "proton/cpp/Link.h"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+typedef enum {
+    PN_MESSAGING_PROTON = 0,  // Wrapped pn_event_t
+    // Covenience events for C++ MessagingHandlers
+    PN_MESSAGING_ABORT,
+    PN_MESSAGING_ACCEPTED,
+    PN_MESSAGING_COMMIT,
+    PN_MESSAGING_CONNECTION_CLOSE,
+    PN_MESSAGING_CONNECTION_CLOSED,
+    PN_MESSAGING_CONNECTION_CLOSING,
+    PN_MESSAGING_CONNECTION_OPEN,
+    PN_MESSAGING_CONNECTION_OPENED,
+    PN_MESSAGING_DISCONNECTED,
+    PN_MESSAGING_FETCH,
+    PN_MESSAGING_ID_LOADED,
+    PN_MESSAGING_LINK_CLOSING,
+    PN_MESSAGING_LINK_OPENED,
+    PN_MESSAGING_LINK_OPENING,
+    PN_MESSAGING_MESSAGE,
+    PN_MESSAGING_QUIT,
+    PN_MESSAGING_RECORD_INSERTED,
+    PN_MESSAGING_RECORDS_LOADED,
+    PN_MESSAGING_REJECTED,
+    PN_MESSAGING_RELEASED,
+    PN_MESSAGING_REQUEST,
+    PN_MESSAGING_RESPONSE,
+    PN_MESSAGING_SENDABLE,
+    PN_MESSAGING_SETTLED,
+    PN_MESSAGING_START,
+    PN_MESSAGING_TIMER,
+    PN_MESSAGING_TRANSACTION_ABORTED,
+    PN_MESSAGING_TRANSACTION_COMMITTED,
+    PN_MESSAGING_TRANSACTION_DECLARED
+} MessagingEventType_t;
+
+class MessagingEvent : public ProtonEvent
+{
+  public:
+    MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+    MessagingEvent(MessagingEventType_t t, ProtonEvent *parent, Container &c);
+    ~MessagingEvent();
+    virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    virtual PROTON_CPP_EXTERN Sender getSender();
+    virtual PROTON_CPP_EXTERN Receiver getReceiver();
+    virtual PROTON_CPP_EXTERN Link getLink();
+    virtual PROTON_CPP_EXTERN Message getMessage();
+    virtual PROTON_CPP_EXTERN void setMessage(Message &);
+  private:
+    MessagingEventType_t messagingType;
+    ProtonEvent *parentEvent;
+    Message *message;
+    MessagingEvent operator=(const MessagingEvent&);
+    MessagingEvent(const MessagingEvent&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGINGEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
new file mode 100644
index 0000000..875af43
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -0,0 +1,73 @@
+#ifndef PROTON_CPP_MESSAGING_HANDLER_H
+#define PROTON_CPP_MESSAGING_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/cpp/ProtonHandler.h"
+#include "proton/event.h"
+
+namespace proton {
+namespace reactor {
+
+class Event;
+
+class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler
+{
+  public:
+    PROTON_CPP_EXTERN MessagingHandler();
+    virtual ~MessagingHandler();
+
+    virtual void onAbort(Event &e);
+    virtual void onAccepted(Event &e);
+    virtual void onCommit(Event &e);
+    virtual void onConnectionClose(Event &e);
+    virtual void onConnectionClosed(Event &e);
+    virtual void onConnectionClosing(Event &e);
+    virtual void onConnectionOpen(Event &e);
+    virtual void onConnectionOpened(Event &e);
+    virtual void onDisconnected(Event &e);
+    virtual void onFetch(Event &e);
+    virtual void onIdLoaded(Event &e);
+    virtual void onLinkClosing(Event &e);
+    virtual void onLinkOpened(Event &e);
+    virtual void onLinkOpening(Event &e);
+    virtual void onMessage(Event &e);
+    virtual void onQuit(Event &e);
+    virtual void onRecordInserted(Event &e);
+    virtual void onRecordsLoaded(Event &e);
+    virtual void onRejected(Event &e);
+    virtual void onReleased(Event &e);
+    virtual void onRequest(Event &e);
+    virtual void onResponse(Event &e);
+    virtual void onSendable(Event &e);
+    virtual void onSettled(Event &e);
+    virtual void onStart(Event &e);
+    virtual void onTimer(Event &e);
+    virtual void onTransactionAborted(Event &e);
+    virtual void onTransactionCommitted(Event &e);
+    virtual void onTransactionDeclared(Event &e);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGING_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
new file mode 100644
index 0000000..9e5e9f3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
@@ -0,0 +1,57 @@
+#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/cpp/Event.h"
+#include "proton/cpp/Link.h"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+class Container;
+
+class ProtonEvent : public Event
+{
+  public:
+    virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
+    virtual PROTON_CPP_EXTERN Container &getContainer();
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    virtual PROTON_CPP_EXTERN Sender getSender();
+    virtual PROTON_CPP_EXTERN Receiver getReceiver();
+    virtual PROTON_CPP_EXTERN Link getLink();
+    PROTON_CPP_EXTERN int getType();
+    PROTON_CPP_EXTERN pn_event_t* getPnEvent();
+  protected:
+    PROTON_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+  private:
+    pn_event_t *pnEvent;
+    int type;
+    Container &container;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
new file mode 100644
index 0000000..8fe6f4c
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
@@ -0,0 +1,68 @@
+#ifndef PROTON_CPP_PROTONHANDLE_H
+#define PROTON_CPP_PROTONHANDLE_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/cpp/ImportExport.h"
+
+namespace proton {
+namespace reactor {
+
+template <class> class ProtonImplRef;
+
+/**
+ * See Handle.h.  Similar but for lightly wrapped Proton pn_object_t targets.
+ */
+template <class T> class ProtonHandle {
+  public:
+
+    /**@return true if handle is valid,  i.e. not null. */
+    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+    /**@return true if handle is null. It is an error to call any function on a null handle. */
+    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+    /** Conversion to bool supports idiom if (handle) { handle->... } */
+    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+    void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+  private:
+    // Not implemented, subclasses must implement.
+    ProtonHandle(const ProtonHandle&);
+    ProtonHandle& operator=(const ProtonHandle&);
+
+  protected:
+    typedef T Impl;
+    PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
+
+    Impl* impl;
+
+  friend class ProtonImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONHANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
new file mode 100644
index 0000000..b639cc3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
@@ -0,0 +1,83 @@
+#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/cpp/Handler.h"
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class ProtonEvent;
+
+class ProtonHandler : public Handler
+{
+  public:
+    PROTON_CPP_EXTERN ProtonHandler();
+    virtual void onReactorInit(Event &e);
+    virtual void onReactorQuiesced(Event &e);
+    virtual void onReactorFinal(Event &e);
+    virtual void onTimerTask(Event &e);
+    virtual void onConnectionInit(Event &e);
+    virtual void onConnectionBound(Event &e);
+    virtual void onConnectionUnbound(Event &e);
+    virtual void onConnectionLocalOpen(Event &e);
+    virtual void onConnectionLocalClose(Event &e);
+    virtual void onConnectionRemoteOpen(Event &e);
+    virtual void onConnectionRemoteClose(Event &e);
+    virtual void onConnectionFinal(Event &e);
+    virtual void onSessionInit(Event &e);
+    virtual void onSessionLocalOpen(Event &e);
+    virtual void onSessionLocalClose(Event &e);
+    virtual void onSessionRemoteOpen(Event &e);
+    virtual void onSessionRemoteClose(Event &e);
+    virtual void onSessionFinal(Event &e);
+    virtual void onLinkInit(Event &e);
+    virtual void onLinkLocalOpen(Event &e);
+    virtual void onLinkLocalClose(Event &e);
+    virtual void onLinkLocalDetach(Event &e);
+    virtual void onLinkRemoteOpen(Event &e);
+    virtual void onLinkRemoteClose(Event &e);
+    virtual void onLinkRemoteDetach(Event &e);
+    virtual void onLinkFlow(Event &e);
+    virtual void onLinkFinal(Event &e);
+    virtual void onDelivery(Event &e);
+    virtual void onTransport(Event &e);
+    virtual void onTransportError(Event &e);
+    virtual void onTransportHeadClosed(Event &e);
+    virtual void onTransportTailClosed(Event &e);
+    virtual void onTransportClosed(Event &e);
+    virtual void onSelectableInit(Event &e);
+    virtual void onSelectableUpdated(Event &e);
+    virtual void onSelectableReadable(Event &e);
+    virtual void onSelectableWritable(Event &e);
+    virtual void onSelectableExpired(Event &e);
+    virtual void onSelectableError(Event &e);
+    virtual void onSelectableFinal(Event &e);
+
+    virtual void onUnhandled(Event &e);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
new file mode 100644
index 0000000..197cfb1
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
@@ -0,0 +1,47 @@
+#ifndef PROTON_CPP_RECEIVER_H
+#define PROTON_CPP_RECEIVER_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/cpp/ImportExport.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Link.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Receiver : public Link
+{
+  public:
+    PROTON_CPP_EXTERN Receiver(pn_link_t *lnk);
+    PROTON_CPP_EXTERN Receiver();
+  protected:
+    virtual void verifyType(pn_link_t *l);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_RECEIVER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
new file mode 100644
index 0000000..fa8cce8
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_SENDER_H
+#define PROTON_CPP_SENDER_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/cpp/ImportExport.h"
+#include "proton/cpp/Link.h"
+#include "proton/cpp/Message.h"
+
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+
+class Sender : public Link
+{
+  public:
+    PROTON_CPP_EXTERN Sender(pn_link_t *lnk);
+    PROTON_CPP_EXTERN Sender();
+    PROTON_CPP_EXTERN void send(Message &m);
+  protected:
+    virtual void verifyType(pn_link_t *l);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_SENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Session.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h
new file mode 100644
index 0000000..e556cde
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Session.h
@@ -0,0 +1,59 @@
+#ifndef PROTON_CPP_SESSION_H
+#define PROTON_CPP_SESSION_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/cpp/ImportExport.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Link.h"
+
+#include "proton/types.h"
+#include "proton/link.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Container;
+class Handler;
+class Transport;
+
+class Session : public Endpoint
+{
+  public:
+    PROTON_CPP_EXTERN Session(pn_session_t *s);
+    PROTON_CPP_EXTERN ~Session();
+    PROTON_CPP_EXTERN void open();
+    PROTON_CPP_EXTERN void close();
+    PROTON_CPP_EXTERN pn_session_t *getPnSession();
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    Receiver createReceiver(std::string name);
+    Sender createSender(std::string name);
+  private:
+    pn_session_t *pnSession;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_SESSION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/Transport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Transport.h b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
new file mode 100644
index 0000000..141e0a3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
@@ -0,0 +1,48 @@
+#ifndef PROTON_CPP_TRANSPORT_H
+#define PROTON_CPP_TRANSPORT_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/cpp/ImportExport.h"
+#include "proton/transport.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Connection;
+
+class Transport
+{
+  public:
+    PROTON_CPP_EXTERN Transport();
+    PROTON_CPP_EXTERN ~Transport();
+    PROTON_CPP_EXTERN void bind(Connection &c);
+    Connection *connection;
+    pn_transport_t *pnTransport;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_TRANSPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
new file mode 100644
index 0000000..713c5c5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
@@ -0,0 +1,56 @@
+#ifndef PROTON_CPP_EXCEPTIONS_H
+#define PROTON_CPP_EXCEPTIONS_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/cpp/ImportExport.h"
+#include <string>
+#include <exception>
+
+namespace proton {
+namespace reactor {
+
+class ProtonException : public std::exception
+{
+  public:
+    PROTON_CPP_EXTERN explicit ProtonException(const std::string& message=std::string()) throw();
+    PROTON_CPP_EXTERN virtual ~ProtonException() throw();
+    PROTON_CPP_EXTERN virtual const char* what() const throw();
+
+  private:
+    const std::string message;
+};
+
+class MessageReject : public ProtonException
+{
+  public:
+    PROTON_CPP_EXTERN explicit MessageReject(const std::string& message=std::string()) throw();
+};
+
+class MessageRelease : public ProtonException
+{
+  public:
+    PROTON_CPP_EXTERN explicit MessageRelease(const std::string& message=std::string()) throw();
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Acceptor.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Acceptor.cpp b/proton-c/bindings/cpp/src/Acceptor.cpp
new file mode 100644
index 0000000..aa73ebf
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Acceptor.cpp
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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/cpp/Acceptor.h"
+#include "proton/cpp/exceptions.h"
+#include "ProtonImplRef.h"
+#include "Msg.h"
+
+namespace proton {
+namespace reactor {
+
+template class ProtonHandle<pn_acceptor_t>;
+typedef ProtonImplRef<Acceptor> PI;
+
+Acceptor::Acceptor() {}
+
+Acceptor::Acceptor(pn_acceptor_t *a)
+{
+    PI::ctor(*this, a);
+}
+
+Acceptor::~Acceptor() { PI::dtor(*this); }
+
+
+Acceptor::Acceptor(const Acceptor& a) : ProtonHandle<pn_acceptor_t>() {
+    PI::copy(*this, a);
+}
+
+Acceptor& Acceptor::operator=(const Acceptor& a) {
+    return PI::assign(*this, a);
+}
+
+void Acceptor::close() {
+    if (impl)
+        pn_acceptor_close(impl);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
new file mode 100644
index 0000000..e85b323
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Handler.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+#include "contexts.h"
+#include "ConnectionImpl.h"
+#include "PrivateImplRef.h"
+
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+template class Handle<ConnectionImpl>;
+typedef PrivateImplRef<Connection> PI;
+
+Connection::Connection() {}
+Connection::Connection(ConnectionImpl* p) { PI::ctor(*this, p); }
+Connection::Connection(const Connection& c) : Handle<ConnectionImpl>() { PI::copy(*this, c); }
+
+Connection& Connection::operator=(const Connection& c) { return PI::assign(*this, c); }
+Connection::~Connection() { PI::dtor(*this); }
+
+Connection::Connection(Container &c) {
+    ConnectionImpl *cimpl = new ConnectionImpl(c);
+    PI::ctor(*this, cimpl);
+}
+
+Transport &Connection::getTransport() { return impl->getTransport(); }
+
+Handler* Connection::getOverride() { return impl->getOverride(); }
+void Connection::setOverride(Handler *h) { impl->setOverride(h); }
+
+void Connection::open() { impl->open(); }
+
+void Connection::close() { impl->close(); }
+
+pn_connection_t *Connection::getPnConnection() { return impl->getPnConnection(); }
+
+std::string Connection::getHostname() { return impl->getHostname(); }
+
+Connection &Connection::getConnection() {
+    return (*this);
+}
+
+Container &Connection::getContainer() { return impl->getContainer(); }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
new file mode 100644
index 0000000..2feecb5
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/Handler.h"
+#include "proton/cpp/exceptions.h"
+#include "ConnectionImpl.h"
+#include "Msg.h"
+#include "contexts.h"
+
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+void ConnectionImpl::incref(ConnectionImpl *impl) {
+    impl->refCount++;
+}
+
+void ConnectionImpl::decref(ConnectionImpl *impl) {
+    impl->refCount--;
+    if (impl->refCount == 0)
+        delete impl;
+}
+
+ConnectionImpl::ConnectionImpl(Container &c) : container(c), refCount(0), override(0), transport(0), defaultSession(0),
+                                               pnConnection(pn_reactor_connection(container.getReactor(), NULL)),
+                                               reactorReference(this)
+{
+    setConnectionContext(pnConnection, this);
+}
+
+ConnectionImpl::~ConnectionImpl() {}
+
+Transport &ConnectionImpl::getTransport() {
+    if (transport)
+        return *transport;
+    throw ProtonException(MSG("Connection has no transport"));
+}
+
+Handler* ConnectionImpl::getOverride() { return override; }
+void ConnectionImpl::setOverride(Handler *h) { override = h; }
+
+void ConnectionImpl::open() {
+    pn_connection_open(pnConnection);
+}
+
+void ConnectionImpl::close() {
+    pn_connection_close(pnConnection);
+}
+
+pn_connection_t *ConnectionImpl::getPnConnection() { return pnConnection; }
+
+std::string ConnectionImpl::getHostname() {
+    return std::string(pn_connection_get_hostname(pnConnection));
+}
+
+Connection &ConnectionImpl::getConnection() {
+    // Endpoint interface.  Should be implemented in the Connection object.
+    throw ProtonException(MSG("Internal error"));
+}
+
+Container &ConnectionImpl::getContainer() {
+    return (container);
+}
+
+void ConnectionImpl::reactorDetach() {
+    // "save" goes out of scope last, preventing possible recursive destructor
+    // confusion with reactorReference.
+    Connection save(reactorReference);
+    if (reactorReference)
+        reactorReference = Connection();
+    pnConnection = 0;
+}
+
+Connection &ConnectionImpl::getReactorReference(pn_connection_t *conn) {
+    if (!conn)
+        throw ProtonException(MSG("Null Proton connection"));
+    ConnectionImpl *impl = getConnectionContext(conn);
+    if (!impl) {
+        // First time we have seen this connection
+        pn_reactor_t *reactor = pn_object_reactor(conn);
+        if (!reactor)
+            throw ProtonException(MSG("Invalid Proton connection specifier"));
+        Container container(getContainerContext(reactor));
+        if (!container)  // can't be one created by our container
+            throw ProtonException(MSG("Unknown Proton connection specifier"));
+        Connection connection(container);
+        impl = connection.impl;
+        setConnectionContext(conn, impl);
+        impl->reactorReference = connection;
+    }
+    return impl->reactorReference;
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
new file mode 100644
index 0000000..ad8d71e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -0,0 +1,73 @@
+#ifndef PROTON_CPP_CONNECTIONIMPL_H
+#define PROTON_CPP_CONNECTIONIMPL_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/cpp/ImportExport.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Transport;
+class Container;
+
+class ConnectionImpl : public Endpoint
+{
+  public:
+    PROTON_CPP_EXTERN ConnectionImpl(Container &c);
+    PROTON_CPP_EXTERN ~ConnectionImpl();
+    PROTON_CPP_EXTERN Transport &getTransport();
+    PROTON_CPP_EXTERN Handler *getOverride();
+    PROTON_CPP_EXTERN void setOverride(Handler *h);
+    PROTON_CPP_EXTERN void open();
+    PROTON_CPP_EXTERN void close();
+    PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
+    PROTON_CPP_EXTERN Container &getContainer();
+    PROTON_CPP_EXTERN std::string getHostname();
+    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    static Connection &getReactorReference(pn_connection_t *);
+    static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }
+    void reactorDetach();
+    static void incref(ConnectionImpl *);
+    static void decref(ConnectionImpl *);
+  private:
+    friend class Connector;
+    friend class ContainerImpl;
+    Container container;
+    int refCount;
+    Handler *override;
+    Transport *transport;
+    pn_session_t *defaultSession;  // Temporary, for SessionPerConnection style policy.
+    pn_connection_t *pnConnection;
+    Connection reactorReference;   // Keep-alive reference, until PN_CONNECTION_FINAL.
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.cpp b/proton-c/bindings/cpp/src/Connector.cpp
new file mode 100644
index 0000000..6885575
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Connector.cpp
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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/cpp/Connection.h"
+#include "proton/cpp/Transport.h"
+#include "proton/cpp/Container.h"
+#include "proton/cpp/Event.h"
+#include "proton/connection.h"
+#include "Connector.h"
+#include "ConnectionImpl.h"
+#include "Url.h"
+#include "LogInternal.h"
+
+namespace proton {
+namespace reactor {
+
+Connector::Connector(Connection &c) : connection(c), transport(0) {}
+
+Connector::~Connector() {}
+
+void Connector::setAddress(const std::string &a) {
+    address = a;
+}
+
+void Connector::connect() {
+    pn_connection_t *conn = connection.getPnConnection();
+    pn_connection_set_container(conn, connection.getContainer().getContainerId().c_str());
+    Url url(address);
+    std::string hostname = url.getHost() + ":" + url.getPort();
+    pn_connection_set_hostname(conn, hostname.c_str());
+    PN_CPP_LOG(info, "connecting to " << hostname << "...");
+    transport = new Transport();
+    transport->bind(connection);
+    connection.impl->transport = transport;
+}
+
+
+void Connector::onConnectionLocalOpen(Event &e) {
+    connect();
+}
+
+void Connector::onConnectionRemoteOpen(Event &e) {
+    PN_CPP_LOG(info, "connected to " << e.getConnection().getHostname());
+}
+
+void Connector::onConnectionInit(Event &e) {
+
+}
+
+void Connector::onTransportClosed(Event &e) {
+    // TODO: prepend with reconnect logic
+    PN_CPP_LOG(info, "Disconnected");
+    connection.setOverride(0);  // No more call backs
+    pn_connection_release(connection.impl->pnConnection);
+    delete this;
+}
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Connector.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.h b/proton-c/bindings/cpp/src/Connector.h
new file mode 100644
index 0000000..d829699
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Connector.h
@@ -0,0 +1,59 @@
+#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/cpp/ProtonHandler.h"
+#include "proton/event.h"
+#include "proton/reactor.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class Connection;
+class Transport;
+
+class Connector : public ProtonHandler
+{
+  public:
+    Connector(Connection &c);
+    ~Connector();
+    void setAddress(const std::string &host);
+    void connect();
+    virtual void onConnectionLocalOpen(Event &e);
+    virtual void onConnectionRemoteOpen(Event &e);
+    virtual void onConnectionInit(Event &e);
+    virtual void onTransportClosed(Event &e);
+
+  private:
+    Connection connection;
+    std::string address;
+    Transport *transport;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
new file mode 100644
index 0000000..8e79b15
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingEvent.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Session.h"
+#include "proton/cpp/MessagingAdapter.h"
+#include "proton/cpp/Acceptor.h"
+#include "proton/cpp/exceptions.h"
+#include "ContainerImpl.h"
+#include "PrivateImplRef.h"
+#include "LogInternal.h"
+
+#include "Connector.h"
+#include "contexts.h"
+#include "Url.h"
+#include "platform.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+
+namespace proton {
+namespace reactor {
+
+template class Handle<ContainerImpl>;
+typedef PrivateImplRef<Container> PI;
+
+Container::Container(ContainerImpl* p) { PI::ctor(*this, p); }
+Container::Container(const Container& c) : Handle<ContainerImpl>() { PI::copy(*this, c); }
+Container& Container::operator=(const Container& c) { return PI::assign(*this, c); }
+Container::~Container() { PI::dtor(*this); }
+
+Container::Container(MessagingHandler &mhandler) {
+    ContainerImpl *cimpl = new ContainerImpl(mhandler);
+    PI::ctor(*this, cimpl);
+}
+
+Connection Container::connect(std::string &host) { return impl->connect(host); }
+
+pn_reactor_t *Container::getReactor() { return impl->getReactor(); }
+
+pn_handler_t *Container::getGlobalHandler() { return impl->getGlobalHandler(); }
+
+std::string Container::getContainerId() { return impl->getContainerId(); }
+
+
+Sender Container::createSender(Connection &connection, std::string &addr) {
+    return impl->createSender(connection, addr);
+}
+
+Sender Container::createSender(std::string &urlString) {
+    return impl->createSender(urlString);
+}
+
+Receiver Container::createReceiver(Connection &connection, std::string &addr) {
+    return impl->createReceiver(connection, addr);
+}
+
+Acceptor Container::listen(const std::string &urlString) {
+    return impl->listen(urlString);
+}
+
+
+void Container::run() {
+    impl->run();
+}
+
+}} // namespace proton::reactor


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


[28/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Reactor class to the Ruby reactor APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Reactor class to the Ruby reactor APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 02387ab28d29367ac43dda2beac1bd95ca884c04
Parents: 979b098
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Feb 23 16:21:02 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb     |   1 +
 proton-c/bindings/ruby/lib/reactor/reactor.rb | 198 +++++++++++++++++++++
 2 files changed, 199 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/02387ab2/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index bffd4d1..f8703e7 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -95,6 +95,7 @@ require "handler/messaging_handler"
 # Reactor classes
 require "reactor/task"
 require "reactor/acceptor"
+require "reactor/reactor"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/02387ab2/proton-c/bindings/ruby/lib/reactor/reactor.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/reactor.rb b/proton-c/bindings/ruby/lib/reactor/reactor.rb
new file mode 100644
index 0000000..1cf4f6c
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/reactor.rb
@@ -0,0 +1,198 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class Reactor
+
+    include Qpid::Proton::Util::Handler
+
+    # @private
+    include Qpid::Proton::Util::SwigHelper
+
+    # @private
+    PROTON_METHOD_PREFIX = "pn_reactor"
+
+    proton_caller :yield
+
+    proton_caller :mark
+
+    proton_caller :start
+
+    proton_caller :stop
+
+    # @private
+    include Qpid::Proton::Util::Timeout
+
+    include Qpid::Proton::Util::Wrapper
+
+    attr_reader :errors
+
+    def self.wrap(impl)
+      return nil if impl.nil?
+
+      self.fetch_instance(impl, :pn_reactor_attachments) || Reactor.new(nil, :impl => impl)
+    end
+
+    def initialize(handlers, options = {})
+      @impl = options[:impl]
+      if @impl.nil?
+        @impl = Cproton.pn_reactor
+      end
+      if !handlers.nil?
+        [handlers].flatten.each {|handler| self.handler.add(handler)}
+      end
+      @errors = []
+      @handlers = []
+      self.class.store_instance(self, :pn_reactor_attachments)
+    end
+
+    # Returns whether the reactor has any unbuffered data.
+    #
+    # @return [Boolean] True if there is no unbuffered data.
+    #
+    def quiesced?
+      Cproton.pn_reactor_quiesced(@impl)
+    end
+
+    def on_error(info)
+      self.errors << info
+      self.yield
+    end
+
+    def global_handler
+      impl = Cproton.pn_reactor_get_global_handler(@impl)
+      Qpid::Proton::Handler::WrappedHandler.wrap(impl, self.method(:on_error))
+    end
+
+    def global_handler=(handler)
+      impl = chandler(handler, self.method(:on_error))
+      Cproton.pn_reactor_set_global_handler(@impl, impl)
+      Cproton.pn_decref(impl)
+    end
+
+    # Returns the timeout period.
+    #
+    # @return [Fixnum] The timeout period, in seconds.
+    #
+    def timeout
+      millis_to_timeout(Cproton.pn_reactor_get_timeout(@impl))
+    end
+
+    # Sets the timeout period.
+    #
+    # @param timeout [Fixnum] The timeout, in seconds.
+    #
+    def timeout=(timeout)
+      Cproton.pn_reactor_set_timeout(@impl, timeout_to_millis(timeout))
+    end
+
+    def handler
+      impl = Cproton.pn_reactor_get_handler(@impl)
+      Qpid::Proton::Handler::WrappedHandler.wrap(impl, self.method(:on_error))
+    end
+
+    def handler=(handler)
+      impl = chandler(handler, set.method(:on_error))
+      Cproton.pn_reactor_set_handler(@impl, impl)
+      Cproton.pn_decref(impl)
+    end
+
+    def run(&block)
+      self.timeout = 3.14159265359
+      self.start
+      while self.process do
+        if block_given?
+          yield
+        end
+      end
+      self.stop
+    end
+
+    def wakeup
+      n = Cproton.pn_reactor_wakeup(@impl)
+      unless n.zero?
+        io = Cproton.pn_reactor_io(@impl)
+        raise IOError.new(Cproton.pn_io_error(io))
+      end
+    end
+
+    def process
+      result = Cproton.pn_reactor_process(@impl)
+      if !self.errors.nil? && !self.errors.empty?
+        (0...self.errors.size).each do |index|
+          error_set = self.errors[index]
+          print error.backtrace.join("\n")
+        end
+        raise self.errors.last
+      end
+      return result
+    end
+
+    def schedule(delay, task)
+      impl = chandler(task, self.method(:on_error))
+      task = Task.wrap(Cproton.pn_reactor_schedule(@impl, sec_to_millis(delay), impl))
+      Cproton.pn_decref(impl)
+      return task
+    end
+
+    def acceptor(host, port, handler = nil)
+      impl = chandler(handler, self.method(:on_error))
+      aimpl = Cproton.pn_reactor_acceptor(@impl, host, "#{port}", impl)
+      Cproton.pn_decref(impl)
+      if !aimpl.nil?
+        return Acceptor.new(aimpl)
+      else
+        io = Cproton.pn_reactor_io(@impl)
+        io_error = Cproton.pn_io_error(io)
+        error_text = Cproton.pn_error_text(io_error)
+        text = "(#{Cproton.pn_error_text(io_error)} (#{host}:#{port}))"
+        raise IOError.new(text)
+      end
+    end
+
+    def connection(handler = nil)
+      impl = chandler(handler, self.method(:on_error))
+      conn = Qpid::Proton::Connection.wrap(Cproton.pn_reactor_connection(@impl, impl))
+      Cproton.pn_decref(impl)
+      return conn
+    end
+
+    def selectable(handler = nil)
+      impl = chandler(handler, self.method(:on_error))
+      result = Selectable.wrap(Cproton.pn_reactor_selectable(@impl))
+      if !impl.nil?
+        record = Cproton.pn_selectable_attachments(result.impl)
+        Cproton.pn_record_set_handler(record, impl)
+        Cproton.pn_decref(impl)
+      end
+      return result
+    end
+
+    def update(sel)
+      Cproton.pn_reactor_update(@impl, sel.impl)
+    end
+
+    def push_event(obj, etype)
+      Cproton.pn_collector_put(Cproton.pn_reactor_collector(@impl), Qpid::Proton::Util::RBCTX, Cproton.pn_py2void(obj), etype.number)
+    end
+
+  end
+
+end


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


[23/50] [abbrv] qpid-proton git commit: PROTON-781: Reactive Ruby examples

Posted by ac...@apache.org.
PROTON-781: Reactive Ruby examples


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

Branch: refs/heads/cjansen-cpp-client
Commit: 8118ea7fee121d6f3db10ed6359966317db32472
Parents: 6a77ab5
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Tue May 26 15:34:11 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 examples/ruby/lib/debugging.rb             |  26 +++
 examples/ruby/lib/send_and_receive.rb      |  90 +++++++++++
 examples/ruby/reactor/README.md            | 103 ++++++++++++
 examples/ruby/reactor/broker.rb            | 200 ++++++++++++++++++++++++
 examples/ruby/reactor/client.rb            |  68 ++++++++
 examples/ruby/reactor/direct_recv.rb       |  60 +++++++
 examples/ruby/reactor/direct_send.rb       |  59 +++++++
 examples/ruby/reactor/helloworld.rb        |  69 ++++++++
 examples/ruby/reactor/helloworld_direct.rb |  74 +++++++++
 examples/ruby/reactor/server.rb            |  64 ++++++++
 examples/ruby/reactor/simple_recv.rb       |  58 +++++++
 examples/ruby/reactor/simple_send.rb       |  55 +++++++
 12 files changed, 926 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/lib/debugging.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/debugging.rb b/examples/ruby/lib/debugging.rb
new file mode 100644
index 0000000..5065d51
--- /dev/null
+++ b/examples/ruby/lib/debugging.rb
@@ -0,0 +1,26 @@
+#--
+# 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.
+#++
+
+module Debugging
+
+  def debug(text)
+    print "[#{Time.now.strftime('%s')}] #{text}\n"
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/lib/send_and_receive.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/send_and_receive.rb b/examples/ruby/lib/send_and_receive.rb
new file mode 100644
index 0000000..9fd7417
--- /dev/null
+++ b/examples/ruby/lib/send_and_receive.rb
@@ -0,0 +1,90 @@
+#--
+# 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.
+#++
+
+class ExampleSend < Qpid::Proton::Handler::MessagingHandler
+
+  attr_reader :url
+
+  def initialize(url, expected)
+    super()
+    @url = url
+    @sent = 0
+    @confirmed = 0
+    @expected = expected
+  end
+
+  def on_sendable(event)
+    while event.sender.credit > 0 && @sent < @expected
+      msg = Qpid::Proton::Message.new
+      msg.body = "sequence #{@sent}"
+      msg.id = @sent
+      event.sender.send(msg)
+      @sent = @sent + 1
+    end
+  end
+
+  def on_accepted(event)
+    @confirmed = @confirmed + 1
+    if self.finished?
+      puts "#{@expected > 1 ? 'All ' : ''}#{@expected} message#{@expected > 1 ? 's' : ''} confirmed!"
+      event.connection.close
+    end
+  end
+
+  def on_disconnected(event)
+    @sent = @confirmed
+  end
+
+  def finished?
+    @confirmed == @expected
+  end
+
+end
+
+class ExampleReceive < Qpid::Proton::Handler::MessagingHandler
+
+  attr_reader :url
+
+  def initialize(url, expected)
+    super()
+    @url = url
+    @expected = expected
+    @received = 0
+  end
+
+  def on_message(event)
+    if event.message.id.nil? || event.message.id < @received
+      puts "Missing or old message id: id=#{event.message.id}"
+      return
+    end
+    if @expected.zero? || (@received < @expected)
+      puts "Received: #{event.message.body}"
+      @received = @received + 1
+      if finished?
+        event.receiver.close
+        event.connection.close
+      end
+    end
+  end
+
+  def finished?
+    @received == @expected
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/README.md
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/README.md b/examples/ruby/reactor/README.md
new file mode 100644
index 0000000..38cc6ba
--- /dev/null
+++ b/examples/ruby/reactor/README.md
@@ -0,0 +1,103 @@
+## What Is The Reactor?
+
+A little outside of the scope of this document, but the reactor is an event source for letting an application know about events in the Proton messaging system. With this set of APIs an application can be register handlers that are notified when a connection is created, a message received, or a session closes.
+
+### Handlers
+
+An application creates **handlers**, objects which provide methods through which the reactor notifies the application's components of events and allows them each to handle the ones in which they are interested (see the Chain Of Responsibility design pattern for more on this idea). There are some pre-defined handlers for responding to incoming message events, outgoing message events, data flow and managing the AMQP endpoints. Look in the **Qpid::Proton::Handlers** package for more details on these classes.
+
+## Simple Reactor Examples
+
+### The Broker
+
+The reactor examples come with a sample broker which can be used by other examples and which also works as an example itself. For now we'll just start up the broker example and tell it to listen on port 8888:
+
+````
+$ ruby ../examples/ruby/reactor/broker.rb  --address=0.0.0.0:8888
+Listening on 0.0.0.0:8888
+````
+
+This example broker will receive messages, create queues as needed, and deliver messages to endpoints.
+
+### Hello World Using A Broker
+
+Our first example creates an endpoint that sends messages to a queue to which it is subscribed. So it both sends and receives its message in one pass.
+
+To start it, simply run:
+
+```
+$ ruby ../examples/ruby/reactor/helloworld.rb --address=0.0.0.0:8888 --queue=examples
+Hello world!
+```
+
+As you can see, the classic message was output by the example. Now let's take a look at what's going on under the covers.
+
+#### Events When Talking To A Broker
+
+The following events occur while **helloworld.rb** runs:
+
+ * **on_start** - Fired when the application is started.
+ * **on_sendable** - Fired when a message can be sent.
+ * **on_message** - Fired when a message is received.
+
+### Hello World Without A Broker required
+
+The next example we'll look at will send the classic "Hello world" message to itself directly. This example shows some very fundamental elements of the reactor APIs that you should understand.
+
+To launch the example:
+
+```
+ $ ruby helloworld_direct.rb --address=0.0.0.0:8888/examples
+ Hello world!
+```
+
+Not very different from the example that uses the broker, which is what we'd expect from the outside. But let's take a look inside of the example and see how it's different at that level
+
+The direct version takes on the responsibility for listening to incoming connections as well as making an outgoing connection. So we see the following additional events occurring:
+
+ * **on_accepted** - Fired when a message is received.
+ * **on_connection_closed** - Fired when an endpoint closes its connection.
+
+## More Complex Reactor Examples
+
+Now that we've covered the basics with the archetypical hello world app, let's look at some more interesting examples.
+
+There are four example applications that demonstrate how to send and receive messages both directly and through an intermediary, such as a broker:
+
+ * **simple_send.rb** - sends messages to a receiver at a specific address and receives responses via an intermediary,
+ * **simple_recv.rb** - receives messages from via an intermediary,
+ * **direct_send.rb** - sends messages directly to a receiver and listens for responses itself, and
+ * **direct_recv.rb** - receives messages directly.
+
+ Simple send and direct send may, at first, seem to be so similar that you wonder why they're not just the same applciation. And I know for me I was wonder as I wrote the list above why there were two examples. The reason is that **simple_send.rb** uses the intermediary transfer responses to the messages it sends, while **direct_send.rb** uses an *Acceptor* to listen for an process responses.
+
+ You can use the examples in the follow ways:
+
+ ```
+ simple_send.rb -> broker <- simple_recv.rb
+ simple_send.rb -> direct_recv.rb
+ direct_send.rb -> simple_recv.rb
+ ```
+
+In this set of examples we see the following event occurring, in addition to what we've seen before:
+
+ * **on_disconnected** - Fired when the transport is closed.
+
+## Now About That Broker example
+
+The **broker.rb** example application is a nice demonstration of doing something more interesting in Ruby with Proton.
+
+The way the broker works is to listen to incoming connections, examine the components of the address for that connection, attach that connection to an exchange managing that address and then it sends any messages destined for that address to them.
+
+The components of the broker example include:
+ * **Broker** - A class that extends the MessagingHandler class. It accepts incoming connections, manages subscribing them to exchanges, and transfers messages between them.
+ * **Exchange** - A class that represents a message queue, tracking what endpoints are subscribed to it.
+
+The Broker manages a map connecting a queue address to the instance of Exchange that holds references to the endpoints of interest.
+
+The broker application demonstrates a new set of reactor events:
+
+ * **on_link_opening** - Fired when a remote link is opened but the local end is not yet open. From this event the broker grabs the address and subscribes the link to an exchange for that address.
+ * **on_link_closing** - Fired when a remote link is closed but the local end is still open. From this event the broker grabs the address and unsubscribes the link from that exchange.
+ * **on_connection_closing** - Fired when a remote connection is closed but the local end is still open.
+ * **on_disconnected** - Fired when the protocol transport has closed. The broker removes all links for the disconnected connection, avoiding workign with endpoints that are now gone.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/broker.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/broker.rb b/examples/ruby/reactor/broker.rb
new file mode 100644
index 0000000..9d7e5be
--- /dev/null
+++ b/examples/ruby/reactor/broker.rb
@@ -0,0 +1,200 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+require 'pathname'
+
+require_relative '../lib/debugging'
+
+class Exchange
+
+  include Debugging
+
+  def initialize(dynamic = false)
+    @dynamic = dynamic
+    @queue = Queue.new
+    @consumers = []
+  end
+
+  def subscribe(consumer)
+    debug("subscribing #{consumer}") if $options[:debug]
+    @consumers << (consumer)
+    debug(" there are #{@consumers.size} consumers") if $options[:debug]
+  end
+
+  def unsubscribe(consumer)
+    debug("unsubscribing #{consumer}") if $options[:debug]
+    if @consumers.include?(consumer)
+      @consumers.delete(consumer)
+    else
+      debug(" consumer doesn't exist") if $options[:debug]
+    end
+    debug("  there are #{@consumers.size} consumers") if $options[:debug]
+    @consumers.empty? && (@dynamic || @queue.empty?)
+  end
+
+  def publish(message)
+    debug("queueing message: #{message.body}") if $options[:debug]
+    @queue << message
+    self.dispatch
+  end
+
+  def dispatch(consumer = nil)
+    debug("dispatching: consumer=#{consumer}") if $options[:debug]
+    if consumer
+      c = [consumer]
+    else
+      c = @consumers
+    end
+
+    while self.deliver_to(c) do
+    end
+  end
+
+  def deliver_to(consumers)
+    debug("delivering to #{consumers.size} consumer(s)") if $options[:debug]
+    result = false
+    consumers.each do |consumer|
+      debug(" current consumer=#{consumer} credit=#{consumer.credit}") if $options[:debug]
+      if consumer.credit > 0 && !@queue.empty?
+        consumer.send(@queue.pop(true))
+        result = true
+      end
+    end
+    return result
+  end
+
+end
+
+class Broker < Qpid::Proton::Handler::MessagingHandler
+
+  include Debugging
+
+  def initialize(url)
+    super()
+    @url = url
+    @queues = {}
+  end
+
+  def on_start(event)
+    debug("on_start event") if $options[:debug]
+    @acceptor = event.container.listen(@url)
+    print "Listening on #{@url}\n"
+  end
+
+  def queue(address)
+    debug("fetching queue for #{address}: (there are #{@queues.size} queues)") if $options[:debug]
+    unless @queues.has_key?(address)
+      debug(" creating new queue") if $options[:debug]
+      @queues[address] = Exchange.new
+    else
+      debug(" using existing queue") if $options[:debug]
+    end
+    result = @queues[address]
+    debug(" returning #{result}") if $options[:debug]
+    return result
+  end
+
+  def on_link_opening(event)
+    debug("processing on_link_opening") if $options[:debug]
+    debug("link is#{event.link.sender? ? '' : ' not'} a sender") if $options[:debug]
+    if event.link.sender?
+      if event.link.remote_source.dynamic?
+        address = generate_uuid
+        event.link.source.address = address
+        q = Exchange.new(true)
+        @queues[address] = q
+        q.subscribe(event.link)
+      elsif event.link.remote_source.address
+        event.link.source.address = event.link.remote_source.address
+        self.queue(event.link.source.address).subscribe(event.link)
+      end
+    elsif event.link.remote_target.address
+      event.link.target.address = event.link.remote_target.address
+    end
+  end
+
+  def unsubscribe(link)
+    debug("unsubscribing #{link.address}") if $options[:debug]
+    if @queues.has_key?(link.source.address)
+      if @queues[link.source.address].unsubscribe(link)
+        @queues.delete(link.source.address)
+      end
+    end
+  end
+
+  def on_link_closing(event)
+    self.unsubscribe(event.link) if event.link.sender?
+  end
+
+  def on_connection_closing(event)
+    self.remove_stale_consumers(event.connection)
+  end
+
+  def on_disconnected(event)
+    self.remove_stale_consumers(event.connection)
+  end
+
+  def remove_stale_consumers(connection)
+    l = connection.link_head(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
+    while !l.nil?
+      self.unsubscribe(l) if l.sender?
+      l = l.next(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
+    end
+  end
+
+  def on_sendable(event)
+    debug("on_sendable event") if $options[:debug]
+    q = self.queue(event.link.source.address)
+    debug(" dispatching #{event.message} to #{q}") if $options[:debug]
+    q.dispatch(event.link)
+  end
+
+  def on_message(event)
+    debug("on_message event") if $options[:debug]
+    q = self.queue(event.link.target.address)
+    debug(" dispatching #{event.message} to #{q}") if $options[:debug]
+    q.publish(event.message)
+  end
+
+end
+
+$options = {
+  :address => "localhost:5672",
+  :debug => false
+}
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: #{Pathname.new(__FILE__).basename} [$options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{$options[:address]}).") do |address|
+    $options[:address] = address
+  end
+
+  opts.on("-d", "--debug", "Enable debugging output (def. #{$options[:debug]})") do
+    $options[:debug] = true
+  end
+
+end.parse!
+
+begin
+  Qpid::Proton::Reactor::Container.new(Broker.new($options[:address])).run
+rescue Interrupt
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/client.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/client.rb b/examples/ruby/reactor/client.rb
new file mode 100644
index 0000000..8bb58da
--- /dev/null
+++ b/examples/ruby/reactor/client.rb
@@ -0,0 +1,68 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+
+class Client < Qpid::Proton::Handler::MessagingHandler
+
+  def initialize(url, requests)
+    super()
+    @url = url
+    @requests = requests
+  end
+
+  def on_start(event)
+    @sender = event.container.create_sender(@url)
+    @receiver = event.container.create_receiver(@sender.connection, :dynamic => true)
+  end
+
+  def next_request
+    if @receiver.remote_source.address
+      req = Qpid::Proton::Message.new
+      req.reply_to = @receiver.remote_source.address
+      req.body = @requests.first
+      puts "-> #{req.body}"
+      @sender.send(req)
+    end
+  end
+
+  def on_link_opened(event)
+    if event.receiver == @receiver
+      next_request
+    end
+  end
+
+  def on_message(event)
+    puts "<- #{event.message.body}"
+    @requests.delete_at(0)
+    if !@requests.empty?
+      next_request
+    else
+      event.connection.close
+    end
+  end
+
+end
+
+REQUESTS = ["Twas brillig, and the slithy toves",
+            "Did gire and gymble in the wabe.",
+            "All mimsy were the borogroves,",
+            "And the mome raths outgrabe."]
+
+Qpid::Proton::Reactor::Container.new(Client.new("0.0.0.0:5672/examples", REQUESTS)).run

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/direct_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/direct_recv.rb b/examples/ruby/reactor/direct_recv.rb
new file mode 100644
index 0000000..2e19b04
--- /dev/null
+++ b/examples/ruby/reactor/direct_recv.rb
@@ -0,0 +1,60 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+require_relative '../lib/send_and_receive'
+
+class DirectReceive < ExampleReceive
+
+  def initialize(url, expected)
+    super
+  end
+
+  def on_start(event)
+    @acceptor = event.container.listen(self.url)
+  end
+
+  def on_message(event)
+    super(event)
+    @acceptor.close if self.finished?
+  end
+
+end
+
+options = {
+  :address => "localhost:5672/examples",
+  :messages => 100,
+}
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: simple_send.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
+    OptionParser::DecimalInteger) do |messages|
+    options[:messages] = messages
+  end
+end.parse!
+
+Qpid::Proton::Reactor::Container.new(DirectReceive.new(options[:address], options[:messages])).run

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/direct_send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/direct_send.rb b/examples/ruby/reactor/direct_send.rb
new file mode 100644
index 0000000..22ce7de
--- /dev/null
+++ b/examples/ruby/reactor/direct_send.rb
@@ -0,0 +1,59 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+require_relative '../lib/send_and_receive'
+
+options = {
+  :address => "localhost:5672/examples",
+  :messages => 100,
+}
+
+class SimpleSend < ExampleSend
+
+  def initialize(url, messages)
+    super(url, messages)
+  end
+
+  def on_start(event)
+    @acceptor = event.container.listen(url)
+  end
+
+end
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: simple_send.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
+    OptionParser::DecimalInteger) do |messages|
+    options[:messages] = messages
+  end
+end.parse!
+
+begin
+  Qpid::Proton::Reactor::Container.new(SimpleSend.new(options[:address], options[:messages])).run
+rescue Interrupt => error
+  puts "ERROR: #{error}"
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/helloworld.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/helloworld.rb b/examples/ruby/reactor/helloworld.rb
new file mode 100644
index 0000000..03eb561
--- /dev/null
+++ b/examples/ruby/reactor/helloworld.rb
@@ -0,0 +1,69 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+class HelloWorld < Qpid::Proton::Handler::MessagingHandler
+
+  def initialize(server, address)
+    super()
+    @server = server
+    @address = address
+  end
+
+  def on_start(event)
+    conn = event.container.connect(:address => @server)
+    event.container.create_sender(conn, :target => @address)
+    event.container.create_receiver(conn, :source => @address)
+  end
+
+  def on_sendable(event)
+    msg = Qpid::Proton::Message.new
+    msg.body = "Hello world!"
+    event.sender.send(msg)
+    event.sender.close
+  end
+
+  def on_message(event)
+    puts event.message.body
+    event.connection.close
+  end
+end
+
+options = {
+  :address => "localhost:5672",
+  :queue => "examples"
+}
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: helloworld_direct.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+  opts.on("-q", "--queue=QUEUE", "Send messages to QUEUE (def. #{options[:queue]})") do |queue|
+    options[:queue] = queue
+  end
+
+end.parse!
+
+hw = HelloWorld.new(options[:address], "examples")
+Qpid::Proton::Reactor::Container.new(hw).run

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/helloworld_direct.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/helloworld_direct.rb b/examples/ruby/reactor/helloworld_direct.rb
new file mode 100644
index 0000000..e98cc1f
--- /dev/null
+++ b/examples/ruby/reactor/helloworld_direct.rb
@@ -0,0 +1,74 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+options = {
+  :address => "localhost:5672/examples",
+}
+
+class HelloWorldDirect < Qpid::Proton::Handler::MessagingHandler
+
+  include Qpid::Proton::Util::Wrapper
+
+  def initialize(url)
+    super()
+    @url = url
+  end
+
+  def on_start(event)
+    @acceptor = event.container.listen(@url)
+    event.container.create_sender(@url)
+  end
+
+  def on_sendable(event)
+    msg = Qpid::Proton::Message.new
+    msg.body = "Hello world!"
+    event.sender.send(msg)
+    event.sender.close
+  end
+
+  def on_message(event)
+    puts "#{event.message.body}"
+  end
+
+  def on_accepted(event)
+    event.connection.close
+  end
+
+  def on_connection_closed(event)
+    @acceptor.close
+  end
+
+end
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: helloworld_direct.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+end.parse!
+
+begin
+  Qpid::Proton::Reactor::Container.new(HelloWorldDirect.new(options[:address])).run
+rescue Interrupt => error
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/server.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/server.rb b/examples/ruby/reactor/server.rb
new file mode 100644
index 0000000..e149dba
--- /dev/null
+++ b/examples/ruby/reactor/server.rb
@@ -0,0 +1,64 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+
+class Server < Qpid::Proton::Handler::MessagingHandler
+
+  def initialize(url, address)
+    super()
+    @url = url
+    @address = address
+    @senders = {}
+  end
+
+  def on_start(event)
+    puts "Listening on #{@url}"
+    @container = event.container
+    @conn = @container.connect(:address => @url)
+    @receiver = @container.create_receiver(@conn, :source => @address)
+    @relay = nil
+  end
+
+  def on_connection_opened(event)
+    if event.connection.remote_offered_capabilities &&
+      event.connection.remote_offered_capabilities.contain?("ANONYMOUS-RELAY")
+      @relay = @container.create_sender(@conn, nil)
+    end
+  end
+
+  def on_message(event)
+    msg = event.message
+    puts "<- #{msg.body}"
+    sender = @relay || @senders[msg.reply_to]
+    if sender.nil?
+      sender = @container.create_sender(@conn, :target => msg.reply_to)
+      @senders[msg.reply_to] = sender
+    end
+    reply = Qpid::Proton::Message.new
+    reply.address = msg.reply_to
+    reply.body = msg.body.upcase
+    puts "-> #{reply.body}"
+    reply.correlation_id = msg.correlation_id
+    sender.send(reply)
+  end
+
+end
+
+Qpid::Proton::Reactor::Container.new(Server.new("0.0.0.0:5672", "examples")).run()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/simple_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/simple_recv.rb b/examples/ruby/reactor/simple_recv.rb
new file mode 100644
index 0000000..55a37ee
--- /dev/null
+++ b/examples/ruby/reactor/simple_recv.rb
@@ -0,0 +1,58 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+require_relative '../lib/send_and_receive'
+
+class Receiver < ExampleReceive
+
+  def initialize(url, count)
+    super(url, count)
+  end
+
+  def on_start(event)
+    event.container.create_receiver(@url)
+  end
+
+end
+
+options = {
+  :address => "localhost:5672/examples",
+  :messages => 100,
+}
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: simple_send.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
+    OptionParser::DecimalInteger) do |messages|
+    options[:messages] = messages
+  end
+end.parse!
+
+begin
+  Qpid::Proton::Reactor::Container.new(Receiver.new(options[:address], options[:messages])).run
+rescue Interrupt
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8118ea7f/examples/ruby/reactor/simple_send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/simple_send.rb b/examples/ruby/reactor/simple_send.rb
new file mode 100644
index 0000000..1dd4150
--- /dev/null
+++ b/examples/ruby/reactor/simple_send.rb
@@ -0,0 +1,55 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'optparse'
+
+require_relative '../lib/send_and_receive'
+
+options = {
+  :address => "localhost:5672/examples",
+  :messages => 100,
+}
+
+class SimpleSend < ExampleSend
+
+  def initialize(url, messages)
+    super(url, messages)
+  end
+
+  def on_start(event)
+    event.container.create_sender(url)
+  end
+
+end
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: simple_send.rb [options]"
+
+  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
+    options[:address] = address
+  end
+
+  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
+    OptionParser::DecimalInteger) do |messages|
+    options[:messages] = messages
+  end
+end.parse!
+
+Qpid::Proton::Reactor::Container.new(SimpleSend.new(options[:address], options[:messages])).run


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


[33/50] [abbrv] qpid-proton git commit: PROTON-865: Use .hpp extension for C++ headers.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
new file mode 100644
index 0000000..91d8bd9
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
@@ -0,0 +1,83 @@
+#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/Handler.hpp"
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class ProtonEvent;
+
+class ProtonHandler : public Handler
+{
+  public:
+    PN_CPP_EXTERN ProtonHandler();
+    virtual void onReactorInit(Event &e);
+    virtual void onReactorQuiesced(Event &e);
+    virtual void onReactorFinal(Event &e);
+    virtual void onTimerTask(Event &e);
+    virtual void onConnectionInit(Event &e);
+    virtual void onConnectionBound(Event &e);
+    virtual void onConnectionUnbound(Event &e);
+    virtual void onConnectionLocalOpen(Event &e);
+    virtual void onConnectionLocalClose(Event &e);
+    virtual void onConnectionRemoteOpen(Event &e);
+    virtual void onConnectionRemoteClose(Event &e);
+    virtual void onConnectionFinal(Event &e);
+    virtual void onSessionInit(Event &e);
+    virtual void onSessionLocalOpen(Event &e);
+    virtual void onSessionLocalClose(Event &e);
+    virtual void onSessionRemoteOpen(Event &e);
+    virtual void onSessionRemoteClose(Event &e);
+    virtual void onSessionFinal(Event &e);
+    virtual void onLinkInit(Event &e);
+    virtual void onLinkLocalOpen(Event &e);
+    virtual void onLinkLocalClose(Event &e);
+    virtual void onLinkLocalDetach(Event &e);
+    virtual void onLinkRemoteOpen(Event &e);
+    virtual void onLinkRemoteClose(Event &e);
+    virtual void onLinkRemoteDetach(Event &e);
+    virtual void onLinkFlow(Event &e);
+    virtual void onLinkFinal(Event &e);
+    virtual void onDelivery(Event &e);
+    virtual void onTransport(Event &e);
+    virtual void onTransportError(Event &e);
+    virtual void onTransportHeadClosed(Event &e);
+    virtual void onTransportTailClosed(Event &e);
+    virtual void onTransportClosed(Event &e);
+    virtual void onSelectableInit(Event &e);
+    virtual void onSelectableUpdated(Event &e);
+    virtual void onSelectableReadable(Event &e);
+    virtual void onSelectableWritable(Event &e);
+    virtual void onSelectableExpired(Event &e);
+    virtual void onSelectableError(Event &e);
+    virtual void onSelectableFinal(Event &e);
+
+    virtual void onUnhandled(Event &e);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Receiver.hpp b/proton-c/bindings/cpp/include/proton/Receiver.hpp
new file mode 100644
index 0000000..a913b7b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Receiver.hpp
@@ -0,0 +1,48 @@
+#ifndef PROTON_CPP_RECEIVER_H
+#define PROTON_CPP_RECEIVER_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/ImportExport.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Link.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Receiver : public Link
+{
+  public:
+    PN_CPP_EXTERN Receiver(pn_link_t *lnk);
+    PN_CPP_EXTERN Receiver();
+    PN_CPP_EXTERN Receiver(const Link& c);
+  protected:
+    virtual void verifyType(pn_link_t *l);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_RECEIVER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Sender.hpp b/proton-c/bindings/cpp/include/proton/Sender.hpp
new file mode 100644
index 0000000..bb39b6d
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Sender.hpp
@@ -0,0 +1,52 @@
+#ifndef PROTON_CPP_SENDER_H
+#define PROTON_CPP_SENDER_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/ImportExport.hpp"
+#include "proton/Delivery.hpp"
+#include "proton/Link.hpp"
+#include "proton/Message.hpp"
+
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+
+class Sender : public Link
+{
+  public:
+    PN_CPP_EXTERN Sender(pn_link_t *lnk);
+    PN_CPP_EXTERN Sender();
+    PN_CPP_EXTERN Sender(const Link& c);
+    PN_CPP_EXTERN Delivery send(Message &m);
+  protected:
+    virtual void verifyType(pn_link_t *l);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_SENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Session.hpp b/proton-c/bindings/cpp/include/proton/Session.hpp
new file mode 100644
index 0000000..4a3eccc
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Session.hpp
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_SESSION_H
+#define PROTON_CPP_SESSION_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/ImportExport.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Link.hpp"
+
+#include "proton/types.h"
+#include "proton/link.h"
+#include "ProtonImplRef.hpp"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Container;
+class Handler;
+class Transport;
+
+ class Session : public Endpoint, public ProtonHandle<pn_session_t>
+{
+  public:
+    PN_CPP_EXTERN Session(pn_session_t *s);
+    PN_CPP_EXTERN Session();
+    PN_CPP_EXTERN ~Session();
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN Session(const Session&);
+    PN_CPP_EXTERN Session& operator=(const Session&);
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_session_t *getPnSession();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    Receiver createReceiver(std::string name);
+    Sender createSender(std::string name);
+  private:
+    friend class ProtonImplRef<Session>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_SESSION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Terminus.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Terminus.hpp b/proton-c/bindings/cpp/include/proton/Terminus.hpp
new file mode 100644
index 0000000..0b798b3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Terminus.hpp
@@ -0,0 +1,81 @@
+#ifndef PROTON_CPP_TERMINUS_H
+#define PROTON_CPP_TERMINUS_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/ImportExport.hpp"
+#include "proton/Link.hpp"
+
+#include "proton/link.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class Link;
+
+class Terminus : public ProtonHandle<pn_terminus_t>
+{
+    enum Type {
+        TYPE_UNSPECIFIED = PN_UNSPECIFIED,
+        SOURCE = PN_SOURCE,
+        TARGET = PN_TARGET,
+        COORDINATOR = PN_COORDINATOR
+    };
+    enum ExpiryPolicy {
+        NONDURABLE = PN_NONDURABLE,
+        CONFIGURATION = PN_CONFIGURATION,
+        DELIVERIES = PN_DELIVERIES
+    };
+    enum DistributionMode {
+        MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED,
+        COPY = PN_DIST_MODE_COPY,
+        MOVE = PN_DIST_MODE_MOVE
+    };
+
+  public:
+    PN_CPP_EXTERN Terminus();
+    PN_CPP_EXTERN ~Terminus();
+    PN_CPP_EXTERN Terminus(const Terminus&);
+    PN_CPP_EXTERN Terminus& operator=(const Terminus&);
+    PN_CPP_EXTERN pn_terminus_t *getPnTerminus();
+    PN_CPP_EXTERN Type getType();
+    PN_CPP_EXTERN void setType(Type);
+    PN_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
+    PN_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
+    PN_CPP_EXTERN DistributionMode getDistributionMode();
+    PN_CPP_EXTERN void setDistributionMode(DistributionMode);
+    PN_CPP_EXTERN std::string getAddress();
+    PN_CPP_EXTERN void setAddress(std::string &);
+    PN_CPP_EXTERN bool isDynamic();
+    PN_CPP_EXTERN void setDynamic(bool);
+
+  private:
+    Link *link;
+    PN_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
+    friend class Link;
+    friend class ProtonImplRef<Terminus>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_TERMINUS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Transport.hpp b/proton-c/bindings/cpp/include/proton/Transport.hpp
new file mode 100644
index 0000000..ca93674
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Transport.hpp
@@ -0,0 +1,48 @@
+#ifndef PROTON_CPP_TRANSPORT_H
+#define PROTON_CPP_TRANSPORT_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/ImportExport.hpp"
+#include "proton/transport.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Connection;
+
+class Transport
+{
+  public:
+    PN_CPP_EXTERN Transport();
+    PN_CPP_EXTERN ~Transport();
+    PN_CPP_EXTERN void bind(Connection &c);
+    Connection *connection;
+    pn_transport_t *pnTransport;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_TRANSPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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
new file mode 100644
index 0000000..9448dc5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Value.hpp
@@ -0,0 +1,98 @@
+#ifndef VALUE_H
+#define VALUE_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/Values.hpp"
+
+/**@file
+ * Holder for an AMQP value.
+ * @ingroup cpp
+ */
+namespace proton {
+namespace reactor {
+
+/** Holds a single AMQP value. */
+PN_CPP_EXTERN class Value {
+  public:
+    PN_CPP_EXTERN Value();
+    PN_CPP_EXTERN Value(const Value&);
+    /** Converting constructor from any settable value */
+    template <class T> explicit Value(const T& v);
+    PN_CPP_EXTERN ~Value();
+    PN_CPP_EXTERN Value& operator=(const Value&);
+
+
+    TypeId type() const;
+
+    /** Set the value. */
+    template<class T> void set(const T& value);
+    /** Get the value. */
+    template<class T> void get(T& value) const;
+    /** Get the value */
+    template<class T> T get() const;
+
+    /** Assignment sets the value */
+    template<class T> Value& operator=(const T& value);
+
+    /** Conversion operator gets  the value */
+    template<class T> operator T() const;
+
+    /** insert a value into an Encoder. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+
+    /** Extract a value from a decoder. */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+
+    /** Human readable format */
+    PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&);
+
+    bool operator==(const Value&) const;
+    bool operator !=(const Value& v) const{ return !(*this == v); }
+
+    /** operator < makes Value valid for use as a std::map key. */
+    bool operator<(const Value&) const;
+    bool operator>(const Value& v) const { return v < *this; }
+    bool operator<=(const Value& v) const { return !(*this > v); }
+    bool operator>=(const Value& v) const { return !(*this < v); }
+
+  private:
+    mutable Values values;
+};
+
+template<class T> void Value::set(const T& value) {
+    values.clear();
+    values << value;
+}
+
+template<class T> void Value::get(T& value) const {
+    Values& v = const_cast<Values&>(values);
+    v.rewind() >> value;
+}
+
+template<class T> T Value::get() const { T value; get(value); return value; }
+
+template<class T> Value& Value::operator=(const T& value) { set(value); return *this; }
+
+template<class T> Value::operator T() const { return get<T>(); }
+
+template<class T> Value::Value(const T& value) { set(value); }
+}}
+
+#endif // VALUE_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Values.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Values.hpp b/proton-c/bindings/cpp/include/proton/Values.hpp
new file mode 100644
index 0000000..0377c0c
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Values.hpp
@@ -0,0 +1,56 @@
+#ifndef VALUES_H
+#define VALUES_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/Encoder.hpp>
+#include <proton/Decoder.hpp>
+
+/**@file
+ * Holder for a sequence of AMQP values.
+ * @ingroup cpp
+ */
+
+namespace proton {
+namespace reactor {
+
+/** Holds a sequence of AMQP values, allows inserting and extracting.
+ *
+ * After inserting values, call rewind() to extract them.
+ */
+PN_CPP_EXTERN class Values : public Encoder, public Decoder {
+  public:
+    Values();
+    Values(const Values&);
+    ~Values();
+
+    /** Copy data from another Values */
+    Values& operator=(const Values&);
+
+    PN_CPP_EXTERN Values& rewind();
+
+  private:
+  friend class Value;
+};
+
+PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&);
+
+}}
+
+#endif // VALUES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
new file mode 100644
index 0000000..a960c42
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
@@ -0,0 +1,45 @@
+#ifndef PROTON_CPP_WAITCONDITION_H
+#define PROTON_CPP_WAITCONDITION_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/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+// Interface class to indicates that an expected contion has been
+// achieved, i.e. for BlockingConnection.wait()
+
+class WaitCondition
+{
+  public:
+    PN_CPP_EXTERN virtual ~WaitCondition();
+
+    // Overide this member function to indicate whether an expected
+    // condition is achieved and requires no further waiting.
+    virtual bool achieved() = 0;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_WAITCONDITION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
deleted file mode 100644
index e4b690c..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_ACCEPTOR_H
-#define PROTON_CPP_ACCEPTOR_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/cpp/ImportExport.h"
-#include "proton/cpp/ProtonHandle.h"
-#include "proton/reactor.h"
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Acceptor : public ProtonHandle<pn_acceptor_t>
-{
-  public:
-    PN_CPP_EXTERN Acceptor();
-    PN_CPP_EXTERN Acceptor(pn_acceptor_t *);
-    PN_CPP_EXTERN Acceptor(const Acceptor&);
-    PN_CPP_EXTERN Acceptor& operator=(const Acceptor&);
-    PN_CPP_EXTERN ~Acceptor();
-
-    PN_CPP_EXTERN void close();
-  private:
-    friend class ProtonImplRef<Acceptor>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_ACCEPTOR_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Acking.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acking.h b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
deleted file mode 100644
index cfe168c..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Acking.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef PROTON_CPP_ACKING_H
-#define PROTON_CPP_ACKING_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/cpp/ImportExport.h"
-#include "proton/cpp/Delivery.h"
-
-namespace proton {
-namespace reactor {
-
-
-class Acking
-{
-  public:
-    PN_CPP_EXTERN virtual void accept(Delivery &d);
-    PN_CPP_EXTERN virtual void reject(Delivery &d);
-    PN_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
-    PN_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_ACKING_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
deleted file mode 100644
index 6b30a20..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef PROTON_CPP_BLOCKINGCONNECTION_H
-#define PROTON_CPP_BLOCKINGCONNECTION_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/cpp/ImportExport.h"
-#include "proton/cpp/Handle.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Duration.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Container;
-class BlockingConnectionImpl;
-class SslDomain;
-class BlockingSender;
-class WaitCondition;
-
-class BlockingConnection : public Handle<BlockingConnectionImpl>
-{
-  public:
-    PN_CPP_EXTERN BlockingConnection();
-    PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
-    PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
-    PN_CPP_EXTERN ~BlockingConnection();
-
-    PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
-                                         SslDomain *ssld=0, Container *c=0);
-    PN_CPP_EXTERN void close();
-
-    PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
-    PN_CPP_EXTERN void wait(WaitCondition &condition);
-    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
-    PN_CPP_EXTERN Duration getTimeout();
-  private:
-    friend class PrivateImplRef<BlockingConnection>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_BLOCKINGCONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
deleted file mode 100644
index f3c86e1..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef PROTON_CPP_BLOCKINGLINK_H
-#define PROTON_CPP_BLOCKINGLINK_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/cpp/ImportExport.h"
-#include "proton/cpp/Handle.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Duration.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/BlockingConnection.h"
-#include "proton/types.h"
-#include <string>
-
-namespace proton {
-namespace reactor {
-
-class BlockingConnection;
-
-class BlockingLink
-{
-  public:
-    PN_CPP_EXTERN void close();
-    ~BlockingLink();
-  protected:
-    PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
-    PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
-  private:
-    BlockingConnection connection;
-    Link link;
-    void checkClosed();
-    friend class BlockingConnection;
-    friend class BlockingSender;
-    friend class BlockingReceiver;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_BLOCKINGLINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
deleted file mode 100644
index a72dbb8..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef PROTON_CPP_BLOCKINGSENDER_H
-#define PROTON_CPP_BLOCKINGSENDER_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/cpp/ImportExport.h"
-#include "proton/cpp/Handle.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Duration.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/BlockingLink.h"
-#include "proton/types.h"
-#include "proton/delivery.h"
-#include <string>
-
-namespace proton {
-namespace reactor {
-
-class BlockingConnection;
-class BlockingLink;
-
-class BlockingSender : public BlockingLink
-{
-  public:
-    PN_CPP_EXTERN Delivery send(Message &msg);
-    PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
-  private:
-    PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
-    friend class BlockingConnection;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_BLOCKINGSENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
deleted file mode 100644
index 5deea9b..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef PROTON_CPP_CONNECTION_H
-#define PROTON_CPP_CONNECTION_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/cpp/ImportExport.h"
-#include "proton/cpp/Handle.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Transport;
-class Container;
-class ConnectionImpl;
-
-class Connection : public Endpoint, public Handle<ConnectionImpl>
-{
-  public:
-    PN_CPP_EXTERN Connection();
-    PN_CPP_EXTERN Connection(ConnectionImpl *);
-    PN_CPP_EXTERN Connection(const Connection& c);
-    PN_CPP_EXTERN Connection& operator=(const Connection& c);
-    PN_CPP_EXTERN ~Connection();
-
-    PN_CPP_EXTERN Connection(Container &c, Handler *h = 0);
-    PN_CPP_EXTERN Transport &getTransport();
-    PN_CPP_EXTERN Handler *getOverride();
-    PN_CPP_EXTERN void setOverride(Handler *h);
-    PN_CPP_EXTERN void open();
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN pn_connection_t *getPnConnection();
-    PN_CPP_EXTERN Container &getContainer();
-    PN_CPP_EXTERN std::string getHostname();
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
-  private:
-   friend class PrivateImplRef<Connection>;
-   friend class Connector;
-   friend class ConnectionImpl;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
deleted file mode 100644
index f6fdf68..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Container.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef PROTON_CPP_CONTAINER_H
-#define PROTON_CPP_CONTAINER_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/cpp/ImportExport.h"
-#include "proton/cpp/Handle.h"
-#include "proton/cpp/Acceptor.h"
-#include "proton/cpp/Duration.h"
-#include <proton/reactor.h>
-#include <string>
-
-namespace proton {
-namespace reactor {
-
-class DispatchHelper;
-class Connection;
-class Connector;
-class Acceptor;
-class ContainerImpl;
-class MessagingHandler;
-class Sender;
-class Receiver;
-class Link;
- class Handler;
-
-class Container : public Handle<ContainerImpl>
-{
-  public:
-    PN_CPP_EXTERN Container(ContainerImpl *);
-    PN_CPP_EXTERN Container(const Container& c);
-    PN_CPP_EXTERN Container& operator=(const Container& c);
-    PN_CPP_EXTERN ~Container();
-
-    PN_CPP_EXTERN Container();
-    PN_CPP_EXTERN Container(MessagingHandler &mhandler);
-    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
-    PN_CPP_EXTERN void run();
-    PN_CPP_EXTERN void start();
-    PN_CPP_EXTERN bool process();
-    PN_CPP_EXTERN void stop();
-    PN_CPP_EXTERN void wakeup();
-    PN_CPP_EXTERN bool isQuiesced();
-    PN_CPP_EXTERN pn_reactor_t *getReactor();
-    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
-    PN_CPP_EXTERN Sender createSender(std::string &url);
-    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
-    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
-    PN_CPP_EXTERN Acceptor listen(const std::string &url);
-    PN_CPP_EXTERN std::string getContainerId();
-    PN_CPP_EXTERN Duration getTimeout();
-    PN_CPP_EXTERN void setTimeout(Duration timeout);
-  private:
-   friend class PrivateImplRef<Container>;
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONTAINER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Data.h b/proton-c/bindings/cpp/include/proton/cpp/Data.h
deleted file mode 100644
index ef78a13..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Data.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef DATA_H
-#define DATA_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/cpp/ImportExport.h"
-#include <iosfwd>
-
-/**@file
- * Base for classes that hold AMQP data.
- * @internal
- */
-struct pn_data_t;
-
-namespace proton {
-namespace reactor {
-
-/** Base for classes that hold AMQP data. */
-class Data {
-  public:
-    virtual ~Data();
-
-    /** Copies the data */
-    Data& operator=(const Data&);
-
-    /** Clear the data. */
-    PN_CPP_EXTERN void clear();
-
-    /** True if there are no values. */
-    PN_CPP_EXTERN bool empty() const;
-
-    /** Human readable representation of data. */
-    friend std::ostream& operator<<(std::ostream&, const Data&);
-
-  protected:
-    /** Takes ownership of pd */
-    explicit Data(pn_data_t* pd=0);
-    mutable pn_data_t* data;
-};
-
-
-}}
-#endif // DATA_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
deleted file mode 100644
index 9b6df6e..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
+++ /dev/null
@@ -1,219 +0,0 @@
-#ifndef DECODER_H
-#define DECODER_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/cpp/Data.h"
-#include "proton/cpp/types.h"
-#include "proton/cpp/exceptions.h"
-#include <iosfwd>
-
-namespace proton {
-namespace reactor {
-
-class Value;
-
-/**@file
- * Stream-like decoder from AMQP bytes to C++ values.
- * @ingroup cpp
- */
-
-/**
-@ingroup cpp
-
-Stream-like decoder from AMQP bytes to a stream of C++ values.
-
-types.h defines C++ types corresponding to AMQP types.
-
-Decoder operator>> will extract AMQP types into corresponding C++ types, and do
-simple conversions, e.g. from AMQP integer types to corresponding or larger C++
-integer types.
-
-You can require an exact AMQP type using the `as<type>(value)` helper. E.g.
-
-    Int i;
-    decoder >> as<INT>(i):       // Will throw if decoder does not contain an INT
-
-You can also use the `as` helper to extract an AMQP list, array or map into C++ containers.
-
-    std::vector<Int> v;
-    decoder >> as<LIST>(v);     // Extract a list of INT.
-
-AMQP maps can be inserted/extracted to any container with pair<X,Y> as
-value_type, which includes std::map and std::unordered_map but also for
-example std::vector<std::pair<X,Y> >. This allows you to perserve order when
-extracting AMQP maps.
-
-You can also extract container values element-by-element, see the Start class.
-*/
-PN_CPP_EXTERN class Decoder : public virtual Data {
-  public:
-    /** Raised if a Decoder operation fails  */
-    struct Error : public ProtonException {
-        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
-    };
-
-    PN_CPP_EXTERN Decoder();
-    PN_CPP_EXTERN ~Decoder();
-
-    /** Copy AMQP data from a byte buffer into the Decoder. */
-    PN_CPP_EXTERN Decoder(const char* buffer, size_t size);
-
-    /** Copy AMQP data from a std::string into the Decoder. */
-    PN_CPP_EXTERN Decoder(const std::string&);
-
-    /** Decode AMQP data from a byte buffer onto the end of the value stream. */
-    PN_CPP_EXTERN void decode(const char* buffer, size_t size);
-
-    /** Decode AMQP data from bytes in std::string onto the end of the value stream. */
-    PN_CPP_EXTERN void decode(const std::string&);
-
-    /** Return true if there are more values to read at the current level. */
-    PN_CPP_EXTERN bool more() const;
-
-    /** Type of the next value that will be read by operator>>
-     *@throw Error if empty().
-     */
-    PN_CPP_EXTERN TypeId type() const;
-
-    /** @name Extract simple types
-     * Overloads to extract simple types.
-     * @throw Error if the Decoder is empty or the current value has an incompatible type.
-     * @{
-     */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Null);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&);
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
-    ///@}
-
-    /** Extract and return a value of type T. */
-    template <class T> T get() { T value; *this >> value; return value; }
-
-    /** Extract and return a value of type T, as AMQP type. */
-    template <class T, TypeId A> T getAs() { T value; *this >> as<A>(value); return value; }
-
-    /** Call Decoder::start() in constructor, Decoder::finish in destructor() */
-    struct Scope : public Start {
-        Decoder& decoder;
-        Scope(Decoder& d) : decoder(d) { d >> *this; }
-        ~Scope() { decoder >> finish(); }
-    };
-
-    template <TypeId A, class T> friend Decoder& operator>>(Decoder& d, Ref<T, A> ref) {
-        d.checkType(A);
-        d >> ref.value;
-        return d;
-    }
-
-    /** start extracting a container value, one of array, list, map, described.
-     * The basic pattern is:
-     *
-     *     Start s;
-     *     decoder >> s;
-     *     // check s.type() to see if this is an ARRAY, LIST, MAP or DESCRIBED type.
-     *     if (s.described) extract the descriptor...
-     *     for (size_t i = 0; i < s.size(); ++i) Extract each element...
-     *     decoder >> finish();
-     *
-     * The first value of an ARRAY is a descriptor if Start::descriptor is true,
-     * followed by Start::size elemets of type Start::element.
-     *
-     * A LIST has Start::size elements which may be of mixed type.
-     *
-     * A MAP has Start::size elements which alternate key, value, key, value...
-     * and may be of mixed type.
-     *
-     * A DESCRIBED contains a descriptor and a single element, so it always has
-     * Start::described=true and Start::size=1.
-     *
-     * Note Scope automatically calls finish() in its destructor.
-     *
-     *@throw decoder::error if the curent value is not a container type.
-     */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Start&);
-
-    /** Finish extracting a container value. */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Finish);
-
-    /** Skip a value */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Skip);
-
-  private:
-    template <class T> Decoder& extract(T& value);
-    void checkType(TypeId);
-
-    // Not implemented
-    Decoder(const Decoder&);
-    Decoder& operator=(const Decoder&);
-
-  friend class Value;
-  friend class Encoder;
-};
-
-template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref)  {
-    Decoder::Scope s(d);
-    if (s.isDescribed) d >> skip();
-    ref.value.clear();
-    ref.value.resize(s.size);
-    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) {
-        d >> *i;
-    }
-    return d;
-}
-
-template <class T> Decoder& operator>>(Decoder& d, Ref<T, LIST> ref)  {
-    Decoder::Scope s(d);
-    ref.value.clear();
-    ref.value.resize(s.size);
-    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i)
-        d >> *i;
-    return d;
-}
-
-template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref)  {
-    Decoder::Scope m(d);
-    ref.value.clear();
-    for (size_t i = 0; i < m.size/2; ++i) {
-        typename T::key_type k;
-        typename T::mapped_type v;
-        d >> k >> v;
-        ref.value[k] = v;
-    }
-    return d;
-}
-
-}} // namespace proton::reactor
-#endif // DECODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
deleted file mode 100644
index 6df658f..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef PROTON_CPP_DELIVERY_H
-#define PROTON_CPP_DELIVERY_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/cpp/ImportExport.h"
-#include "proton/cpp/ProtonHandle.h"
-
-#include "proton/delivery.h"
-#include "proton/disposition.h"
-
-namespace proton {
-namespace reactor {
-
-class Delivery : public ProtonHandle<pn_delivery_t>
-{
-  public:
-
-    enum state {
-        NONE = 0,
-        RECEIVED = PN_RECEIVED,
-        ACCEPTED = PN_ACCEPTED,
-        REJECTED = PN_REJECTED,
-        RELEASED = PN_RELEASED,
-        MODIFIED = PN_MODIFIED
-    };  // AMQP spec 3.4 Delivery State
-
-    PN_CPP_EXTERN Delivery(pn_delivery_t *d);
-    PN_CPP_EXTERN Delivery();
-    PN_CPP_EXTERN ~Delivery();
-    PN_CPP_EXTERN Delivery(const Delivery&);
-    PN_CPP_EXTERN Delivery& operator=(const Delivery&);
-    PN_CPP_EXTERN bool settled();
-    PN_CPP_EXTERN void settle();
-    PN_CPP_EXTERN pn_delivery_t *getPnDelivery();
-  private:
-    friend class ProtonImplRef<Delivery>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_DELIVERY_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Duration.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
deleted file mode 100644
index bb2a063..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Duration.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef PROTON_CPP_DURATION_H
-#define PROTON_CPP_DURATION_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/cpp/ImportExport.h"
-#include "proton/types.h"
-
-namespace proton {
-namespace reactor {
-
-/** @ingroup cpp
- * A duration is a time in milliseconds.
- */
-class Duration
-{
-  public:
-    PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
-    PN_CPP_EXTERN uint64_t getMilliseconds() const;
-    PN_CPP_EXTERN static const Duration FOREVER;
-    PN_CPP_EXTERN static const Duration IMMEDIATE;
-    PN_CPP_EXTERN static const Duration SECOND;
-    PN_CPP_EXTERN static const Duration MINUTE;
-  private:
-    uint64_t milliseconds;
-};
-
-PN_CPP_EXTERN Duration operator*(const Duration& duration,
-                                         uint64_t multiplier);
-PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
-                                         const Duration& duration);
-PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
-PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_DURATION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
deleted file mode 100644
index 8e92881..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
+++ /dev/null
@@ -1,184 +0,0 @@
-#ifndef ENCODER_H
-#define ENCODER_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/cpp/Data.h"
-#include "proton/cpp/types.h"
-#include "proton/cpp/exceptions.h"
-#include <iosfwd>
-
-struct pn_data_t;
-
-namespace proton {
-namespace reactor {
-
-class Value;
-
-/**@file
- * Stream-like encoder from C++ values to AMQP bytes.
- * @ingroup cpp
-*/
-
-/**
-@ingroup cpp
-
-types.h defines C++ typedefs and types for AMQP each type. These types
-insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
-insert any other type.
-
-C++ containers can be inserted as AMQP containers with the as() helper functions. E.g.
-
-   std::vector<Symbol> v; encoder << as<List>(v);
-
-AMQP maps can be inserted/extracted to any container with pair<X,Y> as
-value_type, which includes std::map and std::unordered_map but also for
-example std::vector<std::pair<X,Y> >. This allows you to perserve order when
-extracting AMQP maps.
-
-You can also insert containers element-by-element, see the Start class.
-*/
-class Encoder : public virtual Data {
-  public:
-    /** Raised if a Encoder operation fails  */
-    struct Error : public ProtonException {
-        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
-    };
-
-    PN_CPP_EXTERN Encoder();
-    PN_CPP_EXTERN ~Encoder();
-
-    /**
-     * Encode the current values into buffer and update size to reflect the number of bytes encoded.
-     *
-     * Clears the encoder.
-     *
-     *@return if buffer==0 or size is too small then return false and  size to the required size.
-     *Otherwise return true and set size to the number of bytes encoded.
-     */
-    PN_CPP_EXTERN bool encode(char* buffer, size_t& size);
-
-    /** Encode the current values into a std::string, resize the string if necessary.
-     *
-     * Clears the encoder.
-     */
-    PN_CPP_EXTERN void encode(std::string&);
-
-    /** Encode the current values into a std::string. Clears the encoder. */
-    PN_CPP_EXTERN std::string encode();
-
-    /** @name Insert simple types.
-     *@{
-     */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
-    ///@}
-
-    /** Start a container type. See the Start class. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&);
-
-    /** Finish a container type. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish);
-
-
-    /**@name Insert values returned by the as<TypeId> helper.
-     *@{
-     */
-  template <class T, TypeId A> friend Encoder& operator<<(Encoder&, CRef<T, A>);
-  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>);
-  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>);
-  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>);
-    // TODO aconway 2015-06-16: DESCRIBED.
-    ///@}
-
-  private:
-    PN_CPP_EXTERN Encoder(pn_data_t* pd);
-
-    // Not implemented
-    Encoder(const Encoder&);
-    Encoder& operator=(const Encoder&);
-
-  friend class Value;
-};
-
-/** Encode const char* as string */
-inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
-
-/** Encode char* as string */
-inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); }
-
-/** Encode std::string as string */
-inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); }
-
-//@internal Convert a Ref to a CRef.
-template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
-    return e << CRef<T,A>(ref);
-}
-
-// TODO aconway 2015-06-16: described array insertion.
-
-template <class T> Encoder& operator<<(Encoder& e, CRef<T, ARRAY> a) {
-    e << Start::array(TypeIdOf<typename T::value_type>::value);
-    for (typename T::const_iterator i = a.value.begin(); i != a.value.end(); ++i)
-        e << *i;
-    e << finish();
-    return e;
-}
-
-template <class T> Encoder& operator<<(Encoder& e, CRef<T, LIST> l) {
-    e << Start::list();
-    for (typename T::const_iterator i = l.value.begin(); i != l.value.end(); ++i)
-        e << *i;
-    e << finish();
-    return e;
-}
-
-template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
-    e << Start::map();
-    for (typename T::const_iterator i = m.value.begin(); i != m.value.end(); ++i) {
-        e << i->first;
-        e << i->second;
-    }
-    e << finish();
-    return e;
-}
-
-
-}}
-#endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
deleted file mode 100644
index c3edb59..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef PROTON_CPP_ENDPOINT_H
-#define PROTON_CPP_ENDPOINT_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/cpp/ImportExport.h"
-#include "proton/connection.h"
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Connection;
-class Transport;
-
-class Endpoint
-{
-  public:
-    enum {
-        LOCAL_UNINIT = PN_LOCAL_UNINIT,
-        REMOTE_UNINIT = PN_REMOTE_UNINIT,
-        LOCAL_ACTIVE = PN_LOCAL_ACTIVE,
-        REMOTE_ACTIVE = PN_REMOTE_ACTIVE,
-        LOCAL_CLOSED = PN_LOCAL_CLOSED,
-        REMOTE_CLOSED  = PN_REMOTE_CLOSED
-    };
-    typedef int State;
-
-    // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
-    virtual PN_CPP_EXTERN Connection &getConnection() = 0;
-    Transport PN_CPP_EXTERN &getTransport();
-  protected:
-    Endpoint();
-    ~Endpoint();
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_ENDPOINT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Event.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Event.h b/proton-c/bindings/cpp/include/proton/cpp/Event.h
deleted file mode 100644
index c0a3388..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Event.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef PROTON_CPP_EVENT_H
-#define PROTON_CPP_EVENT_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/cpp/ImportExport.h"
-#include "proton/cpp/Link.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Message.h"
-#include <vector>
-
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Container;
-class Connection;
-
-class Event
-{
-  public:
-    virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0;
-    virtual PN_CPP_EXTERN Container &getContainer();
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    virtual PN_CPP_EXTERN Sender getSender();
-    virtual PN_CPP_EXTERN Receiver getReceiver();
-    virtual PN_CPP_EXTERN Link getLink();
-    virtual PN_CPP_EXTERN Message getMessage();
-    virtual PN_CPP_EXTERN void setMessage(Message &);
-    virtual PN_CPP_EXTERN ~Event();
-  protected:
-    PN_CPP_EXTERN PN_CPP_EXTERN Event();
-  private:
-    PN_CPP_EXTERN Event(const Event&);
-    PN_CPP_EXTERN Event& operator=(const Event&);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_EVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
deleted file mode 100644
index 48fe6b9..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef PROTON_CPP_HANDLE_H
-#define PROTON_CPP_HANDLE_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/cpp/ImportExport.h"
-
-namespace proton {
-namespace reactor {
-
-template <class> class PrivateImplRef;
-template <class> class ProtonImplRef;
-
-// FIXME aconway 2015-06-09: don't need handle, get rid of it.
-
-/**
- * A handle is like a pointer: refers to an underlying implementation object.
- * Copying the handle does not copy the object.
- *
- * Handles can be null,  like a 0 pointer. Use isValid(), isNull() or the
- * conversion to bool to test for a null handle.
- */
-template <class T> class Handle {
-  public:
-
-    /**@return true if handle is valid,  i.e. not null. */
-    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
-
-    /**@return true if handle is null. It is an error to call any function on a null handle. */
-    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
-
-    /** Conversion to bool supports idiom if (handle) { handle->... } */
-    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
-
-    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
-    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
-
-    /** Operator ==  equal if they point to same non-null object*/
-    PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
-    PROTON_CPP_INLINE_EXTERN bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
-
-    void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
-
-  private:
-    // Not implemented, subclasses must implement.
-    Handle(const Handle&);
-    Handle& operator=(const Handle&);
-
-  protected:
-    typedef T Impl;
-    PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
-
-    Impl* impl;
-
-  friend class PrivateImplRef<T>;
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_HANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Handler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handler.h b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
deleted file mode 100644
index 86b5bbf..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Handler.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_HANDLER_H
-#define PROTON_CPP_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/cpp/ImportExport.h"
-#include "proton/cpp/Event.h"
-#include "proton/event.h"
-#include <vector>
-
-namespace proton {
-namespace reactor {
-
-class PN_CPP_EXTERN Handler
-{
-  public:
-    PN_CPP_EXTERN Handler();
-    PN_CPP_EXTERN virtual ~Handler();
-
-    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
-
-    PN_CPP_EXTERN virtual void addChildHandler(Handler &e);
-    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
-    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
-  protected:
-    std::vector<Handler *>childHandlers;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
deleted file mode 100644
index cbc0626..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_IMPORTEXPORT_H
-#define PROTON_CPP_IMPORTEXPORT_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.
- *
- */
-#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC)
-  //
-  // Import and Export definitions for Windows:
-  //
-#  define PROTON_CPP_EXPORT __declspec(dllexport)
-#  define PROTON_CPP_IMPORT __declspec(dllimport)
-#else
-  //
-  // Non-Windows (Linux, etc.) definitions:
-  //
-#  define PROTON_CPP_EXPORT
-#  define PROTON_CPP_IMPORT
-#endif
-
-
-// For c++ library symbols
-
-#ifdef protoncpp_EXPORTS
-#  define PN_CPP_EXTERN PROTON_CPP_EXPORT
-#else
-#  define PN_CPP_EXTERN PROTON_CPP_IMPORT
-#endif
-
-// TODO:
-#define PROTON_CPP_INLINE_EXTERN
-
-#endif  /*!PROTON_CPP_IMPORTEXPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
deleted file mode 100644
index f4b9662..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Link.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef PROTON_CPP_LINK_H
-#define PROTON_CPP_LINK_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/cpp/ImportExport.h"
-#include "proton/cpp/ProtonHandle.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Terminus.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Link : public Endpoint, public ProtonHandle<pn_link_t>
-{
-  public:
-    PN_CPP_EXTERN Link(pn_link_t *);
-    PN_CPP_EXTERN Link();
-    PN_CPP_EXTERN ~Link();
-    PN_CPP_EXTERN Link(const Link&);
-    PN_CPP_EXTERN Link& operator=(const Link&);
-    PN_CPP_EXTERN void open();
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN bool isSender();
-    PN_CPP_EXTERN bool isReceiver();
-    PN_CPP_EXTERN int getCredit();
-    PN_CPP_EXTERN Terminus getSource();
-    PN_CPP_EXTERN Terminus getTarget();
-    PN_CPP_EXTERN Terminus getRemoteSource();
-    PN_CPP_EXTERN Terminus getRemoteTarget();
-    PN_CPP_EXTERN std::string getName();
-    PN_CPP_EXTERN pn_link_t *getPnLink() const;
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    PN_CPP_EXTERN Link getNext(Endpoint::State mask);
-  protected:
-    virtual void verifyType(pn_link_t *l);
-  private:
-    friend class ProtonImplRef<Link>;
-    bool senderLink;
-};
-
-
-}} // namespace proton::reactor
-
-#include "proton/cpp/Sender.h"
-#include "proton/cpp/Receiver.h"
-
-#endif  /*!PROTON_CPP_LINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
deleted file mode 100644
index d24cc1b..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Message.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef PROTON_CPP_MESSAGE_H
-#define PROTON_CPP_MESSAGE_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/cpp/ImportExport.h"
-#include "proton/cpp/ProtonHandle.h"
-#include "proton/message.h"
-#include <string>
-
-
-namespace proton {
-namespace reactor {
-
-class Message : public ProtonHandle<pn_message_t>
-{
-  public:
-    PN_CPP_EXTERN Message();
-    PN_CPP_EXTERN Message(pn_message_t *);
-    PN_CPP_EXTERN Message(const Message&);
-    PN_CPP_EXTERN Message& operator=(const Message&);
-    PN_CPP_EXTERN ~Message();
-
-    PN_CPP_EXTERN pn_message_t *getPnMessage() const;
-
-    // FIXME aconway 2015-06-11: get rid of get/set prefixes
-
-    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
-    PN_CPP_EXTERN void setId(uint64_t id);
-    PN_CPP_EXTERN uint64_t getId();
-    PN_CPP_EXTERN void setId(const std::string &id);
-    PN_CPP_EXTERN std::string getStringId();
-    PN_CPP_EXTERN void setId(const char *p, size_t len);
-    PN_CPP_EXTERN size_t getId(const char **p);
-    PN_CPP_EXTERN pn_type_t getIdType();
-
-    PN_CPP_EXTERN void setUserId(const std::string &id);
-    PN_CPP_EXTERN std::string getUserId();
-
-    PN_CPP_EXTERN void setAddress(const std::string &addr);
-    PN_CPP_EXTERN std::string getAddress();
-
-    PN_CPP_EXTERN void setSubject(const std::string &s);
-    PN_CPP_EXTERN std::string getSubject();
-
-    PN_CPP_EXTERN void setReplyTo(const std::string &s);
-    PN_CPP_EXTERN std::string getReplyTo();
-
-    PN_CPP_EXTERN void setCorrelationId(uint64_t id);
-    PN_CPP_EXTERN uint64_t getCorrelationId();
-    PN_CPP_EXTERN void setCorrelationId(const std::string &id);
-    PN_CPP_EXTERN std::string getStringCorrelationId();
-    PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
-    PN_CPP_EXTERN size_t getCorrelationId(const char **p);
-
-    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
-    PN_CPP_EXTERN pn_type_t getCorrelationIdType();
-
-    PN_CPP_EXTERN void setContentType(const std::string &s);
-    PN_CPP_EXTERN std::string getContentType();
-
-    PN_CPP_EXTERN void setContentEncoding(const std::string &s);
-    PN_CPP_EXTERN std::string getContentEncoding();
-
-    PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
-    PN_CPP_EXTERN pn_timestamp_t getExpiry();
-
-    PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
-    PN_CPP_EXTERN pn_timestamp_t getCreationTime();
-
-    PN_CPP_EXTERN void setGroupId(const std::string &s);
-    PN_CPP_EXTERN std::string getGroupId();
-
-    PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
-    PN_CPP_EXTERN std::string getReplyToGroupId();
-
-    // FIXME aconway 2015-06-11: use Values for body.
-    PN_CPP_EXTERN void setBody(const std::string &data);
-    PN_CPP_EXTERN std::string getBody();
-
-    PN_CPP_EXTERN void getBody(std::string &str);
-
-    PN_CPP_EXTERN void setBody(const char *, size_t len);
-    PN_CPP_EXTERN size_t getBody(char *, size_t len);
-    PN_CPP_EXTERN size_t getBinaryBodySize();
-
-
-    PN_CPP_EXTERN void encode(std::string &data);
-    PN_CPP_EXTERN void decode(const std::string &data);
-
-  private:
-    friend class ProtonImplRef<Message>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_MESSAGE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
deleted file mode 100644
index 9cf4347..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ /dev/null
@@ -1,79 +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/cpp/ProtonHandler.h"
-#include "proton/cpp/MessagingHandler.h"
-
-#include "proton/cpp/MessagingEvent.h"
-#include "proton/event.h"
-#include "proton/reactor.h"
-
-namespace proton {
-namespace reactor {
-
-// Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
-
-
-class MessagingAdapter : public MessagingHandler
-{
-  public:
-    PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
-    PN_CPP_EXTERN virtual ~MessagingAdapter();
-    PN_CPP_EXTERN virtual void onReactorInit(Event &e);
-    PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
-    PN_CPP_EXTERN virtual void onDelivery(Event &e);
-    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionError(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
-    PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
-    PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
-    PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
-    PN_CPP_EXTERN virtual void onSessionError(Event &e);
-    PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
-    PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
-    PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
-    PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
-    PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
-    PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
-    PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
-    PN_CPP_EXTERN virtual void onLinkError(Event &e);
-    PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
-    PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
-    PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
-    PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
-    PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
-    PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
-  private:
-    MessagingHandler &delegate;  // The handler for generated MessagingEvent's
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
deleted file mode 100644
index f71cace..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef PROTON_CPP_MESSAGINGEVENT_H
-#define PROTON_CPP_MESSAGINGEVENT_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/cpp/ProtonEvent.h"
-#include "proton/cpp/Link.h"
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Container;
-class Connection;
-
-typedef enum {
-    PN_MESSAGING_PROTON = 0,  // Wrapped pn_event_t
-    // Covenience events for C++ MessagingHandlers
-    PN_MESSAGING_ABORT,
-    PN_MESSAGING_ACCEPTED,
-    PN_MESSAGING_COMMIT,
-    PN_MESSAGING_CONNECTION_CLOSED,
-    PN_MESSAGING_CONNECTION_CLOSING,
-    PN_MESSAGING_CONNECTION_ERROR,
-    PN_MESSAGING_CONNECTION_OPENED,
-    PN_MESSAGING_CONNECTION_OPENING,
-    PN_MESSAGING_DISCONNECTED,
-    PN_MESSAGING_FETCH,
-    PN_MESSAGING_ID_LOADED,
-    PN_MESSAGING_LINK_CLOSED,
-    PN_MESSAGING_LINK_CLOSING,
-    PN_MESSAGING_LINK_OPENED,
-    PN_MESSAGING_LINK_OPENING,
-    PN_MESSAGING_LINK_ERROR,
-    PN_MESSAGING_MESSAGE,
-    PN_MESSAGING_QUIT,
-    PN_MESSAGING_RECORD_INSERTED,
-    PN_MESSAGING_RECORDS_LOADED,
-    PN_MESSAGING_REJECTED,
-    PN_MESSAGING_RELEASED,
-    PN_MESSAGING_REQUEST,
-    PN_MESSAGING_RESPONSE,
-    PN_MESSAGING_SENDABLE,
-    PN_MESSAGING_SESSION_CLOSED,
-    PN_MESSAGING_SESSION_CLOSING,
-    PN_MESSAGING_SESSION_OPENED,
-    PN_MESSAGING_SESSION_OPENING,
-    PN_MESSAGING_SESSION_ERROR,
-    PN_MESSAGING_SETTLED,
-    PN_MESSAGING_START,
-    PN_MESSAGING_TIMER,
-    PN_MESSAGING_TRANSACTION_ABORTED,
-    PN_MESSAGING_TRANSACTION_COMMITTED,
-    PN_MESSAGING_TRANSACTION_DECLARED,
-    PN_MESSAGING_TRANSPORT_CLOSED
-} MessagingEventType_t;
-
-class MessagingEvent : public ProtonEvent
-{
-  public:
-    MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
-    MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
-    ~MessagingEvent();
-    virtual PN_CPP_EXTERN void dispatch(Handler &h);
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    virtual PN_CPP_EXTERN Sender getSender();
-    virtual PN_CPP_EXTERN Receiver getReceiver();
-    virtual PN_CPP_EXTERN Link getLink();
-    virtual PN_CPP_EXTERN Message getMessage();
-    virtual PN_CPP_EXTERN void setMessage(Message &);
-  private:
-    MessagingEventType_t messagingType;
-    ProtonEvent *parentEvent;
-    Message *message;
-    MessagingEvent operator=(const MessagingEvent&);
-    MessagingEvent(const MessagingEvent&);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_MESSAGINGEVENT_H*/


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


[32/50] [abbrv] qpid-proton git commit: PROTON-865: Use .hpp extension for C++ headers.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
deleted file mode 100644
index 07b0dde..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef PROTON_CPP_MESSAGING_HANDLER_H
-#define PROTON_CPP_MESSAGING_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/cpp/ProtonHandler.h"
-#include "proton/cpp/Acking.h"
-#include "proton/event.h"
-
-namespace proton {
-namespace reactor {
-
-class Event;
-class MessagingAdapter;
-
-class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
-{
-  public:
-    PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
-                                       bool peerCloseIsError=false);
-    virtual ~MessagingHandler();
-
-    virtual void onAbort(Event &e);
-    virtual void onAccepted(Event &e);
-    virtual void onCommit(Event &e);
-    virtual void onConnectionClosed(Event &e);
-    virtual void onConnectionClosing(Event &e);
-    virtual void onConnectionError(Event &e);
-    virtual void onConnectionOpening(Event &e);
-    virtual void onConnectionOpened(Event &e);
-    virtual void onDisconnected(Event &e);
-    virtual void onFetch(Event &e);
-    virtual void onIdLoaded(Event &e);
-    virtual void onLinkClosed(Event &e);
-    virtual void onLinkClosing(Event &e);
-    virtual void onLinkError(Event &e);
-    virtual void onLinkOpened(Event &e);
-    virtual void onLinkOpening(Event &e);
-    virtual void onMessage(Event &e);
-    virtual void onQuit(Event &e);
-    virtual void onRecordInserted(Event &e);
-    virtual void onRecordsLoaded(Event &e);
-    virtual void onRejected(Event &e);
-    virtual void onReleased(Event &e);
-    virtual void onRequest(Event &e);
-    virtual void onResponse(Event &e);
-    virtual void onSendable(Event &e);
-    virtual void onSessionClosed(Event &e);
-    virtual void onSessionClosing(Event &e);
-    virtual void onSessionError(Event &e);
-    virtual void onSessionOpened(Event &e);
-    virtual void onSessionOpening(Event &e);
-    virtual void onSettled(Event &e);
-    virtual void onStart(Event &e);
-    virtual void onTimer(Event &e);
-    virtual void onTransactionAborted(Event &e);
-    virtual void onTransactionCommitted(Event &e);
-    virtual void onTransactionDeclared(Event &e);
-    virtual void onTransportClosed(Event &e);
-  protected:
-    int prefetch;
-    bool autoAccept;
-    bool autoSettle;
-    bool peerCloseIsError;
-    MessagingAdapter *messagingAdapter;
-    Handler *flowController;
-    PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
-                                       bool peerCloseIsError=false);
-  private:
-    friend class ContainerImpl;
-    friend class MessagingAdapter;
-    void createHelpers();
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_MESSAGING_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
deleted file mode 100644
index be26d83..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
+++ /dev/null
@@ -1,57 +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/cpp/Event.h"
-#include "proton/cpp/Link.h"
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Container;
-class Connection;
-class Container;
-
-class ProtonEvent : public Event
-{
-  public:
-    virtual PN_CPP_EXTERN void dispatch(Handler &h);
-    virtual PN_CPP_EXTERN Container &getContainer();
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    virtual PN_CPP_EXTERN Sender getSender();
-    virtual PN_CPP_EXTERN Receiver getReceiver();
-    virtual PN_CPP_EXTERN Link getLink();
-    PN_CPP_EXTERN int getType();
-    PN_CPP_EXTERN pn_event_t* getPnEvent();
-  protected:
-    PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
-  private:
-    pn_event_t *pnEvent;
-    int type;
-    Container &container;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
deleted file mode 100644
index 8fe6f4c..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandle.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef PROTON_CPP_PROTONHANDLE_H
-#define PROTON_CPP_PROTONHANDLE_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/cpp/ImportExport.h"
-
-namespace proton {
-namespace reactor {
-
-template <class> class ProtonImplRef;
-
-/**
- * See Handle.h.  Similar but for lightly wrapped Proton pn_object_t targets.
- */
-template <class T> class ProtonHandle {
-  public:
-
-    /**@return true if handle is valid,  i.e. not null. */
-    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
-
-    /**@return true if handle is null. It is an error to call any function on a null handle. */
-    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
-
-    /** Conversion to bool supports idiom if (handle) { handle->... } */
-    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
-
-    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
-    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
-
-    void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
-
-  private:
-    // Not implemented, subclasses must implement.
-    ProtonHandle(const ProtonHandle&);
-    ProtonHandle& operator=(const ProtonHandle&);
-
-  protected:
-    typedef T Impl;
-    PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
-
-    Impl* impl;
-
-  friend class ProtonImplRef<T>;
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PROTONHANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
deleted file mode 100644
index 4142a2d..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
+++ /dev/null
@@ -1,83 +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/cpp/Handler.h"
-
-namespace proton {
-namespace reactor {
-
-class Event;
-class ProtonEvent;
-
-class ProtonHandler : public Handler
-{
-  public:
-    PN_CPP_EXTERN ProtonHandler();
-    virtual void onReactorInit(Event &e);
-    virtual void onReactorQuiesced(Event &e);
-    virtual void onReactorFinal(Event &e);
-    virtual void onTimerTask(Event &e);
-    virtual void onConnectionInit(Event &e);
-    virtual void onConnectionBound(Event &e);
-    virtual void onConnectionUnbound(Event &e);
-    virtual void onConnectionLocalOpen(Event &e);
-    virtual void onConnectionLocalClose(Event &e);
-    virtual void onConnectionRemoteOpen(Event &e);
-    virtual void onConnectionRemoteClose(Event &e);
-    virtual void onConnectionFinal(Event &e);
-    virtual void onSessionInit(Event &e);
-    virtual void onSessionLocalOpen(Event &e);
-    virtual void onSessionLocalClose(Event &e);
-    virtual void onSessionRemoteOpen(Event &e);
-    virtual void onSessionRemoteClose(Event &e);
-    virtual void onSessionFinal(Event &e);
-    virtual void onLinkInit(Event &e);
-    virtual void onLinkLocalOpen(Event &e);
-    virtual void onLinkLocalClose(Event &e);
-    virtual void onLinkLocalDetach(Event &e);
-    virtual void onLinkRemoteOpen(Event &e);
-    virtual void onLinkRemoteClose(Event &e);
-    virtual void onLinkRemoteDetach(Event &e);
-    virtual void onLinkFlow(Event &e);
-    virtual void onLinkFinal(Event &e);
-    virtual void onDelivery(Event &e);
-    virtual void onTransport(Event &e);
-    virtual void onTransportError(Event &e);
-    virtual void onTransportHeadClosed(Event &e);
-    virtual void onTransportTailClosed(Event &e);
-    virtual void onTransportClosed(Event &e);
-    virtual void onSelectableInit(Event &e);
-    virtual void onSelectableUpdated(Event &e);
-    virtual void onSelectableReadable(Event &e);
-    virtual void onSelectableWritable(Event &e);
-    virtual void onSelectableExpired(Event &e);
-    virtual void onSelectableError(Event &e);
-    virtual void onSelectableFinal(Event &e);
-
-    virtual void onUnhandled(Event &e);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
deleted file mode 100644
index a0f45e7..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef PROTON_CPP_RECEIVER_H
-#define PROTON_CPP_RECEIVER_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/cpp/ImportExport.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Link.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Receiver : public Link
-{
-  public:
-    PN_CPP_EXTERN Receiver(pn_link_t *lnk);
-    PN_CPP_EXTERN Receiver();
-    PN_CPP_EXTERN Receiver(const Link& c);
-  protected:
-    virtual void verifyType(pn_link_t *l);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_RECEIVER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
deleted file mode 100644
index 1205f7f..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef PROTON_CPP_SENDER_H
-#define PROTON_CPP_SENDER_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/cpp/ImportExport.h"
-#include "proton/cpp/Delivery.h"
-#include "proton/cpp/Link.h"
-#include "proton/cpp/Message.h"
-
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-
-class Sender : public Link
-{
-  public:
-    PN_CPP_EXTERN Sender(pn_link_t *lnk);
-    PN_CPP_EXTERN Sender();
-    PN_CPP_EXTERN Sender(const Link& c);
-    PN_CPP_EXTERN Delivery send(Message &m);
-  protected:
-    virtual void verifyType(pn_link_t *l);
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_SENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Session.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h
deleted file mode 100644
index 8d2f02a..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Session.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef PROTON_CPP_SESSION_H
-#define PROTON_CPP_SESSION_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/cpp/ImportExport.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Link.h"
-
-#include "proton/types.h"
-#include "proton/link.h"
-#include "ProtonImplRef.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Container;
-class Handler;
-class Transport;
-
- class Session : public Endpoint, public ProtonHandle<pn_session_t>
-{
-  public:
-    PN_CPP_EXTERN Session(pn_session_t *s);
-    PN_CPP_EXTERN Session();
-    PN_CPP_EXTERN ~Session();
-    PN_CPP_EXTERN void open();
-    PN_CPP_EXTERN Session(const Session&);
-    PN_CPP_EXTERN Session& operator=(const Session&);
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN pn_session_t *getPnSession();
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    Receiver createReceiver(std::string name);
-    Sender createSender(std::string name);
-  private:
-    friend class ProtonImplRef<Session>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_SESSION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
deleted file mode 100644
index 6f93cf4..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef PROTON_CPP_TERMINUS_H
-#define PROTON_CPP_TERMINUS_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/cpp/ImportExport.h"
-#include "proton/cpp/Link.h"
-
-#include "proton/link.h"
-#include <string>
-
-namespace proton {
-namespace reactor {
-
-class Link;
-
-class Terminus : public ProtonHandle<pn_terminus_t>
-{
-    enum Type {
-        TYPE_UNSPECIFIED = PN_UNSPECIFIED,
-        SOURCE = PN_SOURCE,
-        TARGET = PN_TARGET,
-        COORDINATOR = PN_COORDINATOR
-    };
-    enum ExpiryPolicy {
-        NONDURABLE = PN_NONDURABLE,
-        CONFIGURATION = PN_CONFIGURATION,
-        DELIVERIES = PN_DELIVERIES
-    };
-    enum DistributionMode {
-        MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED,
-        COPY = PN_DIST_MODE_COPY,
-        MOVE = PN_DIST_MODE_MOVE
-    };
-
-  public:
-    PN_CPP_EXTERN Terminus();
-    PN_CPP_EXTERN ~Terminus();
-    PN_CPP_EXTERN Terminus(const Terminus&);
-    PN_CPP_EXTERN Terminus& operator=(const Terminus&);
-    PN_CPP_EXTERN pn_terminus_t *getPnTerminus();
-    PN_CPP_EXTERN Type getType();
-    PN_CPP_EXTERN void setType(Type);
-    PN_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
-    PN_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
-    PN_CPP_EXTERN DistributionMode getDistributionMode();
-    PN_CPP_EXTERN void setDistributionMode(DistributionMode);
-    PN_CPP_EXTERN std::string getAddress();
-    PN_CPP_EXTERN void setAddress(std::string &);
-    PN_CPP_EXTERN bool isDynamic();
-    PN_CPP_EXTERN void setDynamic(bool);
-
-  private:
-    Link *link;
-    PN_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
-    friend class Link;
-    friend class ProtonImplRef<Terminus>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_TERMINUS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Transport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Transport.h b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
deleted file mode 100644
index cd8bf91..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Transport.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef PROTON_CPP_TRANSPORT_H
-#define PROTON_CPP_TRANSPORT_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/cpp/ImportExport.h"
-#include "proton/transport.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Connection;
-
-class Transport
-{
-  public:
-    PN_CPP_EXTERN Transport();
-    PN_CPP_EXTERN ~Transport();
-    PN_CPP_EXTERN void bind(Connection &c);
-    Connection *connection;
-    pn_transport_t *pnTransport;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_TRANSPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Value.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Value.h b/proton-c/bindings/cpp/include/proton/cpp/Value.h
deleted file mode 100644
index 9555f29..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Value.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef VALUE_H
-#define VALUE_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/cpp/Values.h"
-
-/**@file
- * Holder for an AMQP value.
- * @ingroup cpp
- */
-namespace proton {
-namespace reactor {
-
-/** Holds a single AMQP value. */
-PN_CPP_EXTERN class Value {
-  public:
-    PN_CPP_EXTERN Value();
-    PN_CPP_EXTERN Value(const Value&);
-    /** Converting constructor from any settable value */
-    template <class T> explicit Value(const T& v);
-    PN_CPP_EXTERN ~Value();
-    PN_CPP_EXTERN Value& operator=(const Value&);
-
-
-    TypeId type() const;
-
-    /** Set the value. */
-    template<class T> void set(const T& value);
-    /** Get the value. */
-    template<class T> void get(T& value) const;
-    /** Get the value */
-    template<class T> T get() const;
-
-    /** Assignment sets the value */
-    template<class T> Value& operator=(const T& value);
-
-    /** Conversion operator gets  the value */
-    template<class T> operator T() const;
-
-    /** insert a value into an Encoder. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
-
-    /** Extract a value from a decoder. */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
-
-    /** Human readable format */
-    PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&);
-
-    bool operator==(const Value&) const;
-    bool operator !=(const Value& v) const{ return !(*this == v); }
-
-    /** operator < makes Value valid for use as a std::map key. */
-    bool operator<(const Value&) const;
-    bool operator>(const Value& v) const { return v < *this; }
-    bool operator<=(const Value& v) const { return !(*this > v); }
-    bool operator>=(const Value& v) const { return !(*this < v); }
-
-  private:
-    mutable Values values;
-};
-
-template<class T> void Value::set(const T& value) {
-    values.clear();
-    values << value;
-}
-
-template<class T> void Value::get(T& value) const {
-    Values& v = const_cast<Values&>(values);
-    v.rewind() >> value;
-}
-
-template<class T> T Value::get() const { T value; get(value); return value; }
-
-template<class T> Value& Value::operator=(const T& value) { set(value); return *this; }
-
-template<class T> Value::operator T() const { return get<T>(); }
-
-template<class T> Value::Value(const T& value) { set(value); }
-}}
-
-#endif // VALUE_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/Values.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Values.h b/proton-c/bindings/cpp/include/proton/cpp/Values.h
deleted file mode 100644
index 5f62dd9..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Values.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef VALUES_H
-#define VALUES_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/cpp/Encoder.h>
-#include <proton/cpp/Decoder.h>
-
-/**@file
- * Holder for a sequence of AMQP values.
- * @ingroup cpp
- */
-
-namespace proton {
-namespace reactor {
-
-/** Holds a sequence of AMQP values, allows inserting and extracting.
- *
- * After inserting values, call rewind() to extract them.
- */
-PN_CPP_EXTERN class Values : public Encoder, public Decoder {
-  public:
-    Values();
-    Values(const Values&);
-    ~Values();
-
-    /** Copy data from another Values */
-    Values& operator=(const Values&);
-
-    PN_CPP_EXTERN Values& rewind();
-
-  private:
-  friend class Value;
-};
-
-PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&);
-
-}}
-
-#endif // VALUES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
deleted file mode 100644
index f973fa7..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PROTON_CPP_WAITCONDITION_H
-#define PROTON_CPP_WAITCONDITION_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/cpp/ImportExport.h"
-
-namespace proton {
-namespace reactor {
-
-// Interface class to indicates that an expected contion has been
-// achieved, i.e. for BlockingConnection.wait()
-
-class WaitCondition
-{
-  public:
-    PN_CPP_EXTERN virtual ~WaitCondition();
-
-    // Overide this member function to indicate whether an expected
-    // condition is achieved and requires no further waiting.
-    virtual bool achieved() = 0;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_WAITCONDITION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
deleted file mode 100644
index 9fdef94..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef PROTON_CPP_EXCEPTIONS_H
-#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
-
-namespace proton {
-namespace reactor {
-
-class ProtonException : public std::runtime_error
-{
-  public:
-    explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {}
-};
-
-class MessageReject : public ProtonException
-{
-  public:
-    explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
-};
-
-class MessageRelease : public ProtonException
-{
-  public:
-    explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/cpp/types.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/types.h b/proton-c/bindings/cpp/include/proton/cpp/types.h
deleted file mode 100644
index edd95b9..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/types.h
+++ /dev/null
@@ -1,250 +0,0 @@
-#ifndef TYPES_H
-#define TYPES_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/codec.h>
-#include "proton/cpp/ImportExport.h"
-#include <algorithm>
-#include <bitset>
-#include <string>
-#include <stdint.h>
-#include <memory.h>
-
-/**@file
- * C++ types representing AMQP types.
- * @ingroup cpp
- */
-
-namespace proton {
-namespace reactor {
-
-/** TypeId identifies an AMQP type */
-enum TypeId {
-    NULL_=PN_NULL,              ///< The null type, contains no data.
-    BOOL=PN_BOOL,               ///< Boolean true or false.
-    UBYTE=PN_UBYTE,             ///< Unsigned 8 bit integer.
-    BYTE=PN_BYTE,               ///< Signed 8 bit integer.
-    USHORT=PN_USHORT,           ///< Unsigned 16 bit integer.
-    SHORT=PN_SHORT,             ///< Signed 16 bit integer.
-    UINT=PN_UINT,               ///< Unsigned 32 bit integer.
-    INT=PN_INT,                 ///< Signed 32 bit integer.
-    CHAR=PN_CHAR,               ///< 32 bit unicode character.
-    ULONG=PN_ULONG,             ///< Unsigned 64 bit integer.
-    LONG=PN_LONG,               ///< Signed 64 bit integer.
-    TIMESTAMP=PN_TIMESTAMP,     ///< Signed 64 bit milliseconds since the epoch.
-    FLOAT=PN_FLOAT,             ///< 32 bit binary floating point.
-    DOUBLE=PN_DOUBLE,           ///< 64 bit binary floating point.
-    DECIMAL32=PN_DECIMAL32,     ///< 32 bit decimal floating point.
-    DECIMAL64=PN_DECIMAL64,     ///< 64 bit decimal floating point.
-    DECIMAL128=PN_DECIMAL128,   ///< 128 bit decimal floating point.
-    UUID=PN_UUID,               ///< 16 byte UUID.
-    BINARY=PN_BINARY,           ///< Variable length sequence of bytes.
-    STRING=PN_STRING,           ///< Variable length utf8-encoded string.
-    SYMBOL=PN_SYMBOL,           ///< Variable length encoded string.
-    DESCRIBED=PN_DESCRIBED,     ///< A descriptor and a value.
-    ARRAY=PN_ARRAY,             ///< A sequence of values of the same type.
-    LIST=PN_LIST,               ///< A sequence of values, may be of mixed types.
-    MAP=PN_MAP                  ///< A sequence of key:value pairs, may be of mixed types.
-};
-
-///@internal
-template <class T> struct Comparable {};
-template<class T> bool operator<(const Comparable<T>& a, const Comparable<T>& b) {
-    return static_cast<const T&>(a) < static_cast<const T&>(b); // operator < provided by type T
-}
-template<class T> bool operator>(const Comparable<T>& a, const Comparable<T>& b) { return b < a; }
-template<class T> bool operator<=(const Comparable<T>& a, const Comparable<T>& b) { return !(a > b); }
-template<class T> bool operator>=(const Comparable<T>& a, const Comparable<T>& b) { return !(a < b); }
-template<class T> bool operator==(const Comparable<T>& a, const Comparable<T>& b) { return a <= b && b <= a; }
-template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b) { return !(a == b); }
-
-/**
- * @name C++ types representing AMQP types.
- * @{
- * @ingroup cpp
- * These types are all distinct for overloading purposes and will insert as the
- * corresponding AMQP type with Encoder operator<<.
- */
-struct Null {};
-typedef bool Bool;
-typedef uint8_t Ubyte;
-typedef int8_t Byte;
-typedef uint16_t Ushort;
-typedef int16_t Short;
-typedef uint32_t Uint;
-typedef int32_t Int;
-typedef wchar_t Char;
-typedef uint64_t Ulong;
-typedef int64_t Long;
-typedef float Float;
-typedef double Double;
-
-///@internal
-pn_bytes_t pn_bytes(const std::string&);
-
-///@internal
-#define STRING_LIKE(NAME)                                               \
-    PN_CPP_EXTERN struct NAME : public std::string{                     \
-        NAME(const std::string& s=std::string()) : std::string(s) {}    \
-        NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {}     \
-        operator pn_bytes_t() const { return pn_bytes(*this); }         \
-    }
-
-/** UTF-8 encoded string */
-STRING_LIKE(String);
-/** ASCII encoded symbolic name */
-STRING_LIKE(Symbol);
-/** Binary data */
-STRING_LIKE(Binary);
-
-///@internal
-pn_uuid_t pn_uuid(const std::string&);
-
-/** UUID is represented as a string but treated as if it always has 16 bytes. */
-PN_CPP_EXTERN struct Uuid : public std::string{
-    Uuid(const std::string& s=std::string()) : std::string(s) {}
-    Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {}
-    operator pn_uuid_t() const { return pn_uuid(*this); }
-};
-
-// TODO aconway 2015-06-11: alternative representation of variable-length data
-// as pointer to existing buffers.
-
-// TODO aconway 2015-06-16: usable representation of decimal types.
-template <class T> struct Decimal : public Comparable<Decimal<T> > {
-    char value[sizeof(T)];
-    Decimal() { ::memset(value, 0, sizeof(T)); }
-    Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); }
-    operator T() const { return *reinterpret_cast<const T*>(value); }
-    bool operator<(const Decimal<T>& x) {
-        return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T));
-    }
-};
-typedef Decimal<pn_decimal32_t> Decimal32;
-typedef Decimal<pn_decimal64_t> Decimal64;
-typedef Decimal<pn_decimal128_t> Decimal128;
-
-PN_CPP_EXTERN struct Timestamp {
-    pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
-    Timestamp(int64_t ms=0) : milliseconds(ms) {}
-    operator pn_timestamp_t() const { return milliseconds; }
-    bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; }
-};
-
-///@}
-
-template <class T> struct TypeIdOf {};
-template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; };
-template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; };
-template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; };
-template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; };
-template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; };
-template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; };
-template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; };
-template<> struct TypeIdOf<Int> { static const TypeId value=INT; };
-template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; };
-template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; };
-template<> struct TypeIdOf<Long> { static const TypeId value=LONG; };
-template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; };
-template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; };
-template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; };
-template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; };
-template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; };
-template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; };
-template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; };
-template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; };
-template<> struct TypeIdOf<String> { static const TypeId value=STRING; };
-template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; };
-
-template<class T, TypeId A> struct TypePair {
-    typedef T CppType;
-    TypeId type;
-};
-
-template<class T, TypeId A> struct Ref : public TypePair<T, A> {
-    Ref(T& v) : value(v) {}
-    T& value;
-};
-
-template<class T, TypeId A> struct CRef : public TypePair<T, A> {
-    CRef(const T& v) : value(v) {}
-    CRef(const Ref<T,A>& ref) : value(ref.value) {}
-    const T& value;
-};
-
-/** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int:
- *
- *     std::vector<Int> v;
- *     decoder >> as<ARRAY>(v);
- */
-template <TypeId A, class T> Ref<T, A> as(T& value) { return Ref<T, A>(value); }
-
-/** Create a const reference to value as AMQP type A for encoding. */
-template <TypeId A, class T> CRef<T, A> as(const T& value) { return CRef<T, A>(value); }
-
-///@}
-
-// TODO aconway 2015-06-16: described types.
-
-/** Return the name of a type. */
-PN_CPP_EXTERN std::string typeName(TypeId);
-
-/** Print the name of a type */
-PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId);
-
-/** Return the name of a type from a class. */
-PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
-
-/** Information needed to start extracting or inserting a container type.
- *
- * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s`
- * to get the Start for the current container.
- *
- * With an encoder use one of the member functions startArray, startList, startMap or startDescribed
- * to create an appropriate Start value, e.g. `encoder << startList() << ...`
- */
-PN_CPP_EXTERN struct Start {
-    Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0);
-    TypeId type;            ///< The container type: ARRAY, LIST, MAP or DESCRIBED.
-    TypeId element;         ///< the element type for array only.
-    bool isDescribed;       ///< true if first value is a descriptor.
-    size_t size;            ///< the element count excluding the descriptor (if any)
-
-    /** Return a Start for an array */
-    static Start array(TypeId element, bool described=false);
-    /** Return a Start for a list */
-    static Start list();
-    /** Return a Start for a map */
-    static Start map();
-    /** Return a Start for a described type */
-    static Start described();
-};
-
-/** Finish insterting or extracting a container value. */
-PN_CPP_EXTERN struct Finish {};
-inline Finish finish() { return Finish(); }
-
-/** Skip a value */
-PN_CPP_EXTERN struct Skip{};
-inline Skip skip() { return Skip(); }
-
-}}
-
-#endif // TYPES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/exceptions.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/exceptions.hpp b/proton-c/bindings/cpp/include/proton/exceptions.hpp
new file mode 100644
index 0000000..9fdef94
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/exceptions.hpp
@@ -0,0 +1,49 @@
+#ifndef PROTON_CPP_EXCEPTIONS_H
+#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
+
+namespace proton {
+namespace reactor {
+
+class ProtonException : public std::runtime_error
+{
+  public:
+    explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {}
+};
+
+class MessageReject : public ProtonException
+{
+  public:
+    explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
+};
+
+class MessageRelease : public ProtonException
+{
+  public:
+    explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/types.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp
new file mode 100644
index 0000000..819abb1
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/types.hpp
@@ -0,0 +1,250 @@
+#ifndef TYPES_H
+#define TYPES_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/codec.h>
+#include "proton/ImportExport.hpp"
+#include <algorithm>
+#include <bitset>
+#include <string>
+#include <stdint.h>
+#include <memory.h>
+
+/**@file
+ * C++ types representing AMQP types.
+ * @ingroup cpp
+ */
+
+namespace proton {
+namespace reactor {
+
+/** TypeId identifies an AMQP type */
+enum TypeId {
+    NULL_=PN_NULL,              ///< The null type, contains no data.
+    BOOL=PN_BOOL,               ///< Boolean true or false.
+    UBYTE=PN_UBYTE,             ///< Unsigned 8 bit integer.
+    BYTE=PN_BYTE,               ///< Signed 8 bit integer.
+    USHORT=PN_USHORT,           ///< Unsigned 16 bit integer.
+    SHORT=PN_SHORT,             ///< Signed 16 bit integer.
+    UINT=PN_UINT,               ///< Unsigned 32 bit integer.
+    INT=PN_INT,                 ///< Signed 32 bit integer.
+    CHAR=PN_CHAR,               ///< 32 bit unicode character.
+    ULONG=PN_ULONG,             ///< Unsigned 64 bit integer.
+    LONG=PN_LONG,               ///< Signed 64 bit integer.
+    TIMESTAMP=PN_TIMESTAMP,     ///< Signed 64 bit milliseconds since the epoch.
+    FLOAT=PN_FLOAT,             ///< 32 bit binary floating point.
+    DOUBLE=PN_DOUBLE,           ///< 64 bit binary floating point.
+    DECIMAL32=PN_DECIMAL32,     ///< 32 bit decimal floating point.
+    DECIMAL64=PN_DECIMAL64,     ///< 64 bit decimal floating point.
+    DECIMAL128=PN_DECIMAL128,   ///< 128 bit decimal floating point.
+    UUID=PN_UUID,               ///< 16 byte UUID.
+    BINARY=PN_BINARY,           ///< Variable length sequence of bytes.
+    STRING=PN_STRING,           ///< Variable length utf8-encoded string.
+    SYMBOL=PN_SYMBOL,           ///< Variable length encoded string.
+    DESCRIBED=PN_DESCRIBED,     ///< A descriptor and a value.
+    ARRAY=PN_ARRAY,             ///< A sequence of values of the same type.
+    LIST=PN_LIST,               ///< A sequence of values, may be of mixed types.
+    MAP=PN_MAP                  ///< A sequence of key:value pairs, may be of mixed types.
+};
+
+///@internal
+template <class T> struct Comparable {};
+template<class T> bool operator<(const Comparable<T>& a, const Comparable<T>& b) {
+    return static_cast<const T&>(a) < static_cast<const T&>(b); // operator < provided by type T
+}
+template<class T> bool operator>(const Comparable<T>& a, const Comparable<T>& b) { return b < a; }
+template<class T> bool operator<=(const Comparable<T>& a, const Comparable<T>& b) { return !(a > b); }
+template<class T> bool operator>=(const Comparable<T>& a, const Comparable<T>& b) { return !(a < b); }
+template<class T> bool operator==(const Comparable<T>& a, const Comparable<T>& b) { return a <= b && b <= a; }
+template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b) { return !(a == b); }
+
+/**
+ * @name C++ types representing AMQP types.
+ * @{
+ * @ingroup cpp
+ * These types are all distinct for overloading purposes and will insert as the
+ * corresponding AMQP type with Encoder operator<<.
+ */
+struct Null {};
+typedef bool Bool;
+typedef uint8_t Ubyte;
+typedef int8_t Byte;
+typedef uint16_t Ushort;
+typedef int16_t Short;
+typedef uint32_t Uint;
+typedef int32_t Int;
+typedef wchar_t Char;
+typedef uint64_t Ulong;
+typedef int64_t Long;
+typedef float Float;
+typedef double Double;
+
+///@internal
+pn_bytes_t pn_bytes(const std::string&);
+
+///@internal
+#define STRING_LIKE(NAME)                                               \
+    PN_CPP_EXTERN struct NAME : public std::string{                     \
+        NAME(const std::string& s=std::string()) : std::string(s) {}    \
+        NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {}     \
+        operator pn_bytes_t() const { return pn_bytes(*this); }         \
+    }
+
+/** UTF-8 encoded string */
+STRING_LIKE(String);
+/** ASCII encoded symbolic name */
+STRING_LIKE(Symbol);
+/** Binary data */
+STRING_LIKE(Binary);
+
+///@internal
+pn_uuid_t pn_uuid(const std::string&);
+
+/** UUID is represented as a string but treated as if it always has 16 bytes. */
+PN_CPP_EXTERN struct Uuid : public std::string{
+    Uuid(const std::string& s=std::string()) : std::string(s) {}
+    Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {}
+    operator pn_uuid_t() const { return pn_uuid(*this); }
+};
+
+// TODO aconway 2015-06-11: alternative representation of variable-length data
+// as pointer to existing buffers.
+
+// TODO aconway 2015-06-16: usable representation of decimal types.
+template <class T> struct Decimal : public Comparable<Decimal<T> > {
+    char value[sizeof(T)];
+    Decimal() { ::memset(value, 0, sizeof(T)); }
+    Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); }
+    operator T() const { return *reinterpret_cast<const T*>(value); }
+    bool operator<(const Decimal<T>& x) {
+        return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T));
+    }
+};
+typedef Decimal<pn_decimal32_t> Decimal32;
+typedef Decimal<pn_decimal64_t> Decimal64;
+typedef Decimal<pn_decimal128_t> Decimal128;
+
+PN_CPP_EXTERN struct Timestamp {
+    pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
+    Timestamp(int64_t ms=0) : milliseconds(ms) {}
+    operator pn_timestamp_t() const { return milliseconds; }
+    bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; }
+};
+
+///@}
+
+template <class T> struct TypeIdOf {};
+template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; };
+template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; };
+template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; };
+template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; };
+template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; };
+template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; };
+template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; };
+template<> struct TypeIdOf<Int> { static const TypeId value=INT; };
+template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; };
+template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; };
+template<> struct TypeIdOf<Long> { static const TypeId value=LONG; };
+template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; };
+template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; };
+template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; };
+template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; };
+template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; };
+template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; };
+template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; };
+template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; };
+template<> struct TypeIdOf<String> { static const TypeId value=STRING; };
+template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; };
+
+template<class T, TypeId A> struct TypePair {
+    typedef T CppType;
+    TypeId type;
+};
+
+template<class T, TypeId A> struct Ref : public TypePair<T, A> {
+    Ref(T& v) : value(v) {}
+    T& value;
+};
+
+template<class T, TypeId A> struct CRef : public TypePair<T, A> {
+    CRef(const T& v) : value(v) {}
+    CRef(const Ref<T,A>& ref) : value(ref.value) {}
+    const T& value;
+};
+
+/** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int:
+ *
+ *     std::vector<Int> v;
+ *     decoder >> as<ARRAY>(v);
+ */
+template <TypeId A, class T> Ref<T, A> as(T& value) { return Ref<T, A>(value); }
+
+/** Create a const reference to value as AMQP type A for encoding. */
+template <TypeId A, class T> CRef<T, A> as(const T& value) { return CRef<T, A>(value); }
+
+///@}
+
+// TODO aconway 2015-06-16: described types.
+
+/** Return the name of a type. */
+PN_CPP_EXTERN std::string typeName(TypeId);
+
+/** Print the name of a type */
+PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId);
+
+/** Return the name of a type from a class. */
+PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
+
+/** Information needed to start extracting or inserting a container type.
+ *
+ * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s`
+ * to get the Start for the current container.
+ *
+ * With an encoder use one of the member functions startArray, startList, startMap or startDescribed
+ * to create an appropriate Start value, e.g. `encoder << startList() << ...`
+ */
+PN_CPP_EXTERN struct Start {
+    Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0);
+    TypeId type;            ///< The container type: ARRAY, LIST, MAP or DESCRIBED.
+    TypeId element;         ///< the element type for array only.
+    bool isDescribed;       ///< true if first value is a descriptor.
+    size_t size;            ///< the element count excluding the descriptor (if any)
+
+    /** Return a Start for an array */
+    static Start array(TypeId element, bool described=false);
+    /** Return a Start for a list */
+    static Start list();
+    /** Return a Start for a map */
+    static Start map();
+    /** Return a Start for a described type */
+    static Start described();
+};
+
+/** Finish insterting or extracting a container value. */
+PN_CPP_EXTERN struct Finish {};
+inline Finish finish() { return Finish(); }
+
+/** Skip a value */
+PN_CPP_EXTERN struct Skip{};
+inline Skip skip() { return Skip(); }
+
+}}
+
+#endif // TYPES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Acceptor.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Acceptor.cpp b/proton-c/bindings/cpp/src/Acceptor.cpp
index aa73ebf..6d3d1af 100644
--- a/proton-c/bindings/cpp/src/Acceptor.cpp
+++ b/proton-c/bindings/cpp/src/Acceptor.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "proton/cpp/Acceptor.h"
-#include "proton/cpp/exceptions.h"
-#include "ProtonImplRef.h"
-#include "Msg.h"
+#include "proton/Acceptor.hpp"
+#include "proton/exceptions.hpp"
+#include "ProtonImplRef.hpp"
+#include "Msg.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Acking.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Acking.cpp b/proton-c/bindings/cpp/src/Acking.cpp
index 62eca98..832b9f2 100644
--- a/proton-c/bindings/cpp/src/Acking.cpp
+++ b/proton-c/bindings/cpp/src/Acking.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "proton/cpp/Acking.h"
+#include "proton/Acking.hpp"
 #include "proton/delivery.h"
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
index 67e7d0c..006b567 100644
--- a/proton-c/bindings/cpp/src/Connection.cpp
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -18,14 +18,14 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Handler.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
-#include "contexts.h"
-#include "ConnectionImpl.h"
-#include "PrivateImplRef.h"
+#include "proton/Container.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Handler.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
+#include "ConnectionImpl.hpp"
+#include "PrivateImplRef.hpp"
 
 #include "proton/connection.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
index f7cc5f9..450d504 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -18,15 +18,15 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Handler.h"
-#include "proton/cpp/exceptions.h"
-#include "ConnectionImpl.h"
-#include "proton/cpp/Transport.h"
-#include "Msg.h"
-#include "contexts.h"
-#include "PrivateImplRef.h"
-#include "ContainerImpl.h"
+#include "proton/Container.hpp"
+#include "proton/Handler.hpp"
+#include "proton/exceptions.hpp"
+#include "ConnectionImpl.hpp"
+#include "proton/Transport.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
+#include "PrivateImplRef.hpp"
+#include "ContainerImpl.hpp"
 
 #include "proton/connection.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
deleted file mode 100644
index f16c862..0000000
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef PROTON_CPP_CONNECTIONIMPL_H
-#define PROTON_CPP_CONNECTIONIMPL_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/cpp/ImportExport.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Transport;
-class Container;
-
-class ConnectionImpl : public Endpoint
-{
-  public:
-    PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
-    PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
-    PN_CPP_EXTERN virtual ~ConnectionImpl();
-    PN_CPP_EXTERN Transport &getTransport();
-    PN_CPP_EXTERN Handler *getOverride();
-    PN_CPP_EXTERN void setOverride(Handler *h);
-    PN_CPP_EXTERN void open();
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN pn_connection_t *getPnConnection();
-    PN_CPP_EXTERN Container &getContainer();
-    PN_CPP_EXTERN std::string getHostname();
-    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    static Connection &getReactorReference(pn_connection_t *);
-    static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }
-    void reactorDetach();
-    static void incref(ConnectionImpl *);
-    static void decref(ConnectionImpl *);
-  private:
-    friend class Connector;
-    friend class ContainerImpl;
-    Container container;
-    int refCount;
-    Handler *override;
-    Transport *transport;
-    pn_session_t *defaultSession;  // Temporary, for SessionPerConnection style policy.
-    pn_connection_t *pnConnection;
-    Connection reactorReference;   // Keep-alive reference, until PN_CONNECTION_FINAL.
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ConnectionImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.hpp b/proton-c/bindings/cpp/src/ConnectionImpl.hpp
new file mode 100644
index 0000000..e20d614
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.hpp
@@ -0,0 +1,75 @@
+#ifndef PROTON_CPP_CONNECTIONIMPL_H
+#define PROTON_CPP_CONNECTIONIMPL_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/ImportExport.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Transport;
+class Container;
+
+class ConnectionImpl : public Endpoint
+{
+  public:
+    PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
+    PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
+    PN_CPP_EXTERN virtual ~ConnectionImpl();
+    PN_CPP_EXTERN Transport &getTransport();
+    PN_CPP_EXTERN Handler *getOverride();
+    PN_CPP_EXTERN void setOverride(Handler *h);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_connection_t *getPnConnection();
+    PN_CPP_EXTERN Container &getContainer();
+    PN_CPP_EXTERN std::string getHostname();
+    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    static Connection &getReactorReference(pn_connection_t *);
+    static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }
+    void reactorDetach();
+    static void incref(ConnectionImpl *);
+    static void decref(ConnectionImpl *);
+  private:
+    friend class Connector;
+    friend class ContainerImpl;
+    Container container;
+    int refCount;
+    Handler *override;
+    Transport *transport;
+    pn_session_t *defaultSession;  // Temporary, for SessionPerConnection style policy.
+    pn_connection_t *pnConnection;
+    Connection reactorReference;   // Keep-alive reference, until PN_CONNECTION_FINAL.
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.cpp b/proton-c/bindings/cpp/src/Connector.cpp
index fc6eed3..13c197f 100644
--- a/proton-c/bindings/cpp/src/Connector.cpp
+++ b/proton-c/bindings/cpp/src/Connector.cpp
@@ -19,14 +19,14 @@
  *
  */
 
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Transport.h"
-#include "proton/cpp/Container.h"
-#include "proton/cpp/Event.h"
+#include "proton/Connection.hpp"
+#include "proton/Transport.hpp"
+#include "proton/Container.hpp"
+#include "proton/Event.hpp"
 #include "proton/connection.h"
-#include "Connector.h"
-#include "ConnectionImpl.h"
-#include "Url.h"
+#include "Connector.hpp"
+#include "ConnectionImpl.hpp"
+#include "Url.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Connector.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.h b/proton-c/bindings/cpp/src/Connector.h
deleted file mode 100644
index d829699..0000000
--- a/proton-c/bindings/cpp/src/Connector.h
+++ /dev/null
@@ -1,59 +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/cpp/ProtonHandler.h"
-#include "proton/event.h"
-#include "proton/reactor.h"
-#include <string>
-
-
-namespace proton {
-namespace reactor {
-
-class Event;
-class Connection;
-class Transport;
-
-class Connector : public ProtonHandler
-{
-  public:
-    Connector(Connection &c);
-    ~Connector();
-    void setAddress(const std::string &host);
-    void connect();
-    virtual void onConnectionLocalOpen(Event &e);
-    virtual void onConnectionRemoteOpen(Event &e);
-    virtual void onConnectionInit(Event &e);
-    virtual void onTransportClosed(Event &e);
-
-  private:
-    Connection connection;
-    std::string address;
-    Transport *transport;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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
new file mode 100644
index 0000000..3c080ad
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Connector.hpp
@@ -0,0 +1,59 @@
+#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/ProtonHandler.hpp"
+#include "proton/event.h"
+#include "proton/reactor.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class Connection;
+class Transport;
+
+class Connector : public ProtonHandler
+{
+  public:
+    Connector(Connection &c);
+    ~Connector();
+    void setAddress(const std::string &host);
+    void connect();
+    virtual void onConnectionLocalOpen(Event &e);
+    virtual void onConnectionRemoteOpen(Event &e);
+    virtual void onConnectionInit(Event &e);
+    virtual void onTransportClosed(Event &e);
+
+  private:
+    Connection connection;
+    std::string address;
+    Transport *transport;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index 3ae1963..4fa6c6a 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -18,19 +18,19 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingEvent.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Session.h"
-#include "proton/cpp/MessagingAdapter.h"
-#include "proton/cpp/Acceptor.h"
-#include "proton/cpp/exceptions.h"
-#include "ContainerImpl.h"
-#include "PrivateImplRef.h"
-
-#include "Connector.h"
-#include "contexts.h"
-#include "Url.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingEvent.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Session.hpp"
+#include "proton/MessagingAdapter.hpp"
+#include "proton/Acceptor.hpp"
+#include "proton/exceptions.hpp"
+#include "ContainerImpl.hpp"
+#include "PrivateImplRef.hpp"
+
+#include "Connector.hpp"
+#include "contexts.hpp"
+#include "Url.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 989bd00..80137b5 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -18,21 +18,21 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingEvent.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Session.h"
-#include "proton/cpp/MessagingAdapter.h"
-#include "proton/cpp/Acceptor.h"
-#include "proton/cpp/exceptions.h"
-
-#include "Msg.h"
-#include "ContainerImpl.h"
-#include "ConnectionImpl.h"
-#include "Connector.h"
-#include "contexts.h"
-#include "Url.h"
-#include "PrivateImplRef.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingEvent.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Session.hpp"
+#include "proton/MessagingAdapter.hpp"
+#include "proton/Acceptor.hpp"
+#include "proton/exceptions.hpp"
+
+#include "Msg.hpp"
+#include "ContainerImpl.hpp"
+#include "ConnectionImpl.hpp"
+#include "Connector.hpp"
+#include "contexts.hpp"
+#include "Url.hpp"
+#include "PrivateImplRef.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
deleted file mode 100644
index c0d2d12..0000000
--- a/proton-c/bindings/cpp/src/ContainerImpl.h
+++ /dev/null
@@ -1,82 +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/cpp/ImportExport.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Link.h"
-#include "proton/cpp/Duration.h"
-
-#include "proton/reactor.h"
-
-#include <string>
-namespace proton {
-namespace reactor {
-
-class DispatchHelper;
-class Connection;
-class Connector;
-class Acceptor;
-
-class ContainerImpl
-{
-  public:
-    PN_CPP_EXTERN ContainerImpl(Handler &h);
-    PN_CPP_EXTERN ContainerImpl();
-    PN_CPP_EXTERN ~ContainerImpl();
-    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h);
-    PN_CPP_EXTERN void run();
-    PN_CPP_EXTERN pn_reactor_t *getReactor();
-    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h);
-    PN_CPP_EXTERN Sender createSender(std::string &url);
-    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
-    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
-    PN_CPP_EXTERN Acceptor listen(const std::string &url);
-    PN_CPP_EXTERN std::string getContainerId();
-    PN_CPP_EXTERN Duration getTimeout();
-    PN_CPP_EXTERN void setTimeout(Duration timeout);
-    void start();
-    bool process();
-    void stop();
-    void wakeup();
-    bool isQuiesced();
-    pn_handler_t *wrapHandler(Handler *h);
-    static void incref(ContainerImpl *);
-    static void decref(ContainerImpl *);
-  private:
-    void dispatch(pn_event_t *event, pn_event_type_t type);
-    Acceptor acceptor(const std::string &host, const std::string &port);
-    void initializeReactor();
-    pn_reactor_t *reactor;
-    Handler *handler;
-    MessagingAdapter *messagingAdapter;
-    Handler *overrideHandler;
-    Handler *flowController;
-    std::string containerId;
-    int refCount;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ContainerImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.hpp b/proton-c/bindings/cpp/src/ContainerImpl.hpp
new file mode 100644
index 0000000..80df83a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ContainerImpl.hpp
@@ -0,0 +1,82 @@
+#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/ImportExport.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Link.hpp"
+#include "proton/Duration.hpp"
+
+#include "proton/reactor.h"
+
+#include <string>
+namespace proton {
+namespace reactor {
+
+class DispatchHelper;
+class Connection;
+class Connector;
+class Acceptor;
+
+class ContainerImpl
+{
+  public:
+    PN_CPP_EXTERN ContainerImpl(Handler &h);
+    PN_CPP_EXTERN ContainerImpl();
+    PN_CPP_EXTERN ~ContainerImpl();
+    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h);
+    PN_CPP_EXTERN void run();
+    PN_CPP_EXTERN pn_reactor_t *getReactor();
+    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h);
+    PN_CPP_EXTERN Sender createSender(std::string &url);
+    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+    PN_CPP_EXTERN Acceptor listen(const std::string &url);
+    PN_CPP_EXTERN std::string getContainerId();
+    PN_CPP_EXTERN Duration getTimeout();
+    PN_CPP_EXTERN void setTimeout(Duration timeout);
+    void start();
+    bool process();
+    void stop();
+    void wakeup();
+    bool isQuiesced();
+    pn_handler_t *wrapHandler(Handler *h);
+    static void incref(ContainerImpl *);
+    static void decref(ContainerImpl *);
+  private:
+    void dispatch(pn_event_t *event, pn_event_type_t type);
+    Acceptor acceptor(const std::string &host, const std::string &port);
+    void initializeReactor();
+    pn_reactor_t *reactor;
+    Handler *handler;
+    MessagingAdapter *messagingAdapter;
+    Handler *overrideHandler;
+    Handler *flowController;
+    std::string containerId;
+    int refCount;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Data.cpp b/proton-c/bindings/cpp/src/Data.cpp
index 790cecb..3cfa715 100644
--- a/proton-c/bindings/cpp/src/Data.cpp
+++ b/proton-c/bindings/cpp/src/Data.cpp
@@ -17,9 +17,9 @@
  * under the License.
  */
 
-#include "proton/cpp/Data.h"
+#include "proton/Data.hpp"
 #include <proton/codec.h>
-#include "proton_bits.h"
+#include "proton_bits.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp
index 503db81..6f5b73b 100644
--- a/proton-c/bindings/cpp/src/Decoder.cpp
+++ b/proton-c/bindings/cpp/src/Decoder.cpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 
-#include "proton/cpp/Decoder.h"
-#include "proton/cpp/Value.h"
+#include "proton/Decoder.hpp"
+#include "proton/Value.hpp"
 #include <proton/codec.h>
-#include "proton_bits.h"
-#include "Msg.h"
+#include "proton_bits.hpp"
+#include "Msg.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Delivery.cpp b/proton-c/bindings/cpp/src/Delivery.cpp
index d0b2f3c..60cd0d3 100644
--- a/proton-c/bindings/cpp/src/Delivery.cpp
+++ b/proton-c/bindings/cpp/src/Delivery.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "proton/cpp/Delivery.h"
+#include "proton/Delivery.hpp"
 #include "proton/delivery.h"
-#include "ProtonImplRef.h"
+#include "ProtonImplRef.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Duration.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Duration.cpp b/proton-c/bindings/cpp/src/Duration.cpp
index f4155d9..1c5c5ea 100644
--- a/proton-c/bindings/cpp/src/Duration.cpp
+++ b/proton-c/bindings/cpp/src/Duration.cpp
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-#include "proton/cpp/Duration.h"
+#include "proton/Duration.hpp"
 #include <limits>
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp
index 9182400..0bd6943 100644
--- a/proton-c/bindings/cpp/src/Encoder.cpp
+++ b/proton-c/bindings/cpp/src/Encoder.cpp
@@ -17,11 +17,11 @@
  * under the License.
  */
 
-#include "proton/cpp/Encoder.h"
-#include "proton/cpp/Value.h"
+#include "proton/Encoder.hpp"
+#include "proton/Value.hpp"
 #include <proton/codec.h>
-#include "proton_bits.h"
-#include "Msg.h"
+#include "proton_bits.hpp"
+#include "Msg.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Endpoint.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Endpoint.cpp b/proton-c/bindings/cpp/src/Endpoint.cpp
index 868f361..ad96e0a 100644
--- a/proton-c/bindings/cpp/src/Endpoint.cpp
+++ b/proton-c/bindings/cpp/src/Endpoint.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Connection.h"
-#include "proton/cpp/Transport.h"
+#include "proton/Endpoint.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Transport.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Event.cpp b/proton-c/bindings/cpp/src/Event.cpp
index 531c764..937e3ed 100644
--- a/proton-c/bindings/cpp/src/Event.cpp
+++ b/proton-c/bindings/cpp/src/Event.cpp
@@ -22,12 +22,12 @@
 #include "proton/reactor.h"
 #include "proton/event.h"
 
-#include "proton/cpp/Event.h"
-#include "proton/cpp/Handler.h"
-#include "proton/cpp/exceptions.h"
+#include "proton/Event.hpp"
+#include "proton/Handler.hpp"
+#include "proton/exceptions.hpp"
 
-#include "Msg.h"
-#include "contexts.h"
+#include "Msg.hpp"
+#include "contexts.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Handler.cpp b/proton-c/bindings/cpp/src/Handler.cpp
index 5c37c8d..235bff7 100644
--- a/proton-c/bindings/cpp/src/Handler.cpp
+++ b/proton-c/bindings/cpp/src/Handler.cpp
@@ -18,8 +18,8 @@
  * under the License.
  *
  */
-#include "proton/cpp/Handler.h"
-#include "proton/cpp/Event.h"
+#include "proton/Handler.hpp"
+#include "proton/Event.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp
index 59cf039..9065524 100644
--- a/proton-c/bindings/cpp/src/Link.cpp
+++ b/proton-c/bindings/cpp/src/Link.cpp
@@ -18,13 +18,13 @@
  * under the License.
  *
  */
-#include "proton/cpp/Link.h"
-#include "proton/cpp/exceptions.h"
-#include "proton/cpp/Connection.h"
-#include "ConnectionImpl.h"
-#include "Msg.h"
-#include "contexts.h"
-#include "ProtonImplRef.h"
+#include "proton/Link.hpp"
+#include "proton/exceptions.hpp"
+#include "proton/Connection.hpp"
+#include "ConnectionImpl.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
+#include "ProtonImplRef.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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 bdc8c0c..f422202 100644
--- a/proton-c/bindings/cpp/src/Message.cpp
+++ b/proton-c/bindings/cpp/src/Message.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "proton/cpp/Message.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
-#include "ProtonImplRef.h"
+#include "proton/Message.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
+#include "ProtonImplRef.hpp"
 
 #include <cstring>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index f137397..7c3ba6c 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -18,11 +18,11 @@
  * under the License.
  *
  */
-#include "proton/cpp/MessagingAdapter.h"
-#include "proton/cpp/MessagingEvent.h"
-#include "proton/cpp/Sender.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
+#include "proton/MessagingAdapter.hpp"
+#include "proton/MessagingEvent.hpp"
+#include "proton/Sender.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
 
 #include "proton/link.h"
 #include "proton/handlers.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingEvent.cpp b/proton-c/bindings/cpp/src/MessagingEvent.cpp
index b8a2f8a..fc20e2b 100644
--- a/proton-c/bindings/cpp/src/MessagingEvent.cpp
+++ b/proton-c/bindings/cpp/src/MessagingEvent.cpp
@@ -23,13 +23,13 @@
 #include "proton/event.h"
 #include "proton/link.h"
 
-#include "proton/cpp/MessagingEvent.h"
-#include "proton/cpp/Message.h"
-#include "proton/cpp/ProtonHandler.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
-#include "contexts.h"
+#include "proton/MessagingEvent.hpp"
+#include "proton/Message.hpp"
+#include "proton/ProtonHandler.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
index 6e3d2bd..9076014 100644
--- a/proton-c/bindings/cpp/src/MessagingHandler.cpp
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -18,9 +18,9 @@
  * under the License.
  *
  */
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/ProtonEvent.h"
-#include "proton/cpp/MessagingAdapter.h"
+#include "proton/MessagingHandler.hpp"
+#include "proton/ProtonEvent.hpp"
+#include "proton/MessagingAdapter.hpp"
 #include "proton/handlers.h"
 
 namespace proton {


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


[30/50] [abbrv] qpid-proton git commit: PROTON-865: Example and cmake cleanup, minor code cleanup.

Posted by ac...@apache.org.
PROTON-865: Example and cmake cleanup, minor code cleanup.

- Optionally enable C++ in top level cmake for examplesb. Still works without a C++ compiler.
- Move cpp examples to the /examples dir, renamed for consistent exe naming conventions.
- Integrate example build & auto-test with cmake
- Improved exception handling
- Simplified exception handling.
- Removed nascent logging code, logging should be handled centrally in C library.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 6ecb0525614bf184ac36a98458d3693942ea5b07
Parents: a4565b1
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Jun 1 18:03:36 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 CMakeLists.txt                                  |   8 +-
 examples/CMakeLists.txt                         |   3 +
 examples/cpp/CMakeLists.txt                     |  30 ++
 examples/cpp/README.md                          |  42 +++
 examples/cpp/broker.cpp                         | 201 +++++++++++++
 examples/cpp/example_test.py                    | 105 +++++++
 examples/cpp/helloworld.cpp                     |  69 +++++
 examples/cpp/helloworld_blocking.cpp            |  70 +++++
 examples/cpp/helloworld_direct.cpp              |  76 +++++
 examples/cpp/simple_recv.cpp                    | 115 ++++++++
 examples/cpp/simple_send.cpp                    | 122 ++++++++
 examples/go/CMakeLists.txt                      |  29 ++
 examples/go/example_test.go                     | 284 +++++++++++++++++++
 proton-c/CMakeLists.txt                         |   3 -
 proton-c/bindings/CMakeLists.txt                |   8 +-
 proton-c/bindings/cpp/CMakeLists.txt            |  26 --
 proton-c/bindings/cpp/README.md                 |  23 ++
 proton-c/bindings/cpp/examples/Broker.cpp       | 193 -------------
 proton-c/bindings/cpp/examples/HelloWorld.cpp   |  62 ----
 .../cpp/examples/HelloWorldBlocking.cpp         |  65 -----
 .../bindings/cpp/examples/HelloWorldDirect.cpp  |  70 -----
 proton-c/bindings/cpp/examples/SimpleRecv.cpp   | 109 -------
 proton-c/bindings/cpp/examples/SimpleSend.cpp   | 117 --------
 .../bindings/cpp/include/proton/cpp/Delivery.h  |   2 -
 .../bindings/cpp/include/proton/cpp/Handle.h    |   1 +
 .../cpp/include/proton/cpp/exceptions.h         |  17 +-
 proton-c/bindings/cpp/src/Connector.cpp         |   7 +-
 proton-c/bindings/cpp/src/Container.cpp         |   1 -
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |   2 +-
 proton-c/bindings/cpp/src/Delivery.cpp          |   1 +
 proton-c/bindings/cpp/src/LogInternal.h         |  51 ----
 proton-c/bindings/cpp/src/Logger.cpp            |  56 ----
 proton-c/bindings/cpp/src/exceptions.cpp        |  33 ---
 33 files changed, 1186 insertions(+), 815 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2df2dfb..261fdc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,16 +20,15 @@ cmake_minimum_required (VERSION 2.6)
 
 project (Proton C)
 
+# Enable C++ now for examples and bindings subdirectories, but make it optional.
+enable_language(CXX OPTIONAL)
+
 if (MSVC)
   # No C99 capability, use C++
   set(DEFAULT_BUILD_WITH_CXX ON)
 endif (MSVC)
 option(BUILD_WITH_CXX "Compile Proton using C++" ${DEFAULT_BUILD_WITH_CXX})
 
-if (BUILD_WITH_CXX)
-  project (Proton C CXX)
-endif (BUILD_WITH_CXX)
-
 if (CMAKE_CONFIGURATION_TYPES)
   # There is no single "build type"...
   message(STATUS "Build types are ${CMAKE_CONFIGURATION_TYPES}")
@@ -141,6 +140,7 @@ if (BUILD_JAVA)
 endif()
 
 add_subdirectory(proton-c)
+add_subdirectory(examples)
 
 install (FILES LICENSE README.md TODO
          DESTINATION ${PROTON_SHARE})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index feac758..5724e59 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -21,3 +21,6 @@ set (Proton_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 add_subdirectory(c/messenger)
+if (BUILD_CPP)
+  add_subdirectory(cpp)
+endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
new file mode 100644
index 0000000..b1e4a1f
--- /dev/null
+++ b/examples/cpp/CMakeLists.txt
@@ -0,0 +1,30 @@
+#
+# 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_directories ("${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
+
+foreach(example broker helloworld helloworld_blocking helloworld_direct simple_recv simple_send)
+  add_executable(${example} ${example}.cpp)
+  target_link_libraries(${example} qpid-proton-cpp)
+endforeach()
+
+add_test(
+  NAME cpp_example_test
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v
+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/README.md
----------------------------------------------------------------------
diff --git a/examples/cpp/README.md b/examples/cpp/README.md
new file mode 100644
index 0000000..867c671
--- /dev/null
+++ b/examples/cpp/README.md
@@ -0,0 +1,42 @@
+# C++ examples
+
+## broker.cpp
+
+A very simple "mini broker". You can use this to run other examples that reqiure
+an intermediary, or you can use a real AMQP 1.0 broker. It creates queues
+automatically when a client tries to send to or subscribe from a node.
+
+## helloworld.cpp
+
+Basic example that connects to an intermediary on localhost:5672,
+establishes a subscription from the 'examples' node on that
+intermediary, then creates a sending link to the same node and sends
+one message. On receving the message back via the subcription, the
+connection is closed.
+
+## helloworld_blocking.cpp
+
+The same as the basic helloworld.cpp, but using a
+synchronous/sequential style wrapper on top of the
+asynchronous/reactive API. The purpose of this example is just to show
+how different functionality can be easily layered should it be
+desired.
+
+## helloworld_direct.cpp
+
+A variant of the basic helloworld example, that does not use an
+intermediary, but listens for incoming connections itself. It
+establishes a connection to itself with a link over which a single
+message is sent. This demonstrates the ease with which a simple daemon
+can be built using the API.
+
+## simple_send.cpp
+
+An example of sending a fixed number of messages and tracking their
+(asynchronous) acknowledgement. Messages are sent through the 'examples' node on
+an intermediary accessible on port 5672 on localhost.
+
+# simple_recv.cpp
+
+Subscribes to the 'examples' node on an intermediary accessible on port 5672 on
+localhost. Simply prints out the body of received messages.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
new file mode 100644
index 0000000..01160a7
--- /dev/null
+++ b/examples/cpp/broker.cpp
@@ -0,0 +1,201 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+
+#include <iostream>
+#include <deque>
+#include <map>
+#include <list>
+#include <stdlib.h>
+#include <string.h>
+
+using namespace proton::reactor;
+
+std::string generateUuid(){
+    throw "TODO: platform neutral uuid";
+}
+
+class Queue {
+  public:
+    bool dynamic;
+    typedef std::deque<Message> MsgQ;
+    typedef std::list<Sender> List;
+    MsgQ queue;
+    List consumers;
+
+    Queue(bool dyn = false) : dynamic(dyn), queue(MsgQ()), consumers(List()) {}
+
+    void subscribe(Sender &c) {
+        consumers.push_back(c);
+    }
+
+    bool unsubscribe(Sender &c) {
+        consumers.remove(c);
+        return (consumers.size() == 0 && (dynamic || queue.size() == 0));
+    }
+
+    void publish(Message &m) {
+        queue.push_back(m);
+        dispatch(0);
+    }
+
+    void dispatch(Sender *s) {
+        while (deliverTo(s)) {
+        }
+    }
+
+    bool deliverTo(Sender *consumer) {
+        // deliver to single consumer if supplied, else all consumers
+        int count = consumer ? 1 : consumers.size();
+        if (!count) return false;
+        bool result = false;
+        List::iterator it = consumers.begin();
+        if (!consumer && count) consumer = &*it;
+
+        while (queue.size()) {
+            if (consumer->getCredit()) {
+                consumer->send(queue.front());
+                queue.pop_front();
+                result = true;
+            }
+            if (--count)
+                it++;
+            else
+                return result;
+        }
+        return false;
+    }
+};
+
+class Broker : public MessagingHandler {
+  private:
+    std::string url;
+    typedef std::map<std::string, Queue *> QMap;
+    QMap queues;
+  public:
+
+    Broker(const std::string &s) : url(s), queues(QMap()) {}
+
+    void onStart(Event &e) {
+        e.getContainer().listen(url);
+        std::cout << "broker listening on " << url << std::endl;
+    }
+
+    Queue &queue(std::string &address) {
+        QMap::iterator it = queues.find(address);
+        if (it == queues.end()) {
+            queues[address] = new Queue();
+            return *queues[address];
+        }
+        else {
+            return *it->second;
+        }
+    }
+
+    void onLinkOpening(Event &e) {
+        Link lnk = e.getLink();
+        if (lnk.isSender()) {
+            Sender sender(lnk);
+            Terminus remoteSource(lnk.getRemoteSource());
+            if (remoteSource.isDynamic()) {
+                std::string address = generateUuid();
+                lnk.getSource().setAddress(address);
+                Queue *q = new Queue(true);
+                queues[address] = q;
+                q->subscribe(sender);
+            }
+            else {
+                std::string address = remoteSource.getAddress();
+                if (!address.empty()) {
+                    lnk.getSource().setAddress(address);
+                    queue(address).subscribe(sender);
+                }
+            }
+        }
+        else {
+            std::string address = lnk.getRemoteTarget().getAddress();
+            if (!address.empty())
+                lnk.getTarget().setAddress(address);
+        }
+    }
+
+    void unsubscribe (Sender &lnk) {
+        std::string address = lnk.getSource().getAddress();
+        QMap::iterator it = queues.find(address);
+        if (it != queues.end() && it->second->unsubscribe(lnk)) {
+            delete it->second;
+            queues.erase(it);
+        }
+    }
+
+    void onLinkClosing(Event &e) {
+        Link lnk = e.getLink();
+        if (lnk.isSender()) {
+            Sender s(lnk);
+            unsubscribe(s);
+        }
+    }
+
+    void onConnectionClosing(Event &e) {
+        removeStaleConsumers(e.getConnection());
+    }
+
+    void onDisconnected(Event &e) {
+        removeStaleConsumers(e.getConnection());
+    }
+
+    void removeStaleConsumers(Connection &connection) {
+        Link l = connection.getLinkHead(Endpoint::REMOTE_ACTIVE);
+        while (l) {
+            if (l.isSender()) {
+                Sender s(l);
+                unsubscribe(s);
+            }
+            l = l.getNext(Endpoint::REMOTE_ACTIVE);
+        }
+    }
+
+    void onSendable(Event &e) {
+        Link lnk = e.getLink();
+        Sender sender(lnk);
+        std::string addr = lnk.getSource().getAddress();
+        queue(addr).dispatch(&sender);
+    }
+
+    void onMessage(Event &e) {
+        std::string addr = e.getLink().getTarget().getAddress();
+        Message msg = e.getMessage();
+        queue(addr).publish(msg);
+    }
+};
+
+int main(int argc, char **argv) {
+    std::string url = argc > 1 ? argv[1] : ":5672";
+    Broker broker(url);
+    try {
+        Container(broker).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
new file mode 100644
index 0000000..9a8ac67
--- /dev/null
+++ b/examples/cpp/example_test.py
@@ -0,0 +1,105 @@
+#
+# 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
+#
+
+import unittest
+import os, sys, socket, time
+from  random import randrange
+from subprocess import Popen, check_output, PIPE
+
+NULL = open(os.devnull, 'w')
+
+class Broker(object):
+    """Run the test broker"""
+
+    @classmethod
+    def get(cls):
+        if not hasattr(cls, "_broker"):
+            cls._broker = Broker()
+        return cls._broker
+
+    @classmethod
+    def stop(cls):
+        if cls._broker and cls._broker.process:
+            cls._broker.process.kill()
+            cls._broker = None
+
+    def __init__(self):
+        self.port = randrange(10000, 20000)
+        self.addr = ":%s" % self.port
+        self.process = Popen(["./broker", self.addr], stdout=NULL, stderr=NULL)
+        # Wait 10 secs for broker to listen
+        deadline = time.time() + 10
+        c = None
+        while time.time() < deadline:
+            try:
+                c = socket.create_connection(("127.0.0.1", self.port), deadline - time.time())
+                break
+            except socket.error as e:
+                time.sleep(0.01)
+        if c is None:
+            raise Exception("Timed out waiting for broker")
+        c.close()
+
+
+class ExampleTest(unittest.TestCase):
+    """Test examples"""
+
+    @classmethod
+    def tearDownClass(self):
+        Broker.stop()
+
+    def test_helloworld(self):
+        b = Broker.get()
+        hw = check_output(["./helloworld", b.addr])
+        self.assertEqual("Hello World!\n", hw)
+
+    def test_helloworld_blocking(self):
+        b = Broker.get()
+        hw = check_output(["./helloworld_blocking", b.addr])
+        self.assertEqual("Hello World!\n", hw)
+
+    def test_helloworld_direct(self):
+        url = ":%s/examples" % randrange(10000, 20000)
+        hw = check_output(["./helloworld_direct", url])
+        self.assertEqual("Hello World!\n", hw)
+
+    def test_simple_send_recv(self):
+        b = Broker.get()
+        n = 5
+        send = check_output(["./simple_send", "-a", b.addr, "-m", str(n)])
+        self.assertEqual("all messages confirmed\n", send)
+        recv = check_output(["./simple_recv", "-a", b.addr, "-m", str(n)])
+        recv_expect = "simple_recv listening on %s\n" % (b.addr)
+        recv_expect += "".join(['[%d]: b"some arbitrary binary data"\n' % (i+1) for i in range(n)])
+        self.assertEqual(recv_expect, recv)
+
+    def FIXME_test_simple_recv_send(self):
+        """Start receiver first, then run sender"""
+        b = Broker.get()
+        n = 5
+        recv = Popen(["./simple_recv", "-a", b.addr, "-m", str(n)], stdout=PIPE)
+        self.assertEqual("simple_recv listening on %s\n" % (b.addr), recv.stdout.readline())
+        send = check_output(["./simple_send", "-a", b.addr, "-m", str(n)])
+        self.assertEqual("all messages confirmed\n", send)
+        recv_expect = "".join(['[%d]: b"some arbitrary binary data"\n' % (i+1) for i in range(n)])
+        out, err = recv.communicate()
+        self.assertEqual(recv_expect, out)
+
+if __name__ == "__main__":
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
new file mode 100644
index 0000000..6b58eb7
--- /dev/null
+++ b/examples/cpp/helloworld.cpp
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+class HelloWorld : public MessagingHandler {
+  private:
+    std::string server;
+    std::string address;
+  public:
+
+    HelloWorld(const std::string &s, const std::string &addr) : server(s), address(addr) {}
+
+    void onStart(Event &e) {
+        Connection conn = e.getContainer().connect(server);
+        e.getContainer().createReceiver(conn, address);
+        e.getContainer().createSender(conn, address);
+    }
+
+    void onSendable(Event &e) {
+        Message m;
+        m.setBody("Hello World!");
+        e.getSender().send(m);
+        e.getSender().close();
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+        e.getConnection().close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    try {
+        std::string server = argc > 1 ? argv[1] : ":5672";
+        std::string addr = argc > 2 ? argv[2] : "examples";
+        HelloWorld hw(server, addr);
+        Container(hw).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/helloworld_blocking.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_blocking.cpp b/examples/cpp/helloworld_blocking.cpp
new file mode 100644
index 0000000..5f443b6
--- /dev/null
+++ b/examples/cpp/helloworld_blocking.cpp
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/BlockingSender.h"
+
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+class HelloWorldBlocking : public MessagingHandler {
+  private:
+    std::string server;
+    std::string address;
+  public:
+
+    HelloWorldBlocking(const std::string &s, const std::string &addr) : server(s), address(addr) {}
+
+    void onStart(Event &e) {
+        Connection conn = e.getContainer().connect(server);
+        e.getContainer().createReceiver(conn, address);
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+        e.getConnection().close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    try {
+        std::string server = argc > 1 ? argv[1] : ":5672";
+        std::string addr = argc > 2 ? argv[2] : "examples";
+        BlockingConnection conn = BlockingConnection(server);
+        BlockingSender sender = conn.createSender(addr);
+        Message m;
+        m.setBody("Hello World!");
+        sender.send(m);
+        conn.close();
+
+        // TODO Temporary hack until blocking receiver available
+        HelloWorldBlocking hw(server, addr);
+        Container(hw).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
new file mode 100644
index 0000000..12617cd
--- /dev/null
+++ b/examples/cpp/helloworld_direct.cpp
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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/cpp/MessagingHandler.h"
+#include "proton/cpp/Container.h"
+
+//#include "proton/cpp/Acceptor.h"
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+
+class HelloWorldDirect : public MessagingHandler {
+  private:
+    std::string url;
+    Acceptor acceptor;
+  public:
+
+    HelloWorldDirect(const std::string &u) : url(u) {}
+
+    void onStart(Event &e) {
+        acceptor = e.getContainer().listen(url);
+        e.getContainer().createSender(url);
+    }
+
+    void onSendable(Event &e) {
+        Message m;
+        m.setBody("Hello World!");
+        e.getSender().send(m);
+        e.getSender().close();
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+    }
+
+    void onAccepted(Event &e) {
+        e.getConnection().close();
+    }
+
+    void onConnectionClosed(Event &e) {
+        acceptor.close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    try {
+        std::string url = argc > 1 ? argv[1] : ":8888/examples";
+        HelloWorldDirect hwd(url);
+        Container(hwd).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
new file mode 100644
index 0000000..42c561b
--- /dev/null
+++ b/examples/cpp/simple_recv.cpp
@@ -0,0 +1,115 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Link.h"
+
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+using namespace proton::reactor;
+
+class Recv : public MessagingHandler {
+  private:
+    std::string url;
+    int expected;
+    int received;
+  public:
+
+    Recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
+
+    void onStart(Event &e) {
+        e.getContainer().createReceiver(url);
+        std::cout << "simple_recv listening on " << url << std::endl;
+    }
+
+    void onMessage(Event &e) {
+        uint64_t id = 0;
+        Message msg = e.getMessage();
+        if (msg.getIdType() == PN_ULONG) {
+            id = msg.getId();
+            if (id < received)
+                return; // ignore duplicate
+        }
+        if (expected == 0 || received < expected) {
+            std::cout << '[' << id << "]: " << msg.getBody() << std::endl;
+            received++;
+            if (received == expected) {
+                e.getReceiver().close();
+                e.getConnection().close();
+            }
+        }
+    }
+};
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr);
+
+int main(int argc, char **argv) {
+    try {
+        int messageCount = 100;
+        std::string address("localhost:5672/examples");
+        parse_options(argc, argv, messageCount, address);
+        Recv recv(address, messageCount);
+        Container(recv).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}
+
+
+static void usage() {
+    std::cout << "Usage: simple_recv -m message_count -a address:" << std::endl;
+    exit (1);
+}
+
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr) {
+    int c, i;
+    for (i = 1; i < argc; i++) {
+        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
+            c = argv[i][1];
+            const char *nextarg = i < argc ? argv[i+1] : NULL;
+
+            switch (c) {
+            case 'a':
+                if (!nextarg) usage();
+                addr = nextarg;
+                i++;
+                break;
+            case 'm':
+                if (!nextarg) usage();
+                unsigned newc;
+                if (sscanf( nextarg, "%d", &newc) != 1) usage();
+                count = newc;
+                i++;
+                break;
+            default:
+                usage();
+            }
+        }
+        else usage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
new file mode 100644
index 0000000..eb87c8a
--- /dev/null
+++ b/examples/cpp/simple_send.cpp
@@ -0,0 +1,122 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Connection.h"
+
+#include <iostream>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+using namespace proton::reactor;
+
+class Send : public MessagingHandler {
+  private:
+    std::string url;
+    int sent;
+    int confirmed;
+    int total;
+  public:
+
+    Send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
+
+    void onStart(Event &e) {
+        e.getContainer().createSender(url);
+    }
+
+    void onSendable(Event &e) {
+        Sender sender = e.getSender();
+        while (sender.getCredit() && sent < total) {
+            Message msg;
+            msg.setId(sent + 1);
+            // TODO: fancy map body content as in Python example.  Simple binary for now.
+            const char *bin = "some arbitrary binary data";
+            msg.setBody(bin, strlen(bin));
+            sender.send(msg);
+            sent++;
+        }
+    }
+
+    void onAccepted(Event &e) {
+        confirmed++;
+        if (confirmed == total) {
+            std::cout << "all messages confirmed" << std::endl;
+            e.getConnection().close();
+        }
+    }
+
+    void onDisconnected(Event &e) {
+        sent = confirmed;
+    }
+};
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr);
+
+int main(int argc, char **argv) {
+    try {
+        int messageCount = 100;
+        std::string address("localhost:5672/examples");
+        parse_options(argc, argv, messageCount, address);
+        Send send(address, messageCount);
+        Container(send).run();
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        return 1;
+    }
+}
+
+
+static void usage() {
+    std::cout << "Usage: simple_send -m message_count -a address:" << std::endl;
+    exit (1);
+}
+
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr) {
+    int c, i;
+    for (i = 1; i < argc; i++) {
+        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
+            c = argv[i][1];
+            const char *nextarg = i < argc ? argv[i+1] : NULL;
+
+            switch (c) {
+            case 'a':
+                if (!nextarg) usage();
+                addr = nextarg;
+                i++;
+                break;
+            case 'm':
+                if (!nextarg) usage();
+                unsigned newc;
+                if (sscanf( nextarg, "%d", &newc) != 1) usage();
+                count = newc;
+                i++;
+                break;
+            default:
+                usage();
+            }
+        }
+        else usage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt
new file mode 100644
index 0000000..464ed7c
--- /dev/null
+++ b/examples/go/CMakeLists.txt
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# FIXME aconway 2015-05-20:
+# - use proton build for Go includes & libs.
+# - pre-build go libraries? Respect user GOPATH?
+
+if(BUILD_GO)
+  add_test(
+    NAME go_example_test
+    COMMAND ${GO_TEST} example_test.go -rpath ${CMAKE_BINARY_DIR}/proton-c
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/examples/go/example_test.go
----------------------------------------------------------------------
diff --git a/examples/go/example_test.go b/examples/go/example_test.go
new file mode 100644
index 0000000..8879c38
--- /dev/null
+++ b/examples/go/example_test.go
@@ -0,0 +1,284 @@
+/*
+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.
+*/
+
+// Tests to verify that example code behaves as expected.
+// Run in this directory with `go test example_test.go`
+//
+package main
+
+import (
+	"bufio"
+	"bytes"
+	"flag"
+	"fmt"
+	"io"
+	"io/ioutil"
+	"math/rand"
+	"net"
+	"os"
+	"os/exec"
+	"path"
+	"path/filepath"
+	"reflect"
+	"testing"
+	"time"
+)
+
+func panicIf(err error) {
+	if err != nil {
+		panic(err)
+	}
+}
+
+// A demo broker process
+type broker struct {
+	cmd    *exec.Cmd
+	addr   string
+	runerr chan error
+	err    error
+}
+
+// Try to connect to the broker to verify it is ready, give up after a timeout
+func (b *broker) check() error {
+	dialer := net.Dialer{Deadline: time.Now().Add(time.Second * 10)}
+	for {
+		c, err := dialer.Dial("tcp", b.addr)
+		if err == nil { // Success
+			c.Close()
+			return nil
+		}
+		select {
+		case runerr := <-b.runerr: // Broker exited.
+			return runerr
+		default:
+		}
+		if neterr, ok := err.(net.Error); ok && neterr.Timeout() { // Running but timed out
+			b.stop()
+			return fmt.Errorf("timed out waiting for broker")
+		}
+		time.Sleep(time.Second / 10)
+	}
+}
+
+// Start the demo broker, wait till it is listening on *addr. No-op if already started.
+func (b *broker) start() error {
+	if b.cmd == nil { // Not already started
+		// FIXME aconway 2015-04-30: better way to pick/configure a broker port.
+		b.addr = fmt.Sprintf("127.0.0.1:%d", rand.Intn(10000)+10000)
+		b.cmd = exampleCommand("event_broker", "-addr", b.addr)
+		b.runerr = make(chan error)
+		b.cmd.Stderr, b.cmd.Stdout = os.Stderr, os.Stdout
+		go func() {
+			b.runerr <- b.cmd.Run()
+		}()
+		b.err = b.check()
+	}
+	return b.err
+}
+
+func (b *broker) stop() {
+	if b != nil && b.cmd != nil {
+		b.cmd.Process.Kill()
+		b.cmd.Wait()
+	}
+}
+
+func checkEqual(want interface{}, got interface{}) error {
+	if reflect.DeepEqual(want, got) {
+		return nil
+	}
+	return fmt.Errorf("%#v != %#v", want, got)
+}
+
+// runCommand returns an exec.Cmd to run an example.
+func exampleCommand(prog string, arg ...string) *exec.Cmd {
+	build(prog + ".go")
+	args := []string{}
+	if *debug {
+		args = append(args, "-debug=true")
+	}
+	args = append(args, arg...)
+	cmd := exec.Command(exepath(prog), args...)
+	cmd.Stderr = os.Stderr
+	return cmd
+}
+
+// Run an example Go program, return the combined output as a string.
+func runExample(prog string, arg ...string) (string, error) {
+	cmd := exampleCommand(prog, arg...)
+	out, err := cmd.Output()
+	return string(out), err
+}
+
+func prefix(prefix string, err error) error {
+	if err != nil {
+		return fmt.Errorf("%s: %s", prefix, err)
+	}
+	return nil
+}
+
+func runExampleWant(want string, prog string, args ...string) error {
+	out, err := runExample(prog, args...)
+	if err != nil {
+		return fmt.Errorf("%s failed: %s: %s", prog, err, out)
+	}
+	return prefix(prog, checkEqual(want, out))
+}
+
+func exampleArgs(args ...string) []string {
+	return append(args, testBroker.addr+"/foo", testBroker.addr+"/bar", testBroker.addr+"/baz")
+}
+
+// Send then receive
+func TestExampleSendReceive(t *testing.T) {
+	if testing.Short() {
+		t.Skip("Skip demo tests in short mode")
+	}
+	testBroker.start()
+	err := runExampleWant(
+		"Received all 15 acknowledgements\n",
+		"send",
+		exampleArgs("-count", "5")...)
+	if err != nil {
+		t.Fatal(err)
+	}
+	err = runExampleWant(
+		"Listening on 3 connections\nReceived 15 messages\n",
+		"receive",
+		exampleArgs("-count", "15")...)
+	if err != nil {
+		t.Fatal(err)
+	}
+}
+
+var ready error
+
+func init() { ready = fmt.Errorf("Ready") }
+
+// Run receive in a goroutine.
+// Send ready on errchan when it is listening.
+// Send final error when it is done.
+// Returns the Cmd, caller must Wait()
+func goReceiveWant(errchan chan<- error, want string, arg ...string) *exec.Cmd {
+	cmd := exampleCommand("receive", arg...)
+	go func() {
+		pipe, err := cmd.StdoutPipe()
+		if err != nil {
+			errchan <- err
+			return
+		}
+		out := bufio.NewReader(pipe)
+		cmd.Start()
+		line, err := out.ReadString('\n')
+		if err != nil && err != io.EOF {
+			errchan <- err
+			return
+		}
+		listening := "Listening on 3 connections\n"
+		if line != listening {
+			errchan <- checkEqual(listening, line)
+			return
+		}
+		errchan <- ready
+		buf := bytes.Buffer{}
+		io.Copy(&buf, out) // Collect the rest of the output
+		errchan <- checkEqual(want, buf.String())
+		close(errchan)
+	}()
+	return cmd
+}
+
+// Start receiver first, wait till it is running, then send.
+func TestExampleReceiveSend(t *testing.T) {
+	if testing.Short() {
+		t.Skip("Skip demo tests in short mode")
+	}
+	testBroker.start()
+	recvErr := make(chan error)
+	recvCmd := goReceiveWant(recvErr,
+		"Received 15 messages\n",
+		exampleArgs("-count", "15")...)
+	defer func() {
+		recvCmd.Process.Kill()
+		recvCmd.Wait()
+	}()
+	if err := <-recvErr; err != ready { // Wait for receiver ready
+		t.Fatal(err)
+	}
+	err := runExampleWant(
+		"Received all 15 acknowledgements\n",
+		"send",
+		exampleArgs("-count", "5")...)
+	if err != nil {
+		t.Fatal(err)
+	}
+	if err := <-recvErr; err != nil {
+		t.Fatal(err)
+	}
+}
+
+func exepath(relative string) string {
+	if binDir == "" {
+		panic("bindir not set, cannot run example binaries")
+	}
+	return path.Join(binDir, relative)
+}
+
+var testBroker *broker
+var binDir, exampleDir string
+var built map[string]bool
+
+func init() {
+	built = make(map[string]bool)
+}
+
+func build(prog string) {
+	if !built[prog] {
+		args := []string{"build"}
+		if *rpath != "" {
+			args = append(args, "-ldflags", "-r "+*rpath)
+		}
+		args = append(args, path.Join(exampleDir, prog))
+		build := exec.Command("go", args...)
+		build.Dir = binDir
+		out, err := build.CombinedOutput()
+		if err != nil {
+			panic(fmt.Errorf("%v: %s", err, out))
+		}
+		built[prog] = true
+	}
+}
+
+var rpath = flag.String("rpath", "", "Runtime path for test executables")
+var debug = flag.Bool("debug", false, "Debugging output from examples")
+
+func TestMain(m *testing.M) {
+	rand.Seed(time.Now().UTC().UnixNano())
+	var err error
+	exampleDir, err = filepath.Abs(".")
+	panicIf(err)
+	binDir, err = ioutil.TempDir("", "example_test.go")
+	panicIf(err)
+	defer os.Remove(binDir) // Clean up binaries
+	testBroker = &broker{}  // Broker is started on-demand by tests.
+	testBroker.stop()
+	status := m.Run()
+	testBroker.stop()
+	os.Exit(status)
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 5985e2d..288e694 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -574,6 +574,3 @@ if (BUILD_JAVASCRIPT)
   add_test (javascript-codec ${env_py} node ${pn_test_root}/javascript/codec.js)
   add_test (javascript-message ${env_py} node ${pn_test_root}/javascript/message.js)
 endif (BUILD_JAVASCRIPT)
-
-# build examples to make sure they still work
-add_subdirectory(../examples ../examples)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
index f426ef3..e976bc7 100644
--- a/proton-c/bindings/CMakeLists.txt
+++ b/proton-c/bindings/CMakeLists.txt
@@ -109,10 +109,10 @@ if (EMSCRIPTEN_FOUND)
   set (DEFAULT_JAVASCRIPT ON)
 endif (EMSCRIPTEN_FOUND)
 
-# C++ client: very experimental.  To try, change this to "ON"
-# or provide -DBUILD_CPP=ON to CMake
-set (DEFAULT_CPP OFF)
-
+# Prerequisites for C++
+if (CMAKE_CXX_COMPILER)
+  set (DEFAULT_CPP ON)
+endif (CMAKE_CXX_COMPILER)
 
 # Shouldn't need to modify below here when adding new language binding
 foreach(BINDING ${BINDINGS})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 34123ed..f9e747c 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -17,8 +17,6 @@
 # under the License.
 #
 
-project (Proton C CXX)
-
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
 
@@ -53,21 +51,13 @@ set (qpid-proton-cpp-core
     src/Delivery.cpp
     src/Acking.cpp
     src/Transport.cpp
-    src/Logger.cpp
     src/contexts.cpp
-    src/exceptions.cpp
     src/blocking/BlockingConnection.cpp
     src/blocking/BlockingConnectionImpl.cpp
     src/blocking/BlockingLink.cpp
     src/blocking/BlockingSender.cpp
   )
 
-#set_source_files_properties (
-#  ${qpid-proton-cpp-core}
-#  PROPERTIES
-#  COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS}"
-#  )
-
 set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX)
 set_source_files_properties (
   ${qpid-proton-cpp-platform}
@@ -76,8 +66,6 @@ set_source_files_properties (
   COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
   )
 
-
-
 add_library (
   qpid-proton-cpp SHARED
 
@@ -97,20 +85,6 @@ set_target_properties (
   LINK_FLAGS "${CATCH_UNDEFINED}"
   )
 
-add_executable (HelloWorld examples/HelloWorld.cpp)
-target_link_libraries (HelloWorld qpid-proton-cpp)
-add_executable (HelloWorldDirect examples/HelloWorldDirect.cpp)
-target_link_libraries (HelloWorldDirect qpid-proton-cpp)
-add_executable (SimpleRecv examples/SimpleRecv.cpp)
-target_link_libraries (SimpleRecv qpid-proton-cpp)
-add_executable (SimpleSend examples/SimpleSend.cpp)
-target_link_libraries (SimpleSend qpid-proton-cpp)
-add_executable (Broker examples/Broker.cpp)
-target_link_libraries (Broker qpid-proton-cpp)
-add_executable (HelloWorldBlocking examples/HelloWorldBlocking.cpp)
-target_link_libraries (HelloWorldBlocking qpid-proton-cpp)
-
-
 install (TARGETS qpid-proton-cpp
   EXPORT  proton
   ARCHIVE DESTINATION ${LIB_INSTALL_DIR}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/README.md b/proton-c/bindings/cpp/README.md
new file mode 100644
index 0000000..8872211
--- /dev/null
+++ b/proton-c/bindings/cpp/README.md
@@ -0,0 +1,23 @@
+# C++ binding for proton.
+
+This is a C++ wrapper for the proton reactor API.
+It is very similar to the python wrapper for the same API.
+
+There are [examples](../../../examples/cpp/README.md) and the header files have
+API documentation in doxygen format.
+
+# TO DO
+
+There are a number of things that remain to be done.
+
+- Type mapping between AMQP and C++ types, e.g. encoding std::map as map message.
+
+- Finish blocking API & demos.
+- API documentation, HTML docs on website.
+- FIXME and TODO notes in code, esp. error handling, missing sender/receiver/connection methods.
+
+- Valgrind for automated tests and demos.
+- More automated tests and examples.
+
+- Security: SASL/SSL support.
+- Reconnection

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/Broker.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/Broker.cpp b/proton-c/bindings/cpp/examples/Broker.cpp
deleted file mode 100644
index 7d5214d..0000000
--- a/proton-c/bindings/cpp/examples/Broker.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *
- * 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/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-
-#include <iostream>
-#include <deque>
-#include <map>
-#include <list>
-
-
-using namespace proton::reactor;
-
-std::string generateUuid(){
-    throw "TODO: platform neutral uuid";
-}
-
-class Queue {
-  public:
-    bool dynamic;
-    typedef std::deque<Message> MsgQ;
-    typedef std::list<Sender> List;
-    MsgQ queue;
-    List consumers;
-
-    Queue(bool dyn = false) : dynamic(dyn), queue(MsgQ()), consumers(List()) {}
-
-    void subscribe(Sender &c) {
-        consumers.push_back(c);
-    }
-
-    bool unsubscribe(Sender &c) {
-        consumers.remove(c);
-        return (consumers.size() == 0 && (dynamic || queue.size() == 0));
-    }
-
-    void publish(Message &m) {
-        queue.push_back(m);
-        dispatch(0);
-    }
-
-    void dispatch(Sender *s) {
-        while (deliverTo(s)) {
-        }
-    }
-
-    bool deliverTo(Sender *consumer) {
-        // deliver to single consumer if supplied, else all consumers
-        int count = consumer ? 1 : consumers.size();
-        if (!count) return false;
-        bool result = false;
-        List::iterator it = consumers.begin();
-        if (!consumer && count) consumer = &*it;
-
-        while (queue.size()) {
-            if (consumer->getCredit()) {
-                consumer->send(queue.front());
-                queue.pop_front();
-                result = true;
-            }
-            if (--count)
-                it++;
-            else
-                return result;
-        }
-        return false;
-    }
-};
-
-class Broker : public MessagingHandler {
-  private:
-    std::string url;
-    typedef std::map<std::string, Queue *> QMap;
-    QMap queues;
-  public:
-
-    Broker(const std::string &s) : url(s), queues(QMap()) {}
-
-    void onStart(Event &e) {
-        e.getContainer().listen(url);
-    }
-
-    Queue &queue(std::string &address) {
-        QMap::iterator it = queues.find(address);
-        if (it == queues.end()) {
-            queues[address] = new Queue();
-            return *queues[address];
-        }
-        else {
-            return *it->second;
-        }
-    }
-
-    void onLinkOpening(Event &e) {
-        Link lnk = e.getLink();
-        if (lnk.isSender()) {
-            Sender sender(lnk);
-            Terminus remoteSource(lnk.getRemoteSource());
-            if (remoteSource.isDynamic()) {
-                std::string address = generateUuid();
-                lnk.getSource().setAddress(address);
-                Queue *q = new Queue(true);
-                queues[address] = q;
-                q->subscribe(sender);
-            }
-            else {
-                std::string address = remoteSource.getAddress();
-                if (!address.empty()) {
-                    lnk.getSource().setAddress(address);
-                    queue(address).subscribe(sender);
-                }
-            }
-        }
-        else {
-            std::string address = lnk.getRemoteTarget().getAddress();
-            if (!address.empty())
-                lnk.getTarget().setAddress(address);
-        }
-    }
-
-    void unsubscribe (Sender &lnk) {
-        std::string address = lnk.getSource().getAddress();
-        QMap::iterator it = queues.find(address);
-        if (it != queues.end() && it->second->unsubscribe(lnk)) {
-            delete it->second;
-            queues.erase(it);
-        }
-    }
-
-    void onLinkClosing(Event &e) {
-        Link lnk = e.getLink();
-        if (lnk.isSender()) {
-            Sender s(lnk);
-            unsubscribe(s);
-        }
-    }
-
-    void onConnectionClosing(Event &e) {
-        removeStaleConsumers(e.getConnection());
-    }
-
-    void onDisconnected(Event &e) {
-        removeStaleConsumers(e.getConnection());
-    }
-
-    void removeStaleConsumers(Connection &connection) {
-        Link l = connection.getLinkHead(Endpoint::REMOTE_ACTIVE);
-        while (l) {
-            if (l.isSender()) {
-                Sender s(l);
-                unsubscribe(s);
-            }
-            l = l.getNext(Endpoint::REMOTE_ACTIVE);
-        }
-    }
-
-    void onSendable(Event &e) {
-        Link lnk = e.getLink();
-        Sender sender(lnk);
-        std::string addr = lnk.getSource().getAddress();
-        queue(addr).dispatch(&sender);
-    }
-
-    void onMessage(Event &e) {
-        std::string addr = e.getLink().getTarget().getAddress();
-        Message msg = e.getMessage();
-        queue(addr).publish(msg);
-    }
-};
-
-int main(int argc, char **argv) {
-    Broker hw("localhost:5672");
-    Container(hw).run();
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/HelloWorld.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorld.cpp b/proton-c/bindings/cpp/examples/HelloWorld.cpp
deleted file mode 100644
index 1fc124b..0000000
--- a/proton-c/bindings/cpp/examples/HelloWorld.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-
-#include <iostream>
-
-
-using namespace proton::reactor;
-
-class HelloWorld : public MessagingHandler {
-  private:
-    std::string server;
-    std::string address;
-  public:
-
-    HelloWorld(const std::string &s, const std::string &addr) : server(s), address(addr) {}
-
-    void onStart(Event &e) {
-        Connection conn = e.getContainer().connect(server);
-        e.getContainer().createReceiver(conn, address);
-        e.getContainer().createSender(conn, address);
-    }
-
-    void onSendable(Event &e) {
-        Message m;
-        m.setBody("Hello World!");
-        e.getSender().send(m);
-        e.getSender().close();
-    }
-
-    void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
-        e.getConnection().close();
-    }
-
-};
-
-int main(int argc, char **argv) {
-    HelloWorld hw("localhost:5672", "examples");
-    Container(hw).run();
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp b/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
deleted file mode 100644
index a3f729c..0000000
--- a/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * 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/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/BlockingSender.h"
-
-#include <iostream>
-
-
-using namespace proton::reactor;
-
-class HelloWorldBlocking : public MessagingHandler {
-  private:
-    std::string server;
-    std::string address;
-  public:
-
-    HelloWorldBlocking(const std::string &s, const std::string &addr) : server(s), address(addr) {}
-
-    void onStart(Event &e) {
-        Connection conn = e.getContainer().connect(server);
-        e.getContainer().createReceiver(conn, address);
-    }
-
-    void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
-        e.getConnection().close();
-    }
-
-};
-
-int main(int argc, char **argv) {
-    std::string url("localhost:5672");
-    std::string addr("examples");
-    BlockingConnection conn = BlockingConnection(url);
-    BlockingSender sender = conn.createSender(addr);
-    Message m;
-    m.setBody("Hello World!");
-    sender.send(m);
-    conn.close();
-
-    // Temporary hack until blocking receiver available
-    HelloWorldBlocking hw("localhost:5672", "examples");
-    Container(hw).run();
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp b/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
deleted file mode 100644
index a695dd0..0000000
--- a/proton-c/bindings/cpp/examples/HelloWorldDirect.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * 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/cpp/MessagingHandler.h"
-#include "proton/cpp/Container.h"
-
-//#include "proton/cpp/Acceptor.h"
-#include <iostream>
-
-
-using namespace proton::reactor;
-
-
-class HelloWorldDirect : public MessagingHandler {
-  private:
-    std::string url;
-    Acceptor acceptor;
-  public:
-
-    HelloWorldDirect(const std::string &u) : url(u) {}
-
-    void onStart(Event &e) {
-        acceptor = e.getContainer().listen(url);
-        e.getContainer().createSender(url);
-    }
-
-    void onSendable(Event &e) {
-        Message m;
-        m.setBody("Hello World!");
-        e.getSender().send(m);
-        e.getSender().close();
-    }
-
-    void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
-    }
-
-    void onAccepted(Event &e) {
-        e.getConnection().close();
-    }
-
-    void onConnectionClosed(Event &e) {
-        acceptor.close();
-    }
-
-};
-
-int main(int argc, char **argv) {
-    HelloWorldDirect hwd("localhost:8888/examples");
-    Container(hwd).run();
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/SimpleRecv.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/SimpleRecv.cpp b/proton-c/bindings/cpp/examples/SimpleRecv.cpp
deleted file mode 100644
index 22778f0..0000000
--- a/proton-c/bindings/cpp/examples/SimpleRecv.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * 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/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Link.h"
-
-#include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
-using namespace proton::reactor;
-
-class Recv : public MessagingHandler {
-  private:
-    std::string url;
-    int expected;
-    int received;
-  public:
-
-    Recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
-
-    void onStart(Event &e) {
-        e.getContainer().createReceiver(url);
-    }
-
-    void onMessage(Event &e) {
-        uint64_t id = 0;
-        Message msg = e.getMessage();
-        if (msg.getIdType() == PN_ULONG) {
-            id = msg.getId();
-            if (id < received)
-                return; // ignore duplicate
-        }
-        if (expected == 0 || received < expected) {
-            std::cout << '[' << id << "]: " << msg.getBody() << std::endl;
-            received++;
-            if (received == expected) {
-                e.getReceiver().close();
-                e.getConnection().close();
-            }
-        }
-    }
-};
-
-static void parse_options(int argc, char **argv, int &count, std::string &addr);
-
-int main(int argc, char **argv) {
-    int messageCount = 100;
-    std::string address("localhost:5672/examples");
-    parse_options(argc, argv, messageCount, address);
-    Recv recv(address, messageCount);
-    Container(recv).run();
-}
-
-
-static void usage() {
-    std::cout << "Usage: SimpleRecv -m message_count -a address:" << std::endl;
-    exit (1);
-}
-
-
-static void parse_options(int argc, char **argv, int &count, std::string &addr) {
-    int c, i;
-    for (i = 1; i < argc; i++) {
-        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
-            c = argv[i][1];
-            const char *nextarg = i < argc ? argv[i+1] : NULL;
-
-            switch (c) {
-            case 'a':
-                if (!nextarg) usage();
-                addr = nextarg;
-                i++;
-                break;
-            case 'm':
-                if (!nextarg) usage();
-                unsigned newc;
-                if (sscanf( nextarg, "%d", &newc) != 1) usage();
-                count = newc;
-                i++;
-                break;
-            default:
-                usage();
-            }
-        }
-        else usage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/examples/SimpleSend.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/SimpleSend.cpp b/proton-c/bindings/cpp/examples/SimpleSend.cpp
deleted file mode 100644
index 89ca39d..0000000
--- a/proton-c/bindings/cpp/examples/SimpleSend.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * 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/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Connection.h"
-
-#include <iostream>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-
-using namespace proton::reactor;
-
-class Send : public MessagingHandler {
-  private:
-    std::string url;
-    int sent;
-    int confirmed;
-    int total;
-  public:
-
-    Send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
-
-    void onStart(Event &e) {
-        e.getContainer().createSender(url);
-    }
-
-    void onSendable(Event &e) {
-        Sender sender = e.getSender();
-        while (sender.getCredit() && sent < total) {
-            Message msg;
-            msg.setId(sent + 1);
-            // TODO: fancy map body content as in Python example.  Simple binary for now.
-            const char *bin = "some arbitrary binary data";
-            msg.setBody(bin, strlen(bin));
-            sender.send(msg);
-            sent++;
-        }
-    }
-
-    void onAccepted(Event &e) {
-        confirmed++;
-        if (confirmed == total) {
-            std::cout << "all messages confirmed" << std::endl;
-            e.getConnection().close();
-        }
-    }
-
-    void onDisconnected(Event &e) {
-        sent = confirmed;
-    }
-};
-
-static void parse_options(int argc, char **argv, int &count, std::string &addr);
-
-int main(int argc, char **argv) {
-    int messageCount = 100;
-    std::string address("localhost:5672/examples");
-    parse_options(argc, argv, messageCount, address);
-    Send send(address, messageCount);
-    Container(send).run();
-}
-
-
-static void usage() {
-    std::cout << "Usage: SimpleSend -m message_count -a address:" << std::endl;
-    exit (1);
-}
-
-
-static void parse_options(int argc, char **argv, int &count, std::string &addr) {
-    int c, i;
-    for (i = 1; i < argc; i++) {
-        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
-            c = argv[i][1];
-            const char *nextarg = i < argc ? argv[i+1] : NULL;
-
-            switch (c) {
-            case 'a':
-                if (!nextarg) usage();
-                addr = nextarg;
-                i++;
-                break;
-            case 'm':
-                if (!nextarg) usage();
-                unsigned newc;
-                if (sscanf( nextarg, "%d", &newc) != 1) usage();
-                count = newc;
-                i++;
-                break;
-            default:
-                usage();
-            }
-        }
-        else usage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
index 8171dd5..089ae1b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
@@ -24,8 +24,6 @@
 #include "proton/cpp/ImportExport.h"
 #include "proton/cpp/ProtonHandle.h"
 
-#include "ProtonImplRef.h"
-
 #include "proton/delivery.h"
 #include "proton/disposition.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
index 77b7814..2cf3f99 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
@@ -28,6 +28,7 @@ namespace proton {
 namespace reactor {
 
 template <class> class PrivateImplRef;
+template <class> class ProtonImplRef;
 
 /**
  * A handle is like a pointer: refers to an underlying implementation object.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
index 713c5c5..9fdef94 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/exceptions.h
@@ -21,34 +21,27 @@
  * under the License.
  *
  */
-#include "proton/cpp/ImportExport.h"
-#include <string>
-#include <exception>
+#include <stdexcept>
 
 namespace proton {
 namespace reactor {
 
-class ProtonException : public std::exception
+class ProtonException : public std::runtime_error
 {
   public:
-    PROTON_CPP_EXTERN explicit ProtonException(const std::string& message=std::string()) throw();
-    PROTON_CPP_EXTERN virtual ~ProtonException() throw();
-    PROTON_CPP_EXTERN virtual const char* what() const throw();
-
-  private:
-    const std::string message;
+    explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {}
 };
 
 class MessageReject : public ProtonException
 {
   public:
-    PROTON_CPP_EXTERN explicit MessageReject(const std::string& message=std::string()) throw();
+    explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
 };
 
 class MessageRelease : public ProtonException
 {
   public:
-    PROTON_CPP_EXTERN explicit MessageRelease(const std::string& message=std::string()) throw();
+    explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
 };
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/Connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.cpp b/proton-c/bindings/cpp/src/Connector.cpp
index 8ebdfb6..fc6eed3 100644
--- a/proton-c/bindings/cpp/src/Connector.cpp
+++ b/proton-c/bindings/cpp/src/Connector.cpp
@@ -27,7 +27,6 @@
 #include "Connector.h"
 #include "ConnectionImpl.h"
 #include "Url.h"
-#include "LogInternal.h"
 
 namespace proton {
 namespace reactor {
@@ -46,7 +45,6 @@ void Connector::connect() {
     Url url(address);
     std::string hostname = url.getHost() + ":" + url.getPort();
     pn_connection_set_hostname(conn, hostname.c_str());
-    PN_CPP_LOG(info, "connecting to " << hostname << "...");
     transport = new Transport();
     transport->bind(connection);
     connection.impl->transport = transport;
@@ -57,16 +55,13 @@ void Connector::onConnectionLocalOpen(Event &e) {
     connect();
 }
 
-void Connector::onConnectionRemoteOpen(Event &e) {
-    PN_CPP_LOG(info, "connected to " << e.getConnection().getHostname());
-}
+void Connector::onConnectionRemoteOpen(Event &e) {}
 
 void Connector::onConnectionInit(Event &e) {
 }
 
 void Connector::onTransportClosed(Event &e) {
     // TODO: prepend with reconnect logic
-    PN_CPP_LOG(info, "Disconnected");
     pn_connection_release(connection.impl->pnConnection);
     // No more interaction, so drop our counted reference.
     connection = Connection();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index e72f484..5a551a1 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -27,7 +27,6 @@
 #include "proton/cpp/exceptions.h"
 #include "ContainerImpl.h"
 #include "PrivateImplRef.h"
-#include "LogInternal.h"
 
 #include "Connector.h"
 #include "contexts.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 1424dbb..ce69928 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -25,8 +25,8 @@
 #include "proton/cpp/MessagingAdapter.h"
 #include "proton/cpp/Acceptor.h"
 #include "proton/cpp/exceptions.h"
-#include "LogInternal.h"
 
+#include "Msg.h"
 #include "ContainerImpl.h"
 #include "ConnectionImpl.h"
 #include "Connector.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/Delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Delivery.cpp b/proton-c/bindings/cpp/src/Delivery.cpp
index 990e394..d0b2f3c 100644
--- a/proton-c/bindings/cpp/src/Delivery.cpp
+++ b/proton-c/bindings/cpp/src/Delivery.cpp
@@ -21,6 +21,7 @@
 
 #include "proton/cpp/Delivery.h"
 #include "proton/delivery.h"
+#include "ProtonImplRef.h"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/LogInternal.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/LogInternal.h b/proton-c/bindings/cpp/src/LogInternal.h
deleted file mode 100644
index 427f90b..0000000
--- a/proton-c/bindings/cpp/src/LogInternal.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef PROTON_CPP_LOG_INTERNAL_H
-#define PROTON_CPP_LOG_INTERNAL_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 "Msg.h"
-
-namespace proton {
-namespace reactor {
-
-enum Level { trace, debug, info, notice, warning, error, critical };
-
-class Logger
-{
-public:
-    // TODO: build out to be ultra configurable as for corresponding QPID class + Statement
-    static void log(Level level, const char* file, int line, const char* function, const std::string& message);
-private:
-    //This class has only one instance so no need to copy
-    Logger();
-    ~Logger();
-
-    Logger(const Logger&);
-    Logger operator=(const Logger&);
-};
-
-// Just do simple logging for now
-#define PN_CPP_LOG(LEVEL, MESSAGE) Logger::log(LEVEL, 0, 0, 0, ::proton::reactor::Msg() << MESSAGE)
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_LOG_INTERNAL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/Logger.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Logger.cpp b/proton-c/bindings/cpp/src/Logger.cpp
deleted file mode 100644
index 2671b2e..0000000
--- a/proton-c/bindings/cpp/src/Logger.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * 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 "LogInternal.h"
-#include <cstdlib>
-
-namespace proton {
-namespace reactor {
-
-namespace {
-bool levelSet = false;
-Level logLevel = error;
-Level getLogLevel() {
-    if (!levelSet) {
-        levelSet = true;
-        const char *l = getenv("PROTON_CPP_LOG_LEVEL");
-        if (l && l[0] != 0 && l[1] == 0) {
-            char low = '0' + trace;
-            char high = '0' + critical;
-            if (*l >= low && *l <= high)
-                logLevel = (Level) (*l - '0');
-        }
-    }
-    return logLevel;
-}
-
-} // namespace
-
-
-void Logger::log(Level level, const char* file, int line, const char* function, const std::string& message)
-{
-    if (level >= getLogLevel()) {
-        std::cout << message << std::endl;
-        std::cout.flush();
-    }
-}
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6ecb0525/proton-c/bindings/cpp/src/exceptions.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/exceptions.cpp b/proton-c/bindings/cpp/src/exceptions.cpp
deleted file mode 100644
index c19e61d..0000000
--- a/proton-c/bindings/cpp/src/exceptions.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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/cpp/exceptions.h"
-
-namespace proton {
-namespace reactor {
-
-ProtonException::ProtonException(const std::string& msg) throw() : message(msg) {}
-ProtonException::~ProtonException() throw() {}
-const char* ProtonException::what() const throw() { return message.c_str(); }
-
-MessageReject::MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
-MessageRelease::MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
-
-}} // namespace proton::reactor


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


[15/50] [abbrv] qpid-proton git commit: PROTON-781: Added URLs to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added URLs to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 37956b42328a2430891517dc24ec034ad8bdc245
Parents: 2915148
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:38:04 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb  |  1 +
 proton-c/bindings/ruby/lib/reactor/urls.rb | 40 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/37956b42/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 11a555f..4f017e1 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -102,6 +102,7 @@ require "reactor/acceptor"
 require "reactor/reactor"
 require "reactor/ssl_config"
 require "reactor/global_overrides"
+require "reactor/urls"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/37956b42/proton-c/bindings/ruby/lib/reactor/urls.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/urls.rb b/proton-c/bindings/ruby/lib/reactor/urls.rb
new file mode 100644
index 0000000..8cdb16c
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/urls.rb
@@ -0,0 +1,40 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class URLs
+
+    def initialize(values)
+      @values = [values].flatten
+      @iter = @values.each
+    end
+
+    def next
+      begin
+        return @iter.next
+      rescue StopIteration
+        @iter = @values.each
+        return @iter.next
+      end
+    end
+
+  end
+
+end


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


[04/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Acking mixin to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Acking mixin to the Ruby reactive APIs.

The Acking mixin provides methods for handling the settling of messages
based on reactive callbacks.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 1798ffa4687c39e3bac1522ed16bcb9cfbf05863
Parents: ddd8c45
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Feb 25 13:27:30 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/handler/acking.rb | 70 +++++++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb    |  1 +
 2 files changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1798ffa4/proton-c/bindings/ruby/lib/handler/acking.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/acking.rb b/proton-c/bindings/ruby/lib/handler/acking.rb
new file mode 100644
index 0000000..2c94cfe
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/acking.rb
@@ -0,0 +1,70 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Handler
+
+  # Mixing that provides methods for acknowledging a delivery.
+  #
+  module Acking
+
+    # Accept the receivered message.
+    #
+    # @param delivery [Qpid::Proton::Delivery] The delivery.
+    #
+    def accept(delivery)
+      self.settle(delivery, Qpid::Proton::Delivery::ACCEPTED)
+    end
+
+    # Rejects a received message that is considered invalid or unprocessable.
+    #
+    # @param delivery [Qpid::Proton::Delivery] The delivery.
+    #
+    def reject(delivery)
+      self.settle(delivery, Qpid::Proton::Delivery::REJECTED)
+    end
+
+    # Releases a received message, making it available at the source for any
+    # other interested receiver.
+    #
+    # @param delivery [Qpid::Proton::Delivery] The delivery
+    # @param delivered [Boolean] True if this was considered a delivery
+    #   attempt.
+    #
+    def release(delivery, delivered = true)
+      if delivered
+        self.settle(delivery, Qpid::Proton::Delivery::MODIFIED)
+      else
+        self.settle(delivery, Qpid::Proton::Delivery::RELEASED)
+      end
+    end
+
+    # Settles the specified delivery. Updates the delivery state if a state
+    # is specified.
+    #
+    # @param delivery [Qpid::Proton::Delivery] The delivery.
+    # @param state [Fixnum] The delivery state.
+    #
+    def settle(delivery, state = nil)
+      delivery.update(state) unless state.nil?
+      delivery.settle
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1798ffa4/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index a4b3391..8db28f3 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -84,6 +84,7 @@ require "messenger/messenger"
 # Handler classes
 require "handler/c_adaptor"
 require "handler/wrapped_handler"
+require "handler/acking"
 
 module Qpid::Proton
   # @private


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


[46/50] [abbrv] qpid-proton git commit: PROTON-865: cpp encode/decode support for complex types.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go b/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
deleted file mode 100644
index 11049f7..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
-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.
-*/
-
-// Test that conversion of Go type to/from AMQP is compatible with other
-// bindings.
-//
-package amqp
-
-import (
-	"bytes"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"os"
-	"reflect"
-	"strings"
-	"testing"
-)
-
-func assertEqual(want interface{}, got interface{}) {
-	if !reflect.DeepEqual(want, got) {
-		panic(fmt.Errorf("%#v != %#v", want, got))
-	}
-}
-
-func assertNil(err interface{}) {
-	if err != nil {
-		panic(err)
-	}
-}
-
-func getReader(name string) (r io.Reader) {
-	r, err := os.Open("interop/" + name + ".amqp")
-	if err != nil {
-		panic(fmt.Errorf("Can't open %#v: %v", name, err))
-	}
-	return
-}
-
-func remaining(d *Decoder) string {
-	remainder, _ := ioutil.ReadAll(io.MultiReader(d.Buffered(), d.reader))
-	return string(remainder)
-}
-
-// assertDecode: want is the expected value, gotPtr is a pointer to a
-// instance of the same type for Decode.
-func assertDecode(d *Decoder, want interface{}, gotPtr interface{}) {
-
-	assertNil(d.Decode(gotPtr))
-
-	got := reflect.ValueOf(gotPtr).Elem().Interface()
-	assertEqual(want, got)
-
-	// Try round trip encoding
-	bytes, err := Marshal(want, nil)
-	assertNil(err)
-	n, err := Unmarshal(bytes, gotPtr)
-	assertNil(err)
-	assertEqual(n, len(bytes))
-	got = reflect.ValueOf(gotPtr).Elem().Interface()
-	assertEqual(want, got)
-}
-
-func TestUnmarshal(t *testing.T) {
-	bytes, err := ioutil.ReadAll(getReader("strings"))
-	if err != nil {
-		t.Error(err)
-	}
-	for _, want := range []string{"abc\000defg", "abcdefg", "abcdefg", "", "", ""} {
-		var got string
-		n, err := Unmarshal(bytes, &got)
-		if err != nil {
-			t.Error(err)
-		}
-		if want != got {
-			t.Errorf("%#v != %#v", want, got)
-		}
-		bytes = bytes[n:]
-	}
-}
-
-func TestPrimitivesExact(t *testing.T) {
-	d := NewDecoder(getReader("primitives"))
-	// Decoding into exact types
-	var b bool
-	assertDecode(d, true, &b)
-	assertDecode(d, false, &b)
-	var u8 uint8
-	assertDecode(d, uint8(42), &u8)
-	var u16 uint16
-	assertDecode(d, uint16(42), &u16)
-	var i16 int16
-	assertDecode(d, int16(-42), &i16)
-	var u32 uint32
-	assertDecode(d, uint32(12345), &u32)
-	var i32 int32
-	assertDecode(d, int32(-12345), &i32)
-	var u64 uint64
-	assertDecode(d, uint64(12345), &u64)
-	var i64 int64
-	assertDecode(d, int64(-12345), &i64)
-	var f32 float32
-	assertDecode(d, float32(0.125), &f32)
-	var f64 float64
-	assertDecode(d, float64(0.125), &f64)
-}
-
-func TestPrimitivesCompatible(t *testing.T) {
-	d := NewDecoder(getReader("primitives"))
-	// Decoding into compatible types
-	var b bool
-	var i int
-	var u uint
-	var f float64
-	assertDecode(d, true, &b)
-	assertDecode(d, false, &b)
-	assertDecode(d, uint(42), &u)
-	assertDecode(d, uint(42), &u)
-	assertDecode(d, -42, &i)
-	assertDecode(d, uint(12345), &u)
-	assertDecode(d, -12345, &i)
-	assertDecode(d, uint(12345), &u)
-	assertDecode(d, -12345, &i)
-	assertDecode(d, 0.125, &f)
-	assertDecode(d, 0.125, &f)
-}
-
-// assertDecodeValue: want is the expected value, decode into a reflect.Value
-func assertDecodeInterface(d *Decoder, want interface{}) {
-
-	var got, got2 interface{}
-	assertNil(d.Decode(&got))
-
-	assertEqual(want, got)
-
-	// Try round trip encoding
-	bytes, err := Marshal(got, nil)
-	assertNil(err)
-	n, err := Unmarshal(bytes, &got2)
-	assertNil(err)
-	assertEqual(n, len(bytes))
-	assertEqual(want, got2)
-}
-
-func TestPrimitivesInterface(t *testing.T) {
-	d := NewDecoder(getReader("primitives"))
-	assertDecodeInterface(d, true)
-	assertDecodeInterface(d, false)
-	assertDecodeInterface(d, uint8(42))
-	assertDecodeInterface(d, uint16(42))
-	assertDecodeInterface(d, int16(-42))
-	assertDecodeInterface(d, uint32(12345))
-	assertDecodeInterface(d, int32(-12345))
-	assertDecodeInterface(d, uint64(12345))
-	assertDecodeInterface(d, int64(-12345))
-	assertDecodeInterface(d, float32(0.125))
-	assertDecodeInterface(d, float64(0.125))
-}
-
-func TestStrings(t *testing.T) {
-	d := NewDecoder(getReader("strings"))
-	// Test decoding as plain Go strings
-	for _, want := range []string{"abc\000defg", "abcdefg", "abcdefg", "", "", ""} {
-		var got string
-		assertDecode(d, want, &got)
-	}
-	remains := remaining(d)
-	if remains != "" {
-		t.Errorf("leftover: %s", remains)
-	}
-
-	// Test decoding as specific string types
-	d = NewDecoder(getReader("strings"))
-	var bytes []byte
-	var str, sym string
-	assertDecode(d, []byte("abc\000defg"), &bytes)
-	assertDecode(d, "abcdefg", &str)
-	assertDecode(d, "abcdefg", &sym)
-	assertDecode(d, make([]byte, 0), &bytes)
-	assertDecode(d, "", &str)
-	assertDecode(d, "", &sym)
-	remains = remaining(d)
-	if remains != "" {
-		t.Fatalf("leftover: %s", remains)
-	}
-
-	// Test some error handling
-	d = NewDecoder(getReader("strings"))
-	var s string
-	err := d.Decode(s)
-	if err == nil {
-		t.Fatal("Expected error")
-	}
-	if !strings.Contains(err.Error(), "not a pointer") {
-		t.Error(err)
-	}
-	var i int
-	err = d.Decode(&i)
-	if !strings.Contains(err.Error(), "cannot unmarshal") {
-		t.Error(err)
-	}
-	_, err = Unmarshal([]byte{}, nil)
-	if !strings.Contains(err.Error(), "not enough data") {
-		t.Error(err)
-	}
-	_, err = Unmarshal([]byte("foobar"), nil)
-	if !strings.Contains(err.Error(), "invalid-argument") {
-		t.Error(err)
-	}
-}
-
-func TestEncodeDecode(t *testing.T) {
-	type data struct {
-		s  string
-		i  int
-		u8 uint8
-		b  bool
-		f  float32
-		v  interface{}
-	}
-
-	in := data{"foo", 42, 9, true, 1.234, "thing"}
-
-	buf := bytes.Buffer{}
-	e := NewEncoder(&buf)
-	assertNil(e.Encode(in.s))
-	assertNil(e.Encode(in.i))
-	assertNil(e.Encode(in.u8))
-	assertNil(e.Encode(in.b))
-	assertNil(e.Encode(in.f))
-	assertNil(e.Encode(in.v))
-
-	var out data
-	d := NewDecoder(&buf)
-	assertNil(d.Decode(&out.s))
-	assertNil(d.Decode(&out.i))
-	assertNil(d.Decode(&out.u8))
-	assertNil(d.Decode(&out.b))
-	assertNil(d.Decode(&out.f))
-	assertNil(d.Decode(&out.v))
-
-	assertEqual(in, out)
-}
-
-func TestMap(t *testing.T) {
-	d := NewDecoder(getReader("maps"))
-
-	// Generic map
-	var m Map
-	assertDecode(d, Map{"one": int32(1), "two": int32(2), "three": int32(3)}, &m)
-
-	// Interface as map
-	var i interface{}
-	assertDecode(d, Map{int32(1): "one", int32(2): "two", int32(3): "three"}, &i)
-
-	d = NewDecoder(getReader("maps"))
-	// Specific typed map
-	var m2 map[string]int
-	assertDecode(d, map[string]int{"one": 1, "two": 2, "three": 3}, &m2)
-
-	// Round trip a nested map
-	m = Map{int64(1): "one", "two": int32(2), true: Map{uint8(1): true, uint8(2): false}}
-	bytes, err := Marshal(m, nil)
-	assertNil(err)
-	_, err = Unmarshal(bytes, &i)
-	assertNil(err)
-	assertEqual(m, i)
-}
-
-func TestList(t *testing.T) {
-	d := NewDecoder(getReader("lists"))
-	var l List
-	assertDecode(d, List{int32(32), "foo", true}, &l)
-	assertDecode(d, List{}, &l)
-}
-
-func FIXMETestMessage(t *testing.T) {
-	// FIXME aconway 2015-04-09: integrate Message encoding under marshal/unmarshal API.
-	bytes, err := ioutil.ReadAll(getReader("message"))
-	assertNil(err)
-	m, err := DecodeMessage(bytes)
-	assertNil(err)
-	fmt.Printf("%+v\n", m)
-	assertEqual(m.Body(), "hello")
-
-	bytes2 := make([]byte, len(bytes))
-	bytes2, err = m.Encode(bytes2)
-	assertNil(err)
-	assertEqual(bytes, bytes2)
-}
-
-// FIXME aconway 2015-03-13: finish the full interop test

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/docs/api/index.md
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/index.md b/proton-c/docs/api/index.md
index 10aea84..8727d9b 100644
--- a/proton-c/docs/api/index.md
+++ b/proton-c/docs/api/index.md
@@ -1,5 +1,9 @@
 Proton Documentation            {#index}
 ====================
 
-The proton library contains two APIs: The [Engine API](@ref engine),
+The proton library contains two C APIs: The [Engine API](@ref engine),
 and the [Messenger API](@ref messenger).
+
+There is also a [C++ API](@ref cpp).
+
+@defgroup cpp C++ binding

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/docs/api/user.doxygen.in
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/user.doxygen.in b/proton-c/docs/api/user.doxygen.in
index 6288764..7c6edf7 100644
--- a/proton-c/docs/api/user.doxygen.in
+++ b/proton-c/docs/api/user.doxygen.in
@@ -642,7 +642,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT = @CMAKE_SOURCE_DIR@/proton-c/include @CMAKE_SOURCE_DIR@/proton-c/docs/api
+INPUT = @CMAKE_SOURCE_DIR@/proton-c/include @CMAKE_SOURCE_DIR@/proton-c/docs/api @CMAKE_SOURCE_DIR@/proton-c/bindings/cpp/include
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/include/proton/codec.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/codec.h b/proton-c/include/proton/codec.h
index 4c4d2c3..3ab7f8e 100644
--- a/proton-c/include/proton/codec.h
+++ b/proton-c/include/proton/codec.h
@@ -177,6 +177,9 @@ typedef enum {
   PN_MAP = 25
 } pn_type_t;
 
+/** A special invalid type value that is returned when no valid type is available. */
+extern const pn_type_t PN_INVALID;
+
 /**
  * Return a string name for an AMQP type.
  *
@@ -468,8 +471,8 @@ PN_EXTERN bool pn_data_exit(pn_data_t *data);
 PN_EXTERN bool pn_data_lookup(pn_data_t *data, const char *name);
 
 /**
- * Access the type of the current node. Returns an undefined value if
- * there is no current node.
+ * Access the type of the current node. Returns PN_INVALID if there is no
+ * current node.
  *
  * @param data a data object
  * @return the type of the current node
@@ -953,7 +956,7 @@ PN_EXTERN bool pn_data_is_array_described(pn_data_t *data);
 
 /**
  * Return the array type if the current node points to an array,
- * undefined otherwise.
+ * PN_INVALID otherwise.
  *
  * @param data a pn_data_t object
  * @return the element type of an array node

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/src/codec/codec.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c
index 573887e..29204eb 100644
--- a/proton-c/src/codec/codec.c
+++ b/proton-c/src/codec/codec.c
@@ -73,6 +73,8 @@ const char *pn_type_name(pn_type_t type)
   return "<UNKNOWN>";
 }
 
+const pn_type_t PN_INVALID = (pn_type_t) -1;
+
 static inline void pni_atom_init(pn_atom_t *atom, pn_type_t type)
 {
   memset(atom, 0, sizeof(pn_atom_t));
@@ -690,7 +692,7 @@ static bool pn_scan_next(pn_data_t *data, pn_type_t *type, bool suspend)
       pn_data_exit(data);
       return pn_scan_next(data, type, suspend);
     } else {
-      *type = (pn_type_t) -1;
+      *type = PN_INVALID;
       return false;
     }
   }
@@ -1266,7 +1268,7 @@ pn_type_t pn_data_type(pn_data_t *data)
   if (node) {
     return node->atom.type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 
@@ -1276,7 +1278,7 @@ pn_type_t pni_data_parent_type(pn_data_t *data)
   if (node) {
     return node->atom.type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 
@@ -1686,7 +1688,7 @@ pn_type_t pn_data_get_array_type(pn_data_t *data)
   if (node && node->atom.type == PN_ARRAY) {
     return node->type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/src/codec/encoder.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/encoder.c b/proton-c/src/codec/encoder.c
index 082bb21..b6651fc 100644
--- a/proton-c/src/codec/encoder.c
+++ b/proton-c/src/codec/encoder.c
@@ -250,17 +250,17 @@ static int pni_encoder_enter(void *ctx, pn_data_t *data, pni_node_t *node)
   pn_encoder_t *encoder = (pn_encoder_t *) ctx;
   pni_node_t *parent = pn_data_node(data, node->parent);
   pn_atom_t *atom = &node->atom;
-  uint8_t code;
+  uint8_t code = pn_node2code(encoder, node);
   conv_t c;
 
   /** In an array we don't write the code before each element, only the first. */
   if (pn_is_in_array(data, parent, node)) {
-    code = pn_type2code(encoder, parent->type);
-    if (pn_is_first_in_array(data, parent, node)) {
+    uint8_t array_code = pn_type2code(encoder, parent->type);
+    if (code != array_code)
+        return pn_error_format(data->error, PN_ERR, "array element type mismatch");
+    if (pn_is_first_in_array(data, parent, node))
       pn_encoder_writef8(encoder, code);
-    }
   } else {
-    code = pn_node2code(encoder, node);
     pn_encoder_writef8(encoder, code);
   }
 


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


[17/50] [abbrv] qpid-proton git commit: PROTON-781: Added Connector to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added Connector to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: bee80bd507d6990768f6c9f6ad11f3f641444201
Parents: 37956b4
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:38:47 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 proton-c/bindings/ruby/lib/reactor/connector.rb | 98 ++++++++++++++++++++
 2 files changed, 99 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bee80bd5/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 4f017e1..6047613 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -103,6 +103,7 @@ require "reactor/reactor"
 require "reactor/ssl_config"
 require "reactor/global_overrides"
 require "reactor/urls"
+require "reactor/connector"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bee80bd5/proton-c/bindings/ruby/lib/reactor/connector.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/connector.rb b/proton-c/bindings/ruby/lib/reactor/connector.rb
new file mode 100644
index 0000000..a6523db
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/connector.rb
@@ -0,0 +1,98 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class Connector < Qpid::Proton::BaseHandler
+
+    attr_accessor :address
+    attr_accessor :reconnect
+    attr_accessor :ssl_domain
+
+    def initialize(connection)
+      @connection = connection
+      @address = nil
+      @heartbeat = nil
+      @reconnect = nil
+      @ssl_domain = nil
+    end
+
+    def on_connection_local_open(event)
+      self.connect(event.connection)
+    end
+
+    def on_connection_remote_open(event)
+      if !@reconnect.nil?
+        @reconnect.reset
+        @transport = nil
+      end
+    end
+
+    def on_transport_tail_closed(event)
+      self.on_transport_closed(event)
+    end
+
+    def on_transport_closed(event)
+      if !@connection.nil? && !(@connection.state & Qpid::Proton::Endpoint::LOCAL_ACTIVE).zero?
+        if !@reconnect.nil?
+          event.transport.unbind
+          delay = @reconnect.next
+          if delay == 0
+            self.connect(@connection)
+          else
+            event.reactor.schedule(delay, self)
+          end
+        else
+          @connection = nil
+        end
+      end
+    end
+
+    def on_timer_task(event)
+      self.connect(@connection)
+    end
+
+    def on_connection_remote_close(event)
+      @connection = nil
+    end
+
+    def connect(connection)
+      url = @address.next
+      connection.hostname = "#{url.host}:#{url.port}"
+
+      transport = Qpid::Proton::Transport.new
+      transport.bind(connection)
+      if !@heartbeat.nil?
+        transport.idle_timeout = @heartbeat
+      elsif (url.scheme == "amqps") && !@ssl_domain.nil?
+        @ssl = Qpid::Proton::SSL.new(transport, @ssl_domain)
+        @ss.peer_hostname = url.host
+      elsif !url.username.nil?
+        sasl = transport.sasl
+        if url.username == "anonymous"
+          sasl.mechanisms("ANONYMOUS")
+        else
+          sasl.plain(url.username, url.password)
+        end
+      end
+    end
+
+  end
+
+end


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


[09/50] [abbrv] qpid-proton git commit: PROTON-781: Added SSLConfig to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added SSLConfig to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 6f30e8b445ed769344dc79a7c863227e5f4c460d
Parents: ebb14ba
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 26 11:28:04 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 .../bindings/ruby/lib/reactor/ssl_config.rb     | 41 ++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6f30e8b4/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index f8703e7..d8783bc 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -96,6 +96,7 @@ require "handler/messaging_handler"
 require "reactor/task"
 require "reactor/acceptor"
 require "reactor/reactor"
+require "reactor/ssl_config"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6f30e8b4/proton-c/bindings/ruby/lib/reactor/ssl_config.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/ssl_config.rb b/proton-c/bindings/ruby/lib/reactor/ssl_config.rb
new file mode 100644
index 0000000..56fec71
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/ssl_config.rb
@@ -0,0 +1,41 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class SSLConfig
+
+    def initialize
+      @client = Qpid::Proton::SSLDomain.new(Qpid::Proton::SSLDomain::MODE_CLIENT)
+      @server = Qpid::Proton::SSLDomain.new(Qpid::Proton::SSLDomain::MODE_SERVER)
+    end
+
+    def set_credentials(cert_file, key_file, password)
+      @client.set_credentials(cert_file, key_file, password)
+      @server.set_credentials(cert_file, key_file, password)
+    end
+
+    def set_trusted_ca_db(certificate_db)
+      @client.set_trusted_ca_db(certificate_db)
+      @server.set_trusted_ca_db(certificate_db)
+    end
+
+  end
+
+end


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


[19/50] [abbrv] qpid-proton git commit: PROTON-781: Ruby registry and memory management testing

Posted by ac...@apache.org.
PROTON-781: Ruby registry and memory management testing


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

Branch: refs/heads/cjansen-cpp-client
Commit: 6a77ab509bbe28cd5cf9f640fbf2d2222288ff58
Parents: 56bf2c2
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Fri May 8 10:54:13 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 examples/ruby/registry_test.rb | 76 +++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6a77ab50/examples/ruby/registry_test.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/registry_test.rb b/examples/ruby/registry_test.rb
new file mode 100644
index 0000000..b4b1f6c
--- /dev/null
+++ b/examples/ruby/registry_test.rb
@@ -0,0 +1,76 @@
+#--
+# 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.
+#++
+
+require 'qpid_proton'
+require 'weakref'
+
+def show_registry(registry)
+  registry.each_pair do |key, value|
+    registry.delete(key) if value.weakref_alive?
+  end
+  puts "The contents of the registry: size=#{registry.size}"
+end
+
+def show_object_count(clazz)
+  puts "There are #{ObjectSpace.each_object(clazz).count} instances of #{clazz}."
+end
+
+impl = Cproton.pn_transport
+implclazz = impl.class
+transport = Qpid::Proton::Transport.wrap(impl)
+
+puts "Initial setup:"
+show_object_count(Qpid::Proton::Transport)
+show_object_count(implclazz)
+
+transport = nil
+
+show_registry(Qpid::Proton.registry)
+
+ObjectSpace.garbage_collect
+
+puts "After garbage collection:"
+show_object_count(Qpid::Proton::Transport)
+show_object_count(implclazz)
+
+MAXCOUNT=100000
+(1..MAXCOUNT).each do |which|
+  nimpl = Cproton.pn_transport
+  Cproton.pn_incref(nimpl)
+  transport = Qpid::Proton::Transport.wrap(nimpl)
+  transport = Qpid::Proton::Transport.wrap(nimpl)
+end
+
+transport = nil
+
+puts "After creating #{MAXCOUNT} instances"
+show_object_count(Qpid::Proton::Transport)
+show_object_count(implclazz)
+show_registry(Qpid::Proton.registry)
+
+ObjectSpace.garbage_collect
+
+transport = Qpid::Proton::Transport.wrap(impl)
+
+puts "After garbage collection:"
+puts "impl=#{impl}"
+puts "transport=#{transport}"
+show_object_count(Qpid::Proton::Transport)
+show_object_count(implclazz)
+show_registry(Qpid::Proton.registry)


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


[02/50] [abbrv] qpid-proton git commit: PROTON-781: Deleted the Ruby Filter mixin.

Posted by ac...@apache.org.
PROTON-781: Deleted the Ruby Filter mixin.

It was only used by Selectable, which is being refactored based on the
new underlying C Selectable type.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 5d062e789074d9fbc70a0248ffe3e8faa8aafd51
Parents: aa486b2
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Tue Feb 24 10:55:25 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/messenger/filters.rb | 64 --------------------
 .../bindings/ruby/lib/messenger/selectable.rb   |  6 --
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 -
 3 files changed, 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d062e78/proton-c/bindings/ruby/lib/messenger/filters.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/messenger/filters.rb b/proton-c/bindings/ruby/lib/messenger/filters.rb
deleted file mode 100644
index 0ab3407..0000000
--- a/proton-c/bindings/ruby/lib/messenger/filters.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-#--
-# 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.
-#++
-
-module Qpid::Proton::Messenger
-
-  # @private
-  module Filters
-
-    def self.included(base)
-      base.class_eval do
-        extend ClassMethods
-      end
-    end
-
-    module ClassMethods
-
-      def method_added(method_name)
-        @@hooked_methods ||= []
-        return if @@hooked_methods.include?(method_name)
-        @@hooked_methods << method_name
-        hooks = @@before_hooks[method_name]
-        return if hooks.nil?
-        orig_method = instance_method(method_name)
-        define_method(method_name) do |*args, &block|
-          hooks = @@before_hooks[method_name]
-          hooks.each do |hook|
-            method(hook).call
-          end
-
-          orig_method.bind(self).call(*args, &block)
-        end
-      end
-
-      def call_before(before_method, *methods)
-        @@before_hooks ||= {}
-        methods.each do |method|
-          hooks = @@before_hooks[method] || []
-          raise "Repeat filter: #{before_method}" if hooks.include? before_method
-          hooks << before_method
-          @@before_hooks[method] = hooks
-        end
-      end
-
-    end
-
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d062e78/proton-c/bindings/ruby/lib/messenger/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/messenger/selectable.rb b/proton-c/bindings/ruby/lib/messenger/selectable.rb
index ec5174f..da1a3d5 100644
--- a/proton-c/bindings/ruby/lib/messenger/selectable.rb
+++ b/proton-c/bindings/ruby/lib/messenger/selectable.rb
@@ -25,12 +25,6 @@ module Qpid::Proton::Messenger
   # @private
   class Selectable
 
-    include Filters
-
-    call_before :check_is_initialized,
-                :fileno, :capacity, :pending, :deadline,
-                :readable, :writable, :expired,
-                :registered=, :registered?
 
     def initialize(messenger, impl) # :nodoc:
       @messenger = messenger

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d062e78/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 2791538..21f96a1 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -75,7 +75,6 @@ require "core/ssl"
 require "core/transport"
 
 # Messenger API classes
-require "messenger/filters"
 require "messenger/subscription"
 require "messenger/tracker_status"
 require "messenger/tracker"


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


[31/50] [abbrv] qpid-proton git commit: PROTON-865: Use .hpp extension for C++ headers.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Msg.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Msg.h b/proton-c/bindings/cpp/src/Msg.h
deleted file mode 100644
index 2b4c6da..0000000
--- a/proton-c/bindings/cpp/src/Msg.h
+++ /dev/null
@@ -1,59 +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 {
-namespace reactor {
-
-/** A simple wrapper 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::reactor::Msg() << message)
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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
new file mode 100644
index 0000000..2b4c6da
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Msg.hpp
@@ -0,0 +1,59 @@
+#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 {
+namespace reactor {
+
+/** A simple wrapper 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::reactor::Msg() << message)
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/PrivateImplRef.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/PrivateImplRef.h b/proton-c/bindings/cpp/src/PrivateImplRef.h
deleted file mode 100644
index a2dccc2..0000000
--- a/proton-c/bindings/cpp/src/PrivateImplRef.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef PROTON_CPP_PRIVATEIMPL_H
-#define PROTON_CPP_PRIVATEIMPL_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/cpp/ImportExport.h"
-
-namespace proton {
-namespace reactor {
-
-// Modified from qpid::messaging version to work without
-// boost::intrusive_ptr but integrate with Proton's pn_class_t
-// reference counting.  Thread safety currently absent but fluid in
-// intention...
-
-
-/**
- * Helper class to implement a class with a private, reference counted
- * implementation and reference semantics.
- *
- * Such classes are used in the public API to hide implementation, they
- * should. Example of use:
- *
- * === Foo.h
- *
- * template <class T> PrivateImplRef;
- * class FooImpl;
- *
- * Foo : public Handle<FooImpl> {
- *  public:
- *   Foo(FooImpl* = 0);
- *   Foo(const Foo&);
- *   ~Foo();
- *   Foo& operator=(const Foo&);
- *
- *   int fooDo();              //  and other Foo functions...
- *
- *  private:
- *   typedef FooImpl Impl;
- *   Impl* impl;
- *   friend class PrivateImplRef<Foo>;
- *
- * === Foo.cpp
- *
- * typedef PrivateImplRef<Foo> PI;
- * Foo::Foo(FooImpl* p) { PI::ctor(*this, p); }
- * Foo::Foo(const Foo& c) : Handle<FooImpl>() { PI::copy(*this, c); }
- * Foo::~Foo() { PI::dtor(*this); }
- * Foo& Foo::operator=(const Foo& c) { return PI::assign(*this, c); }
- *
- * int foo::fooDo() { return impl->fooDo(); }
- *
- */
-template <class T> class PrivateImplRef {
-  public:
-    typedef typename T::Impl Impl;
-
-    /** Get the implementation pointer from a handle */
-    static Impl* get(const T& t) { return t.impl; }
-
-    /** Set the implementation pointer in a handle */
-    static void set(T& t, const Impl* p) {
-        if (t.impl == p) return;
-        if (t.impl) Impl::decref(t.impl);
-        t.impl = const_cast<Impl *>(p);
-        if (t.impl) Impl::incref(t.impl);
-    }
-
-    // Helper functions to implement the ctor, dtor, copy, assign
-    static void ctor(T& t, Impl* p) { t.impl = p; if (p) Impl::incref(p); }
-    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
-    static void dtor(T& t) { if(t.impl) Impl::decref(t.impl); }
-    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PRIVATEIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/PrivateImplRef.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/PrivateImplRef.hpp b/proton-c/bindings/cpp/src/PrivateImplRef.hpp
new file mode 100644
index 0000000..494fef0
--- /dev/null
+++ b/proton-c/bindings/cpp/src/PrivateImplRef.hpp
@@ -0,0 +1,97 @@
+#ifndef PROTON_CPP_PRIVATEIMPL_H
+#define PROTON_CPP_PRIVATEIMPL_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/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+// Modified from qpid::messaging version to work without
+// boost::intrusive_ptr but integrate with Proton's pn_class_t
+// reference counting.  Thread safety currently absent but fluid in
+// intention...
+
+
+/**
+ * Helper class to implement a class with a private, reference counted
+ * implementation and reference semantics.
+ *
+ * Such classes are used in the public API to hide implementation, they
+ * should. Example of use:
+ *
+ * === Foo.h
+ *
+ * template <class T> PrivateImplRef;
+ * class FooImpl;
+ *
+ * Foo : public Handle<FooImpl> {
+ *  public:
+ *   Foo(FooImpl* = 0);
+ *   Foo(const Foo&);
+ *   ~Foo();
+ *   Foo& operator=(const Foo&);
+ *
+ *   int fooDo();              //  and other Foo functions...
+ *
+ *  private:
+ *   typedef FooImpl Impl;
+ *   Impl* impl;
+ *   friend class PrivateImplRef<Foo>;
+ *
+ * === Foo.cpp
+ *
+ * typedef PrivateImplRef<Foo> PI;
+ * Foo::Foo(FooImpl* p) { PI::ctor(*this, p); }
+ * Foo::Foo(const Foo& c) : Handle<FooImpl>() { PI::copy(*this, c); }
+ * Foo::~Foo() { PI::dtor(*this); }
+ * Foo& Foo::operator=(const Foo& c) { return PI::assign(*this, c); }
+ *
+ * int foo::fooDo() { return impl->fooDo(); }
+ *
+ */
+template <class T> class PrivateImplRef {
+  public:
+    typedef typename T::Impl Impl;
+
+    /** Get the implementation pointer from a handle */
+    static Impl* get(const T& t) { return t.impl; }
+
+    /** Set the implementation pointer in a handle */
+    static void set(T& t, const Impl* p) {
+        if (t.impl == p) return;
+        if (t.impl) Impl::decref(t.impl);
+        t.impl = const_cast<Impl *>(p);
+        if (t.impl) Impl::incref(t.impl);
+    }
+
+    // Helper functions to implement the ctor, dtor, copy, assign
+    static void ctor(T& t, Impl* p) { t.impl = p; if (p) Impl::incref(p); }
+    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+    static void dtor(T& t) { if(t.impl) Impl::decref(t.impl); }
+    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PRIVATEIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ProtonEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonEvent.cpp b/proton-c/bindings/cpp/src/ProtonEvent.cpp
index 0b0f1d0..4567ea7 100644
--- a/proton-c/bindings/cpp/src/ProtonEvent.cpp
+++ b/proton-c/bindings/cpp/src/ProtonEvent.cpp
@@ -23,14 +23,14 @@
 #include "proton/event.h"
 #include "proton/link.h"
 
-#include "proton/cpp/ProtonEvent.h"
-#include "proton/cpp/ProtonHandler.h"
-#include "proton/cpp/exceptions.h"
-#include "proton/cpp/Container.h"
-
-#include "ConnectionImpl.h"
-#include "Msg.h"
-#include "contexts.h"
+#include "proton/ProtonEvent.hpp"
+#include "proton/ProtonHandler.hpp"
+#include "proton/exceptions.hpp"
+#include "proton/Container.hpp"
+
+#include "ConnectionImpl.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ProtonHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonHandler.cpp b/proton-c/bindings/cpp/src/ProtonHandler.cpp
index f96f5a6..d4705d5 100644
--- a/proton-c/bindings/cpp/src/ProtonHandler.cpp
+++ b/proton-c/bindings/cpp/src/ProtonHandler.cpp
@@ -18,8 +18,8 @@
  * under the License.
  *
  */
-#include "proton/cpp/ProtonHandler.h"
-#include "proton/cpp/ProtonEvent.h"
+#include "proton/ProtonHandler.hpp"
+#include "proton/ProtonEvent.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ProtonImplRef.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonImplRef.h b/proton-c/bindings/cpp/src/ProtonImplRef.h
deleted file mode 100644
index 8f9f360..0000000
--- a/proton-c/bindings/cpp/src/ProtonImplRef.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef PROTON_CPP_PROTONIMPL_H
-#define PROTON_CPP_PROTONIMPL_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/cpp/ImportExport.h"
-#include "proton/object.h"
-
-namespace proton {
-namespace reactor {
-
-// Modified from qpid::messaging version to work without
-// boost::intrusive_ptr but integrate with Proton's pn_class_t
-// reference counting.  Thread safety currently absent but fluid in
-// intention...
-
-
-/**
- * See PrivateImplRef.h  This is for lightly wrapped Proton pn_object_t targets.
- * class Foo : ProtonHandle<pn_foo_t> {...}
- */
-
-template <class T> class ProtonImplRef {
-  public:
-    typedef typename T::Impl Impl;
-
-    /** Get the implementation pointer from a handle */
-    static Impl* get(const T& t) { return t.impl; }
-
-    /** Set the implementation pointer in a handle */
-    static void set(T& t, const Impl* p) {
-        if (t.impl == p) return;
-        if (t.impl) pn_decref(t.impl);
-        t.impl = const_cast<Impl *>(p);
-        if (t.impl) pn_incref(t.impl);
-    }
-
-    // Helper functions to implement the ctor, dtor, copy, assign
-    static void ctor(T& t, Impl* p) { t.impl = p; if (p) pn_incref(p); }
-    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
-    static void dtor(T& t) { if(t.impl) pn_decref(t.impl); }
-    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PROTONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/ProtonImplRef.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonImplRef.hpp b/proton-c/bindings/cpp/src/ProtonImplRef.hpp
new file mode 100644
index 0000000..8621dc8
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ProtonImplRef.hpp
@@ -0,0 +1,66 @@
+#ifndef PROTON_CPP_PROTONIMPL_H
+#define PROTON_CPP_PROTONIMPL_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/ImportExport.hpp"
+#include "proton/object.h"
+
+namespace proton {
+namespace reactor {
+
+// Modified from qpid::messaging version to work without
+// boost::intrusive_ptr but integrate with Proton's pn_class_t
+// reference counting.  Thread safety currently absent but fluid in
+// intention...
+
+
+/**
+ * See PrivateImplRef.h  This is for lightly wrapped Proton pn_object_t targets.
+ * class Foo : ProtonHandle<pn_foo_t> {...}
+ */
+
+template <class T> class ProtonImplRef {
+  public:
+    typedef typename T::Impl Impl;
+
+    /** Get the implementation pointer from a handle */
+    static Impl* get(const T& t) { return t.impl; }
+
+    /** Set the implementation pointer in a handle */
+    static void set(T& t, const Impl* p) {
+        if (t.impl == p) return;
+        if (t.impl) pn_decref(t.impl);
+        t.impl = const_cast<Impl *>(p);
+        if (t.impl) pn_incref(t.impl);
+    }
+
+    // Helper functions to implement the ctor, dtor, copy, assign
+    static void ctor(T& t, Impl* p) { t.impl = p; if (p) pn_incref(p); }
+    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+    static void dtor(T& t) { if(t.impl) pn_decref(t.impl); }
+    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Receiver.cpp b/proton-c/bindings/cpp/src/Receiver.cpp
index ad9a6d1..d148372 100644
--- a/proton-c/bindings/cpp/src/Receiver.cpp
+++ b/proton-c/bindings/cpp/src/Receiver.cpp
@@ -18,10 +18,10 @@
  * under the License.
  *
  */
-#include "proton/cpp/Link.h"
-#include "proton/cpp/Receiver.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
+#include "proton/Link.hpp"
+#include "proton/Receiver.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
index c8f962e..8c2e414 100644
--- a/proton-c/bindings/cpp/src/Sender.cpp
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -18,11 +18,11 @@
  * under the License.
  *
  */
-#include "proton/cpp/Link.h"
-#include "proton/cpp/Sender.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
-#include "contexts.h"
+#include "proton/Link.hpp"
+#include "proton/Sender.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Session.cpp b/proton-c/bindings/cpp/src/Session.cpp
index 4333dcf..57f788e 100644
--- a/proton-c/bindings/cpp/src/Session.cpp
+++ b/proton-c/bindings/cpp/src/Session.cpp
@@ -18,14 +18,14 @@
  * under the License.
  *
  */
-#include "proton/cpp/Session.h"
-#include "contexts.h"
+#include "proton/Session.hpp"
+#include "contexts.hpp"
 
 #include "proton/connection.h"
 #include "proton/session.h"
-#include "proton/cpp/Session.h"
-#include "proton/cpp/Connection.h"
-#include "ConnectionImpl.h"
+#include "proton/Session.hpp"
+#include "proton/Connection.hpp"
+#include "ConnectionImpl.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Terminus.cpp b/proton-c/bindings/cpp/src/Terminus.cpp
index f66979e..0022805 100644
--- a/proton-c/bindings/cpp/src/Terminus.cpp
+++ b/proton-c/bindings/cpp/src/Terminus.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "proton/cpp/Link.h"
+#include "proton/Link.hpp"
 #include "proton/link.h"
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Transport.cpp b/proton-c/bindings/cpp/src/Transport.cpp
index 91eb8d9..98f03f5 100644
--- a/proton-c/bindings/cpp/src/Transport.cpp
+++ b/proton-c/bindings/cpp/src/Transport.cpp
@@ -18,8 +18,8 @@
  * under the License.
  *
  */
-#include "proton/cpp/Transport.h"
-#include "proton/cpp/Connection.h"
+#include "proton/Transport.hpp"
+#include "proton/Connection.hpp"
 
 #include "proton/transport.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Url.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.cpp b/proton-c/bindings/cpp/src/Url.cpp
index 058bd2f..80020fb 100644
--- a/proton-c/bindings/cpp/src/Url.cpp
+++ b/proton-c/bindings/cpp/src/Url.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "proton/cpp/exceptions.h"
-#include "Url.h"
-#include "ProtonImplRef.h"
-#include "Msg.h"
+#include "proton/exceptions.hpp"
+#include "Url.hpp"
+#include "ProtonImplRef.hpp"
+#include "Msg.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Url.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.h b/proton-c/bindings/cpp/src/Url.h
deleted file mode 100644
index d9651fc..0000000
--- a/proton-c/bindings/cpp/src/Url.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef PROTON_CPP_URL_H
-#define PROTON_CPP_URL_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/cpp/ImportExport.h"
-#include "proton/cpp/ProtonHandle.h"
-#include "proton/url.h"
-#include <string>
-
-namespace proton {
-namespace reactor {
-
-class Url : public ProtonHandle<pn_url_t>
-{
-  public:
-    PN_CPP_EXTERN Url(const std::string &url);
-    PN_CPP_EXTERN ~Url();
-    PN_CPP_EXTERN Url(const Url&);
-    PN_CPP_EXTERN Url& operator=(const Url&);
-    PN_CPP_EXTERN std::string getHost();
-    PN_CPP_EXTERN std::string getPort();
-    PN_CPP_EXTERN std::string getPath();
-  private:
-    friend class ProtonImplRef<Url>;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_URL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Url.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.hpp b/proton-c/bindings/cpp/src/Url.hpp
new file mode 100644
index 0000000..5dfb79e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Url.hpp
@@ -0,0 +1,49 @@
+#ifndef PROTON_CPP_URL_H
+#define PROTON_CPP_URL_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/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/url.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class Url : public ProtonHandle<pn_url_t>
+{
+  public:
+    PN_CPP_EXTERN Url(const std::string &url);
+    PN_CPP_EXTERN ~Url();
+    PN_CPP_EXTERN Url(const Url&);
+    PN_CPP_EXTERN Url& operator=(const Url&);
+    PN_CPP_EXTERN std::string getHost();
+    PN_CPP_EXTERN std::string getPort();
+    PN_CPP_EXTERN std::string getPath();
+  private:
+    friend class ProtonImplRef<Url>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_URL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Value.cpp b/proton-c/bindings/cpp/src/Value.cpp
index b488481..6d0a55c 100644
--- a/proton-c/bindings/cpp/src/Value.cpp
+++ b/proton-c/bindings/cpp/src/Value.cpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include "proton/cpp/Value.h"
-#include "proton_bits.h"
+#include "proton/Value.hpp"
+#include "proton_bits.hpp"
 #include <proton/codec.h>
 #include <ostream>
 #include <algorithm>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/Values.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Values.cpp b/proton-c/bindings/cpp/src/Values.cpp
index 20fb9f1..fadfacf 100644
--- a/proton-c/bindings/cpp/src/Values.cpp
+++ b/proton-c/bindings/cpp/src/Values.cpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include "proton/cpp/Value.h"
-#include "proton_bits.h"
+#include "proton/Value.hpp"
+#include "proton_bits.hpp"
 #include <proton/codec.h>
 #include <ostream>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
index 3fb6010..95499d6 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
@@ -18,14 +18,14 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/BlockingConnection.h"
-#include "proton/cpp/BlockingSender.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
-#include "BlockingConnectionImpl.h"
-#include "PrivateImplRef.h"
+#include "proton/Container.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/BlockingSender.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
+#include "BlockingConnectionImpl.hpp"
+#include "PrivateImplRef.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
index bdda697..7bb1261 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
@@ -18,14 +18,14 @@
  * under the License.
  *
  */
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Duration.h"
-#include "proton/cpp/exceptions.h"
-#include "proton/cpp/WaitCondition.h"
-#include "BlockingConnectionImpl.h"
-#include "Msg.h"
-#include "contexts.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Duration.hpp"
+#include "proton/exceptions.hpp"
+#include "proton/WaitCondition.hpp"
+#include "BlockingConnectionImpl.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
 
 #include "proton/connection.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
deleted file mode 100644
index 6adb65e..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef PROTON_CPP_CONNECTIONIMPL_H
-#define PROTON_CPP_CONNECTIONIMPL_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/cpp/ImportExport.h"
-#include "proton/cpp/Endpoint.h"
-#include "proton/cpp/Container.h"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Container;
-class SslDomain;
-
- class BlockingConnectionImpl : public MessagingHandler
-{
-  public:
-    PN_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
-    PN_CPP_EXTERN ~BlockingConnectionImpl();
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN void wait(WaitCondition &condition);
-    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
-    PN_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
-    Duration getTimeout() { return timeout; }
-    static void incref(BlockingConnectionImpl *);
-    static void decref(BlockingConnectionImpl *);
-  private:
-    friend class BlockingConnection;
-    Container container;
-    Connection connection;
-    std::string url;
-    Duration timeout;
-    int refCount;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
new file mode 100644
index 0000000..989a317
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_CONNECTIONIMPL_H
+#define PROTON_CPP_CONNECTIONIMPL_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/ImportExport.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class SslDomain;
+
+ class BlockingConnectionImpl : public MessagingHandler
+{
+  public:
+    PN_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
+    PN_CPP_EXTERN ~BlockingConnectionImpl();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN void wait(WaitCondition &condition);
+    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
+    PN_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
+    Duration getTimeout() { return timeout; }
+    static void incref(BlockingConnectionImpl *);
+    static void decref(BlockingConnectionImpl *);
+  private:
+    friend class BlockingConnection;
+    Container container;
+    Connection connection;
+    std::string url;
+    Duration timeout;
+    int refCount;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
index 5a572ae..9dfc844 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
@@ -18,12 +18,12 @@
  * under the License.
  *
  */
-#include "proton/cpp/BlockingLink.h"
-#include "proton/cpp/BlockingConnection.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/WaitCondition.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
+#include "proton/BlockingLink.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/WaitCondition.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
 
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
index dc6b9bd..ac37477 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
@@ -18,11 +18,11 @@
  * under the License.
  *
  */
-#include "proton/cpp/BlockingSender.h"
-#include "proton/cpp/BlockingConnection.h"
-#include "proton/cpp/WaitCondition.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
+#include "proton/BlockingSender.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/WaitCondition.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
 
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
index 56483ff..28f4778 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "contexts.h"
-#include "proton/cpp/exceptions.h"
-#include "Msg.h"
+#include "contexts.hpp"
+#include "proton/exceptions.hpp"
+#include "Msg.hpp"
 #include "proton/object.h"
 #include "proton/message.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/contexts.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.h b/proton-c/bindings/cpp/src/contexts.h
deleted file mode 100644
index e1b5f24..0000000
--- a/proton-c/bindings/cpp/src/contexts.h
+++ /dev/null
@@ -1,52 +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/reactor.h"
-#include "proton/connection.h"
-#include "proton/message.h"
-
-namespace proton {
-namespace reactor {
-
-class ConnectionImpl;
-void setConnectionContext(pn_connection_t *pnConnection, ConnectionImpl *connection);
-ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection);
-
-class Session;
-void setSessionContext(pn_session_t *pnSession, Session *session);
-Session *getSessionContext(pn_session_t *pnSession);
-
-class Link;
-void setLinkContext(pn_link_t *pnLink, Link *link);
-Link *getLinkContext(pn_link_t *pnLink);
-
-class ContainerImpl;
-void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container);
-ContainerImpl *getContainerContext(pn_reactor_t *pnReactor);
-
-void setEventContext(pn_event_t *pnEvent, pn_message_t *m);
-pn_message_t *getEventContext(pn_event_t *pnEvent);
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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
new file mode 100644
index 0000000..e1b5f24
--- /dev/null
+++ b/proton-c/bindings/cpp/src/contexts.hpp
@@ -0,0 +1,52 @@
+#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/reactor.h"
+#include "proton/connection.h"
+#include "proton/message.h"
+
+namespace proton {
+namespace reactor {
+
+class ConnectionImpl;
+void setConnectionContext(pn_connection_t *pnConnection, ConnectionImpl *connection);
+ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection);
+
+class Session;
+void setSessionContext(pn_session_t *pnSession, Session *session);
+Session *getSessionContext(pn_session_t *pnSession);
+
+class Link;
+void setLinkContext(pn_link_t *pnLink, Link *link);
+Link *getLinkContext(pn_link_t *pnLink);
+
+class ContainerImpl;
+void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container);
+ContainerImpl *getContainerContext(pn_reactor_t *pnReactor);
+
+void setEventContext(pn_event_t *pnEvent, pn_message_t *m);
+pn_message_t *getEventContext(pn_event_t *pnEvent);
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index d7bef51..122e983 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-#include "proton/cpp/Decoder.h"
-#include "proton/cpp/Encoder.h"
-#include "proton/cpp/Value.h"
-#include "./Msg.h"
+#include "proton/Decoder.hpp"
+#include "proton/Encoder.hpp"
+#include "proton/Value.hpp"
+#include "Msg.hpp"
 #include <stdexcept>
 #include <string>
 #include <sstream>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/proton_bits.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp
index 10f7c59..6a85b1d 100644
--- a/proton-c/bindings/cpp/src/proton_bits.cpp
+++ b/proton-c/bindings/cpp/src/proton_bits.cpp
@@ -21,7 +21,7 @@
 #include <ostream>
 #include <proton/error.h>
 #include <proton/object.h>
-#include "proton_bits.h"
+#include "proton_bits.hpp"
 
 std::string errorStr(int code) {
   switch (code)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/proton_bits.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.h b/proton-c/bindings/cpp/src/proton_bits.h
deleted file mode 100644
index e57f188..0000000
--- a/proton-c/bindings/cpp/src/proton_bits.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_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 <iosfwd>
-#include <proton/error.h>
-
-/**@file
- *
- * Assorted internal proton utilities.
- */
-
-std::string errorStr(int code);
-
-/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
-std::string errorStr(pn_error_t*, int code=0);
-
-/** Wrapper for a proton object pointer. */
-struct Object { void* value; Object(void* o) : value(o) {} };
-
-/** Stream a proton object via pn_inspect. */
-std::ostream& operator<<(std::ostream& o, const Object& object);
-
-
-
-
-#endif // ERROR_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/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
new file mode 100644
index 0000000..e57f188
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -0,0 +1,44 @@
+#ifndef ERROR_H
+#define ERROR_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 <iosfwd>
+#include <proton/error.h>
+
+/**@file
+ *
+ * Assorted internal proton utilities.
+ */
+
+std::string errorStr(int code);
+
+/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
+std::string errorStr(pn_error_t*, int code=0);
+
+/** Wrapper for a proton object pointer. */
+struct Object { void* value; Object(void* o) : value(o) {} };
+
+/** Stream a proton object via pn_inspect. */
+std::ostream& operator<<(std::ostream& o, const Object& object);
+
+
+
+
+#endif // ERROR_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
index 4f2c6ac..1998b97 100644
--- a/proton-c/bindings/cpp/src/types.cpp
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-#include "proton/cpp/types.h"
+#include "proton/types.hpp"
 #include <proton/codec.h>
 #include <ostream>
 


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


[16/50] [abbrv] qpid-proton git commit: PROTON-781: Added the URL class to the Ruby core APIs.

Posted by ac...@apache.org.
PROTON-781: Added the URL class to the Ruby core APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 29151486c1dfebda79bb6ad977e354dc46948da7
Parents: 6774347
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:36:39 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/url.rb    | 77 ++++++++++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb |  1 +
 2 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/29151486/proton-c/bindings/ruby/lib/core/url.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/url.rb b/proton-c/bindings/ruby/lib/core/url.rb
new file mode 100644
index 0000000..a68811a
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/core/url.rb
@@ -0,0 +1,77 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton
+
+  class URL
+
+    attr_reader :scheme
+    attr_reader :username
+    attr_reader :password
+    attr_reader :host
+    attr_reader :port
+    attr_reader :path
+
+    def initialize(url = nil, options = {})
+      options[:defaults] = true
+
+      if url
+        @url = Cproton.pn_url_parse(url)
+        if @url.nil?
+          raise ArgumentError.new("invalid url: #{url}")
+        end
+      else
+        @url = Cproton.pn_url
+      end
+      @scheme = Cproton.pn_url_get_scheme(@url)
+      @username = Cproton.pn_url_get_username(@url)
+      @password = Cproton.pn_url_get_password(@url)
+      @host = Cproton.pn_url_get_host(@url)
+      @port = Cproton.pn_url_get_port(@url)
+      @path = Cproton.pn_url_get_path(@url)
+      defaults
+    end
+
+    def port=(port)
+      if port.nil?
+        Cproton.pn_url_set_port(@url, nil)
+      else
+        Cproton.pn_url_set_port(@url, port)
+      end
+    end
+
+    def port
+      Cproton.pn_url_get_port(@url).to_i
+    end
+
+    def to_s
+      "#{@scheme}://#{@username.nil? ? '' : @username}#{@password.nil? ? '' : '@' + @password + ':'}#{@host}:#{@port}/#{@path}"
+    end
+
+    private
+
+    def defaults
+      @scheme = @scheme || "ampq"
+      @host = @host || "0.0.0.0"
+      @port = @port || 5672
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/29151486/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 33fe9b6..11a555f 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -78,6 +78,7 @@ require "core/ssl_details"
 require "core/ssl"
 require "core/transport"
 require "core/base_handler"
+require "core/url"
 
 # Messenger API classes
 require "messenger/subscription"


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


[38/50] [abbrv] qpid-proton git commit: PROTON-865: Stream like Encoder/Decoder and AMQP Value type for C++ binding.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
index 65a6651..c0d2d12 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.h
+++ b/proton-c/bindings/cpp/src/ContainerImpl.h
@@ -41,20 +41,20 @@ class Acceptor;
 class ContainerImpl
 {
   public:
-    PROTON_CPP_EXTERN ContainerImpl(Handler &h);
-    PROTON_CPP_EXTERN ContainerImpl();
-    PROTON_CPP_EXTERN ~ContainerImpl();
-    PROTON_CPP_EXTERN Connection connect(std::string &host, Handler *h);
-    PROTON_CPP_EXTERN void run();
-    PROTON_CPP_EXTERN pn_reactor_t *getReactor();
-    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h);
-    PROTON_CPP_EXTERN Sender createSender(std::string &url);
-    PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
-    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
-    PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
-    PROTON_CPP_EXTERN std::string getContainerId();
-    PROTON_CPP_EXTERN Duration getTimeout();
-    PROTON_CPP_EXTERN void setTimeout(Duration timeout);
+    PN_CPP_EXTERN ContainerImpl(Handler &h);
+    PN_CPP_EXTERN ContainerImpl();
+    PN_CPP_EXTERN ~ContainerImpl();
+    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h);
+    PN_CPP_EXTERN void run();
+    PN_CPP_EXTERN pn_reactor_t *getReactor();
+    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h);
+    PN_CPP_EXTERN Sender createSender(std::string &url);
+    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+    PN_CPP_EXTERN Acceptor listen(const std::string &url);
+    PN_CPP_EXTERN std::string getContainerId();
+    PN_CPP_EXTERN Duration getTimeout();
+    PN_CPP_EXTERN void setTimeout(Duration timeout);
     void start();
     bool process();
     void stop();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Data.cpp b/proton-c/bindings/cpp/src/Data.cpp
new file mode 100644
index 0000000..6cfc09b
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Data.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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/cpp/Data.h"
+#include <proton/codec.h>
+#include "proton_bits.h"
+
+namespace proton {
+namespace reactor {
+
+Data::Data(pn_data_t* p) : data(p ? p : pn_data(0)) {}
+
+Data::~Data() { if (data) pn_data_free(data); }
+
+Data& Data::operator=(const Data& x) {
+    if (this != &x) {
+        pn_data_free(data);
+        data = pn_data(pn_data_size(x.data));
+        pn_data_copy(data, x.data);
+    }
+    return *this;
+}
+
+void Data::clear() { pn_data_clear(data); }
+
+bool Data::empty() const { return pn_data_size(data) == 0; }
+
+std::ostream& operator<<(std::ostream& o, const Data& d) {
+    o << Object(d.data);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp
new file mode 100644
index 0000000..4170378
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Decoder.cpp
@@ -0,0 +1,265 @@
+/*
+ * 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/cpp/Decoder.h"
+#include <proton/codec.h>
+#include "proton_bits.h"
+
+namespace proton {
+namespace reactor {
+
+
+/**@file
+ *
+ * Note the pn_data_t "current" node is always pointing *before* the next value
+ * to be returned by the Decoder.
+ *
+ */
+Decoder::Decoder() {}
+Decoder::Decoder(const char* buffer, size_t size) { decode(buffer, size); }
+Decoder::Decoder(const std::string& buffer) { decode(buffer); }
+Decoder::~Decoder() {}
+
+namespace {
+struct SaveState {
+    pn_data_t* data;
+    pn_handle_t handle;
+    SaveState(pn_data_t* d) : data(d), handle(pn_data_point(d)) {}
+    ~SaveState() { if (data) pn_data_restore(data, handle); }
+    void cancel() { data = 0; }
+};
+}
+
+void Decoder::decode(const char* i, size_t size) {
+    SaveState ss(data);
+    const char* end = i + size;
+    while (i < end) {
+        int result = pn_data_decode(data, i, end - i);
+        if (result < 0) throw Decoder::Error("decode: " + errorStr(result));
+        i += result;
+    }
+}
+
+void Decoder::decode(const std::string& buffer) {
+    decode(buffer.data(), buffer.size());
+}
+
+bool Decoder::more() const {
+    SaveState ss(data);
+    return pn_data_next(data);
+}
+
+namespace {
+
+void badType(TypeId want, TypeId got) {
+    if (want != got)
+        throw Decoder::Error("decode: expected "+typeName(want)+" found "+typeName(got));
+}
+
+TypeId preGet(pn_data_t* data) {
+    if (!pn_data_next(data)) throw Decoder::Error("decode: no more data");
+    TypeId t = TypeId(pn_data_type(data));
+    if (t < 0) throw Decoder::Error("decode: invalid data");
+    return t;
+}
+
+// Simple extract with no type conversion.
+template <class T, class U> void extract(pn_data_t* data, T& value, U (*get)(pn_data_t*)) {
+    SaveState ss(data);
+    badType(TypeIdOf<T>::value, preGet(data));
+    value = get(data);
+    ss.cancel();                // No error, no rewind
+}
+
+}
+
+TypeId Decoder::type() const {
+    SaveState ss(data);
+    return preGet(data);
+}
+
+Decoder& operator>>(Decoder& d, Bool& value) {
+    extract(d.data, value, pn_data_get_bool);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Ubyte& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case UBYTE: value = pn_data_get_ubyte(d.data); break;
+      default: badType(UBYTE, TypeId(TypeId(pn_data_type(d.data))));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Byte& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case BYTE: value = pn_data_get_ubyte(d.data); break;
+      default: badType(BYTE, TypeId(TypeId(pn_data_type(d.data))));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Ushort& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case UBYTE: value = pn_data_get_ubyte(d.data); break;
+      case USHORT: value = pn_data_get_ushort(d.data); break;
+      default: badType(USHORT, TypeId(TypeId(pn_data_type(d.data))));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Short& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case BYTE: value = pn_data_get_byte(d.data); break;
+      case SHORT: value = pn_data_get_short(d.data); break;
+      default: badType(SHORT, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Uint& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case UBYTE: value = pn_data_get_ubyte(d.data); break;
+      case USHORT: value = pn_data_get_ushort(d.data); break;
+      case UINT: value = pn_data_get_uint(d.data); break;
+      default: badType(UINT, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Int& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case BYTE: value = pn_data_get_byte(d.data); break;
+      case SHORT: value = pn_data_get_short(d.data); break;
+      case INT: value = pn_data_get_int(d.data); break;
+      default: badType(INT, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Ulong& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case UBYTE: value = pn_data_get_ubyte(d.data); break;
+      case USHORT: value = pn_data_get_ushort(d.data); break;
+      case UINT: value = pn_data_get_uint(d.data); break;
+      case ULONG: value = pn_data_get_ulong(d.data); break;
+      default: badType(ULONG, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Long& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case BYTE: value = pn_data_get_byte(d.data); break;
+      case SHORT: value = pn_data_get_short(d.data); break;
+      case INT: value = pn_data_get_int(d.data); break;
+      case LONG: value = pn_data_get_long(d.data); break;
+      default: badType(LONG, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Char& value) {
+    extract(d.data, value, pn_data_get_char);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Timestamp& value) {
+    extract(d.data, value, pn_data_get_timestamp);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Float& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case FLOAT: value = pn_data_get_float(d.data); break;
+      case DOUBLE: value = pn_data_get_double(d.data); break;
+      default: badType(FLOAT, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Double& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case FLOAT: value = pn_data_get_float(d.data); break;
+      case DOUBLE: value = pn_data_get_double(d.data); break;
+      default: badType(DOUBLE, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+// TODO aconway 2015-06-11: decimal conversions.
+Decoder& operator>>(Decoder& d, Decimal32& value) {
+    extract(d.data, value, pn_data_get_decimal32);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Decimal64& value) {
+    extract(d.data, value, pn_data_get_decimal64);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Decimal128& value)  {
+    extract(d.data, value, pn_data_get_decimal128);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Uuid& value)  {
+    extract(d.data, value, pn_data_get_uuid);
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, std::string& value) {
+    SaveState ss(d.data);
+    switch (preGet(d.data)) {
+      case STRING: value = str(pn_data_get_string(d.data)); break;
+      case BINARY: value = str(pn_data_get_binary(d.data)); break;
+      case SYMBOL: value = str(pn_data_get_symbol(d.data)); break;
+      default: badType(STRING, TypeId(pn_data_type(d.data)));
+    }
+    ss.cancel();
+    return d;
+}
+
+void Decoder::checkType(TypeId want) {
+    TypeId got = type();
+    if (want != got) badType(want, got);
+}
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp
new file mode 100644
index 0000000..81fa365
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Encoder.cpp
@@ -0,0 +1,104 @@
+/*
+ * 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/cpp/Encoder.h"
+#include <proton/codec.h>
+#include "proton_bits.h"
+
+namespace proton {
+namespace reactor {
+
+Encoder::Encoder() {}
+Encoder::~Encoder() {}
+
+namespace {
+struct SaveState {
+    pn_data_t* data;
+    pn_handle_t handle;
+    SaveState(pn_data_t* d) : data(d), handle(pn_data_point(d)) {}
+    ~SaveState() { if (data) pn_data_restore(data, handle); }
+};
+
+template <class T> T check(T result) {
+    if (result < 0)
+        throw Encoder::Error("encode: " + errorStr(result));
+    return result;
+}
+}
+
+bool Encoder::encode(char* buffer, size_t& size) {
+    SaveState ss(data);               // In case of error
+    pn_data_rewind(data);
+    ssize_t result = pn_data_encode(data, buffer, size);
+    if (result == PN_OVERFLOW) {
+        size = pn_data_encoded_size(data);
+        return false;
+    }
+    check(result);
+    size = result;
+    ss.data = 0;                // Don't restore state, all is well.
+    pn_data_clear(data);
+}
+
+void Encoder::encode(std::string& s) {
+    size_t size = s.size();
+    if (!encode(&s[0], size)) {
+        s.resize(size);
+        encode(&s[0], size);
+    }
+}
+
+std::string Encoder::encode() {
+    std::string s;
+    encode(s);
+    return s;
+}
+
+namespace {
+template <class T, class U>
+Encoder& insert(Encoder& e, pn_data_t* data, T& value, int (*put)(pn_data_t*, U)) {
+    SaveState ss(data);         // Save state in case of error.
+    check(put(data, value));
+    ss.data = 0;                // Don't restore state, all is good.
+    return e;
+}
+}
+
+Encoder& operator<<(Encoder& e, Bool value) { return insert(e, e.data, value, pn_data_put_bool); }
+Encoder& operator<<(Encoder& e, Ubyte value) { return insert(e, e.data, value, pn_data_put_ubyte); }
+Encoder& operator<<(Encoder& e, Byte value) { return insert(e, e.data, value, pn_data_put_byte); }
+Encoder& operator<<(Encoder& e, Ushort value) { return insert(e, e.data, value, pn_data_put_ushort); }
+Encoder& operator<<(Encoder& e, Short value) { return insert(e, e.data, value, pn_data_put_short); }
+Encoder& operator<<(Encoder& e, Uint value) { return insert(e, e.data, value, pn_data_put_uint); }
+Encoder& operator<<(Encoder& e, Int value) { return insert(e, e.data, value, pn_data_put_int); }
+Encoder& operator<<(Encoder& e, Char value) { return insert(e, e.data, value, pn_data_put_char); }
+Encoder& operator<<(Encoder& e, Ulong value) { return insert(e, e.data, value, pn_data_put_ulong); }
+Encoder& operator<<(Encoder& e, Long value) { return insert(e, e.data, value, pn_data_put_long); }
+Encoder& operator<<(Encoder& e, Timestamp value) { return insert(e, e.data, value, pn_data_put_timestamp); }
+Encoder& operator<<(Encoder& e, Float value) { return insert(e, e.data, value, pn_data_put_float); }
+Encoder& operator<<(Encoder& e, Double value) { return insert(e, e.data, value, pn_data_put_double); }
+Encoder& operator<<(Encoder& e, Decimal32 value) { return insert(e, e.data, value, pn_data_put_decimal32); }
+Encoder& operator<<(Encoder& e, Decimal64 value) { return insert(e, e.data, value, pn_data_put_decimal64); }
+Encoder& operator<<(Encoder& e, Decimal128 value) { return insert(e, e.data, value, pn_data_put_decimal128); }
+Encoder& operator<<(Encoder& e, Uuid value) { return insert(e, e.data, value, pn_data_put_uuid); }
+Encoder& operator<<(Encoder& e, String value) { return insert(e, e.data, value, pn_data_put_string); }
+Encoder& operator<<(Encoder& e, Symbol value) { return insert(e, e.data, value, pn_data_put_symbol); }
+Encoder& operator<<(Encoder& e, Binary value) { return insert(e, e.data, value, pn_data_put_binary); }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Msg.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Msg.h b/proton-c/bindings/cpp/src/Msg.h
index 1168d35..cd8f9e8 100644
--- a/proton-c/bindings/cpp/src/Msg.h
+++ b/proton-c/bindings/cpp/src/Msg.h
@@ -72,7 +72,7 @@ inline std::ostream& operator<<(std::ostream& o, const Msg& m) {
 /** Construct a message using operator << and append (file:line) */
 #define QUOTE_(x) #x
 #define QUOTE(x) QUOTE_(x)
-#define MSG(message) (::proton::reactor::Msg() << message << " (" __FILE__ ":" QUOTE(__LINE__) ")")
+#define MSG(message) (::proton::reactor::Msg() << message)
 
 }} // namespace proton::reactor
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Url.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.h b/proton-c/bindings/cpp/src/Url.h
index 042ab45..d9651fc 100644
--- a/proton-c/bindings/cpp/src/Url.h
+++ b/proton-c/bindings/cpp/src/Url.h
@@ -32,13 +32,13 @@ namespace reactor {
 class Url : public ProtonHandle<pn_url_t>
 {
   public:
-    PROTON_CPP_EXTERN Url(const std::string &url);
-    PROTON_CPP_EXTERN ~Url();
-    PROTON_CPP_EXTERN Url(const Url&);
-    PROTON_CPP_EXTERN Url& operator=(const Url&);
-    PROTON_CPP_EXTERN std::string getHost();
-    PROTON_CPP_EXTERN std::string getPort();
-    PROTON_CPP_EXTERN std::string getPath();
+    PN_CPP_EXTERN Url(const std::string &url);
+    PN_CPP_EXTERN ~Url();
+    PN_CPP_EXTERN Url(const Url&);
+    PN_CPP_EXTERN Url& operator=(const Url&);
+    PN_CPP_EXTERN std::string getHost();
+    PN_CPP_EXTERN std::string getPort();
+    PN_CPP_EXTERN std::string getPath();
   private:
     friend class ProtonImplRef<Url>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/Value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Value.cpp b/proton-c/bindings/cpp/src/Value.cpp
new file mode 100644
index 0000000..8e1e38c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Value.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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/cpp/Value.h"
+#include "proton_bits.h"
+#include <proton/codec.h>
+#include <ostream>
+
+namespace proton {
+namespace reactor {
+
+Values::Values() {}
+Values::Values(const Values& v) { *this = v; }
+Values::~Values() {}
+Values& Values::operator=(const Values& v) { Data::operator=(v); }
+
+void Values::rewind() { pn_data_rewind(data); }
+
+Value::Value() {}
+Value::Value(const Value& v) { *this = v; }
+Value::~Value() {}
+Value& Value::operator=(const Value& v) { values = v.values; }
+
+TypeId Value::type() const {
+    const_cast<Values&>(values).rewind();
+    return values.type();
+}
+
+namespace {
+template <class T> T check(T result) {
+    if (result < 0)
+        throw Encoder::Error("encode: " + errorStr(result));
+    return result;
+}
+}
+
+Encoder& operator<<(Encoder& e, const Value& v) {
+    if (e.data == v.values.data) throw Encoder::Error("Values inserted into self");
+    pn_data_narrow(e.data);
+    int result = pn_data_appendn(e.data, v.values.data, 1);
+    pn_data_widen(e.data);
+    check(result);
+    return e;
+}
+
+Decoder& operator>>(Decoder& e, Value& v) {
+    if (e.data == v.values.data) throw Decoder::Error("Values extracted from self");
+    pn_data_narrow(e.data);
+    int result = pn_data_appendn(e.data, v.values.data, 1);
+    pn_data_widen(e.data);
+    check(result);
+    return e;
+}
+
+}}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
index 5f263ab..6adb65e 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
@@ -39,12 +39,12 @@ class SslDomain;
  class BlockingConnectionImpl : public MessagingHandler
 {
   public:
-    PROTON_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
-    PROTON_CPP_EXTERN ~BlockingConnectionImpl();
-    PROTON_CPP_EXTERN void close();
-    PROTON_CPP_EXTERN void wait(WaitCondition &condition);
-    PROTON_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
-    PROTON_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
+    PN_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
+    PN_CPP_EXTERN ~BlockingConnectionImpl();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN void wait(WaitCondition &condition);
+    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
+    PN_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
     Duration getTimeout() { return timeout; }
     static void incref(BlockingConnectionImpl *);
     static void decref(BlockingConnectionImpl *);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/grep
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/grep b/proton-c/bindings/cpp/src/grep
new file mode 100644
index 0000000..a53cfb8
--- /dev/null
+++ b/proton-c/bindings/cpp/src/grep
@@ -0,0 +1,50 @@
+  /home/aconway/proton/proton-c/bindings/cpp/src:
+  total used in directory 256 available 122608224
+  drwxrwxr-x. 3 aconway aconway  4096 Jun 11 14:47 .
+  drwxrwxr-x. 4 aconway aconway  4096 Jun 11 14:48 ..
+  -rw-rw-r--. 1 aconway aconway  1478 Jun 10 08:40 Acceptor.cpp
+  -rw-rw-r--. 1 aconway aconway  1401 Jun 10 08:40 Acking.cpp
+  -rw-rw-r--. 1 aconway aconway  1295 Jun 11 14:45 proton_bits.cpp
+  -rw-rw-r--. 1 aconway aconway   915 Jun 11 14:44 proton_bits.h
+  drwxrwxr-x. 2 aconway aconway  4096 Jun 10 08:40 blocking
+  -rw-rw-r--. 1 aconway aconway  2390 Jun 10 08:40 Connection.cpp
+  -rw-rw-r--. 1 aconway aconway  4285 Jun 10 08:40 ConnectionImpl.cpp
+  -rw-rw-r--. 1 aconway aconway  2531 Jun 10 08:40 ConnectionImpl.h
+  -rw-rw-r--. 1 aconway aconway  2131 Jun 10 08:40 Connector.cpp
+  -rw-rw-r--. 1 aconway aconway  1624 Jun 10 08:40 Connector.h
+  -rw-rw-r--. 1 aconway aconway  3188 Jun 10 08:40 Container.cpp
+  -rw-rw-r--. 1 aconway aconway 12183 Jun 10 08:40 ContainerImpl.cpp
+  -rw-rw-r--. 1 aconway aconway  2689 Jun 10 08:40 ContainerImpl.h
+  -rw-rw-r--. 1 aconway aconway  2846 Jun 10 08:40 contexts.cpp
+  -rw-rw-r--. 1 aconway aconway  1764 Jun 10 08:40 contexts.h
+  -rw-rw-r--. 1 aconway aconway  4992 Jun 11 14:45 Data.cpp
+  -rw-rw-r--. 1 aconway aconway  4494 Jun 11 14:46 Decoder.cpp
+  -rw-rw-r--. 1 aconway aconway  1590 Jun 10 08:40 Delivery.cpp
+  -rw-rw-r--. 1 aconway aconway  1752 Jun 10 08:40 Duration.cpp
+  -rw-rw-r--. 1 aconway aconway  3933 Jun 11 14:47 Encoder.cpp
+  -rw-rw-r--. 1 aconway aconway  1125 Jun 10 08:40 Endpoint.cpp
+  -rw-rw-r--. 1 aconway aconway  1882 Jun 10 08:40 Event.cpp
+  -rw-rw-r--. 1 aconway aconway  1315 Jun 10 08:40 Handler.cpp
+  -rw-rw-r--. 1 aconway aconway  4220 Jun 11 11:13 interop_test.cpp
+  -rw-rw-r--. 1 aconway aconway  2821 Jun 10 08:40 Link.cpp
+  -rw-rw-r--. 1 aconway aconway 13358 Jun 10 08:40 Message.cpp
+  -rw-rw-r--. 1 aconway aconway 13424 Jun 10 08:40 MessagingAdapter.cpp
+  -rw-rw-r--. 1 aconway aconway  5864 Jun 10 08:40 MessagingEvent.cpp
+  -rw-rw-r--. 1 aconway aconway  5230 Jun 10 08:40 MessagingHandler.cpp
+  -rw-rw-r--. 1 aconway aconway  2587 Jun 10 08:40 Msg.h
+  -rw-rw-r--. 1 aconway aconway  2208 Jun 10 08:40 platform.cpp
+  -rw-rw-r--. 1 aconway aconway  1145 Jun 10 08:40 platform.h
+  -rw-rw-r--. 1 aconway aconway  1072 Jun 11 11:49 pn_data.h
+  -rw-rw-r--. 1 aconway aconway  3000 Jun 10 08:40 PrivateImplRef.h
+  -rw-rw-r--. 1 aconway aconway  6032 Jun 10 08:40 ProtonEvent.cpp
+  -rw-rw-r--. 1 aconway aconway  3818 Jun 10 08:40 ProtonHandler.cpp
+  -rw-rw-r--. 1 aconway aconway  2209 Jun 10 08:40 ProtonImplRef.h
+  -rw-rw-r--. 1 aconway aconway  1396 Jun 10 08:40 Receiver.cpp
+  -rw-rw-r--. 1 aconway aconway  2119 Jun 10 08:40 Sender.cpp
+  -rw-rw-r--. 1 aconway aconway  2031 Jun 10 08:40 Session.cpp
+  -rw-rw-r--. 1 aconway aconway  2850 Jun 10 08:40 Terminus.cpp
+  -rw-rw-r--. 1 aconway aconway  1234 Jun 10 08:40 Transport.cpp
+  -rw-rw-r--. 1 aconway aconway  6251 Jun 10 18:27 types.cpp
+  -rw-rw-r--. 1 aconway aconway  1942 Jun 10 08:40 Url.cpp
+  -rw-rw-r--. 1 aconway aconway  1469 Jun 10 08:40 Url.h
+  -rw-rw-r--. 1 aconway aconway  2211 Jun 11 14:47 Value.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
new file mode 100644
index 0000000..b344553
--- /dev/null
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -0,0 +1,147 @@
+/*
+ * 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/cpp/Decoder.h"
+#include "proton/cpp/Encoder.h"
+#include "proton/cpp/Value.h"
+#include "./Msg.h"
+#include <stdexcept>
+#include <string>
+#include <sstream>
+#include <fstream>
+#include <streambuf>
+#include <iosfwd>
+#include <unistd.h>
+
+using namespace std;
+using namespace proton::reactor;
+
+std::string testsDir;
+
+struct Fail : public logic_error { Fail(const string& what) : logic_error(what) {} };
+#define FAIL(WHAT) throw Fail(MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT))
+#define ASSERT(TEST) do { if (!(TEST)) FAIL("assert failed: " << #TEST); } while(false)
+#define ASSERT_EQUAL(WANT, GOT) if ((WANT) != (GOT)) \
+        FAIL(#WANT << " !=  " << #GOT << ": " << WANT << " != " << GOT)
+
+
+string read(string filename) {
+    filename = testsDir+"/interop/"+filename+".amqp";
+    ifstream ifs(filename.c_str());
+    if (!ifs.good()) FAIL("Can't open " << filename);
+    return string(istreambuf_iterator<char>(ifs), istreambuf_iterator<char>());
+}
+
+template <class T> T get(Decoder& d) {
+    T value;
+    d >> exact(value);
+    return value;
+}
+
+template <class T> std::string str(const T& value) {
+    ostringstream oss;
+    oss << value;
+    return oss.str();
+}
+
+// Test Data ostream operator
+void testDataOstream() {
+    Decoder d(read("primitives"));
+    ASSERT_EQUAL("true, false, 42, 42, -42, 12345, -12345, 12345, -12345, 0.125, 0.125", str(d));
+}
+
+// Test extracting to exact AMQP types works corectly, extrating to invalid types fails.
+void testDecoderPrimitvesExact() {
+    Decoder d(read("primitives"));
+    ASSERT(d.more());
+    try { get<int8_t>(d); FAIL("got bool as byte"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(true, get<bool>(d));
+    ASSERT_EQUAL(false, get<bool>(d));
+    try { get<int8_t>(d); FAIL("got ubyte as byte"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(42, get<uint8_t>(d));
+    try { get<int32_t>(d); FAIL("got uint as ushort"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(42, get<uint16_t>(d));
+    try { get<uint16_t>(d); FAIL("got short as ushort"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(-42, get<int16_t>(d));
+    ASSERT_EQUAL(12345, get<uint32_t>(d));
+    ASSERT_EQUAL(-12345, get<int32_t>(d));
+    ASSERT_EQUAL(12345, get<uint64_t>(d));
+    ASSERT_EQUAL(-12345, get<int64_t>(d));
+    try { get<double>(d); FAIL("got float as double"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(0.125, get<float>(d));
+    try { get<float>(d); FAIL("got double as float"); } catch(Decoder::Error){}
+    ASSERT_EQUAL(0.125, get<double>(d));
+    ASSERT(!d.more());
+}
+
+// Test inserting primitive sand encoding as AMQP.
+void testEncoderPrimitives() {
+    Encoder e;
+    e << true << false;
+    e << uint8_t(42);
+    e << uint16_t(42) << int16_t(-42);
+    e << uint32_t(12345) << int32_t(-12345);
+    e << uint64_t(12345) << int64_t(-12345);
+    e << float(0.125) << double(0.125);
+    ASSERT_EQUAL("true, false, 42, 42, -42, 12345, -12345, 12345, -12345, 0.125, 0.125", str(e));
+    std::string data = e.encode();
+    ASSERT_EQUAL(read("primitives"), data);
+}
+
+// Test type conversions.
+void testValueConversions() {
+    Value v;
+    ASSERT_EQUAL(true, bool(v = true));
+    ASSERT_EQUAL(2, int(v=Byte(2)));
+    ASSERT_EQUAL(3, long(v=Byte(3)));
+    ASSERT_EQUAL(3, long(v=Byte(3)));
+    ASSERT_EQUAL(1.0, double(v=Float(1.0)));
+    ASSERT_EQUAL(1.0, float(v=Double(1.0)));
+    try { bool(v = Byte(1)); FAIL("got byte as bool"); } catch (Decoder::Error) {}
+    try { float(v = true); FAIL("got bool as float"); } catch (Decoder::Error) {}
+}
+
+int run_test(void (*testfn)(), const char* name) {
+    try {
+        testfn();
+        return 0;
+    } catch(const Fail& e) {
+        cout << "FAIL " << name << endl << e.what();
+    } catch(const std::exception& e) {
+        cout << "ERROR " << name << endl << e.what();
+    }
+    return 1;
+}
+
+// FIXME aconway 2015-06-11: not testing all types.
+
+#define RUN_TEST(T) run_test(&T, #T)
+
+int main(int argc, char** argv) {
+    int failed = 0;
+    char buf[1024];
+    if (argc != 2) FAIL("Usage: " << argv[0] << " tests-dir" << " IN " << getcwd(buf, sizeof(buf)));
+    testsDir = argv[1];
+
+    failed += RUN_TEST(testDataOstream);
+    failed += RUN_TEST(testDecoderPrimitvesExact);
+    failed += RUN_TEST(testEncoderPrimitives);
+    failed += RUN_TEST(testValueConversions);
+    return failed;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/platform.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/platform.cpp b/proton-c/bindings/cpp/src/platform.cpp
index 4eac408..80e3d51 100644
--- a/proton-c/bindings/cpp/src/platform.cpp
+++ b/proton-c/bindings/cpp/src/platform.cpp
@@ -22,6 +22,8 @@
 #include "platform.h"
 #include <string>
 
+// FIXME aconway 2015-06-09: probably don't need UUIDs in the binding.
+
 // Copy neccesary platform neutral functionality from Proton-C
 // TODO: make this sensibly maintainable (even though it is mostly static)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/pn_data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/pn_data.h b/proton-c/bindings/cpp/src/pn_data.h
new file mode 100644
index 0000000..371d82c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/pn_data.h
@@ -0,0 +1,30 @@
+#ifndef PN_DATA_H
+#define PN_DATA_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.
+ */
+
+// Some routines for handling pn_data_t
+
+std::ostream& operator<<(std::ostream& o, const Value& v) {
+    pn_string_t* str = pn_string("");
+    pn_inspect(v.data, str);
+    return o << pn_string_get(str);
+}
+
+#endif // PN_DATA_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/proton_bits.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp
new file mode 100644
index 0000000..2e96430
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_bits.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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 <string>
+#include <ostream>
+#include <proton/error.h>
+#include <proton/object.h>
+#include "proton_bits.h"
+
+std::string errorStr(int code) {
+  switch (code)
+  {
+  case 0: return "ok";
+  case PN_EOS: return "end of data stream";
+  case PN_ERR: return "error";
+  case PN_OVERFLOW: return "overflow";
+  case PN_UNDERFLOW: return "underflow";
+  case PN_STATE_ERR: return "invalid state";
+  case PN_ARG_ERR: return "invalud argument";
+  case PN_TIMEOUT: return "timeout";
+  case PN_INTR: return "interrupt";
+  default: return "unknown error code";
+  }
+}
+
+std::ostream& operator<<(std::ostream& o, const Object& object) {
+    pn_string_t* str = pn_string("");
+    pn_inspect(object.value, str);
+    o << pn_string_get(str);
+    pn_free(str);
+    return o;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/proton_bits.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.h b/proton-c/bindings/cpp/src/proton_bits.h
new file mode 100644
index 0000000..a905172
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_bits.h
@@ -0,0 +1,39 @@
+#ifndef ERROR_H
+#define ERROR_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 <iosfwd>
+
+/**@file
+ *
+ * Assorted internal proton utilities.
+ */
+std::string errorStr(int code);
+
+/** Wrapper for a proton object pointer. */
+struct Object { void* value; Object(void* o) : value(o) {} };
+
+/** Stream a proton object via pn_inspect. */
+std::ostream& operator<<(std::ostream& o, const Object& object);
+
+
+
+
+#endif // ERROR_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
new file mode 100644
index 0000000..127ee7d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -0,0 +1,82 @@
+/*
+ * 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/cpp/types.h"
+#include <proton/codec.h>
+
+namespace proton {
+namespace reactor {
+
+const TypeId TypeIdOf<Null>::value = NULL_;
+const TypeId TypeIdOf<Bool>::value = BOOL;
+const TypeId TypeIdOf<Ubyte>::value = UBYTE;
+const TypeId TypeIdOf<Byte>::value = BYTE;
+const TypeId TypeIdOf<Ushort>::value = USHORT;
+const TypeId TypeIdOf<Short>::value = SHORT;
+const TypeId TypeIdOf<Uint>::value = UINT;
+const TypeId TypeIdOf<Int>::value = INT;
+const TypeId TypeIdOf<Char>::value = CHAR;
+const TypeId TypeIdOf<Ulong>::value = ULONG;
+const TypeId TypeIdOf<Long>::value = LONG;
+const TypeId TypeIdOf<Timestamp>::value = TIMESTAMP;
+const TypeId TypeIdOf<Float>::value = FLOAT;
+const TypeId TypeIdOf<Double>::value = DOUBLE;
+const TypeId TypeIdOf<Decimal32>::value = DECIMAL32;
+const TypeId TypeIdOf<Decimal64>::value = DECIMAL64;
+const TypeId TypeIdOf<Decimal128>::value = DECIMAL128;
+const TypeId TypeIdOf<Uuid>::value = UUID;
+const TypeId TypeIdOf<Binary>::value = BINARY;
+const TypeId TypeIdOf<String>::value = STRING;
+const TypeId TypeIdOf<Symbol>::value = SYMBOL;
+
+std::string typeName(TypeId t) {
+    switch (t) {
+      case NULL_: return "null";
+      case BOOL: return "bool";
+      case UBYTE: return "ubyte";
+      case BYTE: return "byte";
+      case USHORT: return "ushort";
+      case SHORT: return "short";
+      case UINT: return "uint";
+      case INT: return "int";
+      case CHAR: return "char";
+      case ULONG: return "ulong";
+      case LONG: return "long";
+      case TIMESTAMP: return "timestamp";
+      case FLOAT: return "float";
+      case DOUBLE: return "double";
+      case DECIMAL32: return "decimal32";
+      case DECIMAL64: return "decimal64";
+      case DECIMAL128: return "decimal128";
+      case UUID: return "uuid";
+      case BINARY: return "binary";
+      case STRING: return "string";
+      case SYMBOL: return "symbol";
+      case DESCRIBED: return "described";
+      case ARRAY: return "array";
+      case LIST: return "list";
+      case  MAP: return "map";
+      default: return "unknown";
+    }
+}
+
+std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+pn_bytes_t bytes(const std::string& s) { pn_bytes_t b; b.start = &s[0]; b.size = s.size(); return b; }
+
+}}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go b/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
new file mode 100644
index 0000000..11049f7
--- /dev/null
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/go/amqp/interop_test.go
@@ -0,0 +1,308 @@
+/*
+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.
+*/
+
+// Test that conversion of Go type to/from AMQP is compatible with other
+// bindings.
+//
+package amqp
+
+import (
+	"bytes"
+	"fmt"
+	"io"
+	"io/ioutil"
+	"os"
+	"reflect"
+	"strings"
+	"testing"
+)
+
+func assertEqual(want interface{}, got interface{}) {
+	if !reflect.DeepEqual(want, got) {
+		panic(fmt.Errorf("%#v != %#v", want, got))
+	}
+}
+
+func assertNil(err interface{}) {
+	if err != nil {
+		panic(err)
+	}
+}
+
+func getReader(name string) (r io.Reader) {
+	r, err := os.Open("interop/" + name + ".amqp")
+	if err != nil {
+		panic(fmt.Errorf("Can't open %#v: %v", name, err))
+	}
+	return
+}
+
+func remaining(d *Decoder) string {
+	remainder, _ := ioutil.ReadAll(io.MultiReader(d.Buffered(), d.reader))
+	return string(remainder)
+}
+
+// assertDecode: want is the expected value, gotPtr is a pointer to a
+// instance of the same type for Decode.
+func assertDecode(d *Decoder, want interface{}, gotPtr interface{}) {
+
+	assertNil(d.Decode(gotPtr))
+
+	got := reflect.ValueOf(gotPtr).Elem().Interface()
+	assertEqual(want, got)
+
+	// Try round trip encoding
+	bytes, err := Marshal(want, nil)
+	assertNil(err)
+	n, err := Unmarshal(bytes, gotPtr)
+	assertNil(err)
+	assertEqual(n, len(bytes))
+	got = reflect.ValueOf(gotPtr).Elem().Interface()
+	assertEqual(want, got)
+}
+
+func TestUnmarshal(t *testing.T) {
+	bytes, err := ioutil.ReadAll(getReader("strings"))
+	if err != nil {
+		t.Error(err)
+	}
+	for _, want := range []string{"abc\000defg", "abcdefg", "abcdefg", "", "", ""} {
+		var got string
+		n, err := Unmarshal(bytes, &got)
+		if err != nil {
+			t.Error(err)
+		}
+		if want != got {
+			t.Errorf("%#v != %#v", want, got)
+		}
+		bytes = bytes[n:]
+	}
+}
+
+func TestPrimitivesExact(t *testing.T) {
+	d := NewDecoder(getReader("primitives"))
+	// Decoding into exact types
+	var b bool
+	assertDecode(d, true, &b)
+	assertDecode(d, false, &b)
+	var u8 uint8
+	assertDecode(d, uint8(42), &u8)
+	var u16 uint16
+	assertDecode(d, uint16(42), &u16)
+	var i16 int16
+	assertDecode(d, int16(-42), &i16)
+	var u32 uint32
+	assertDecode(d, uint32(12345), &u32)
+	var i32 int32
+	assertDecode(d, int32(-12345), &i32)
+	var u64 uint64
+	assertDecode(d, uint64(12345), &u64)
+	var i64 int64
+	assertDecode(d, int64(-12345), &i64)
+	var f32 float32
+	assertDecode(d, float32(0.125), &f32)
+	var f64 float64
+	assertDecode(d, float64(0.125), &f64)
+}
+
+func TestPrimitivesCompatible(t *testing.T) {
+	d := NewDecoder(getReader("primitives"))
+	// Decoding into compatible types
+	var b bool
+	var i int
+	var u uint
+	var f float64
+	assertDecode(d, true, &b)
+	assertDecode(d, false, &b)
+	assertDecode(d, uint(42), &u)
+	assertDecode(d, uint(42), &u)
+	assertDecode(d, -42, &i)
+	assertDecode(d, uint(12345), &u)
+	assertDecode(d, -12345, &i)
+	assertDecode(d, uint(12345), &u)
+	assertDecode(d, -12345, &i)
+	assertDecode(d, 0.125, &f)
+	assertDecode(d, 0.125, &f)
+}
+
+// assertDecodeValue: want is the expected value, decode into a reflect.Value
+func assertDecodeInterface(d *Decoder, want interface{}) {
+
+	var got, got2 interface{}
+	assertNil(d.Decode(&got))
+
+	assertEqual(want, got)
+
+	// Try round trip encoding
+	bytes, err := Marshal(got, nil)
+	assertNil(err)
+	n, err := Unmarshal(bytes, &got2)
+	assertNil(err)
+	assertEqual(n, len(bytes))
+	assertEqual(want, got2)
+}
+
+func TestPrimitivesInterface(t *testing.T) {
+	d := NewDecoder(getReader("primitives"))
+	assertDecodeInterface(d, true)
+	assertDecodeInterface(d, false)
+	assertDecodeInterface(d, uint8(42))
+	assertDecodeInterface(d, uint16(42))
+	assertDecodeInterface(d, int16(-42))
+	assertDecodeInterface(d, uint32(12345))
+	assertDecodeInterface(d, int32(-12345))
+	assertDecodeInterface(d, uint64(12345))
+	assertDecodeInterface(d, int64(-12345))
+	assertDecodeInterface(d, float32(0.125))
+	assertDecodeInterface(d, float64(0.125))
+}
+
+func TestStrings(t *testing.T) {
+	d := NewDecoder(getReader("strings"))
+	// Test decoding as plain Go strings
+	for _, want := range []string{"abc\000defg", "abcdefg", "abcdefg", "", "", ""} {
+		var got string
+		assertDecode(d, want, &got)
+	}
+	remains := remaining(d)
+	if remains != "" {
+		t.Errorf("leftover: %s", remains)
+	}
+
+	// Test decoding as specific string types
+	d = NewDecoder(getReader("strings"))
+	var bytes []byte
+	var str, sym string
+	assertDecode(d, []byte("abc\000defg"), &bytes)
+	assertDecode(d, "abcdefg", &str)
+	assertDecode(d, "abcdefg", &sym)
+	assertDecode(d, make([]byte, 0), &bytes)
+	assertDecode(d, "", &str)
+	assertDecode(d, "", &sym)
+	remains = remaining(d)
+	if remains != "" {
+		t.Fatalf("leftover: %s", remains)
+	}
+
+	// Test some error handling
+	d = NewDecoder(getReader("strings"))
+	var s string
+	err := d.Decode(s)
+	if err == nil {
+		t.Fatal("Expected error")
+	}
+	if !strings.Contains(err.Error(), "not a pointer") {
+		t.Error(err)
+	}
+	var i int
+	err = d.Decode(&i)
+	if !strings.Contains(err.Error(), "cannot unmarshal") {
+		t.Error(err)
+	}
+	_, err = Unmarshal([]byte{}, nil)
+	if !strings.Contains(err.Error(), "not enough data") {
+		t.Error(err)
+	}
+	_, err = Unmarshal([]byte("foobar"), nil)
+	if !strings.Contains(err.Error(), "invalid-argument") {
+		t.Error(err)
+	}
+}
+
+func TestEncodeDecode(t *testing.T) {
+	type data struct {
+		s  string
+		i  int
+		u8 uint8
+		b  bool
+		f  float32
+		v  interface{}
+	}
+
+	in := data{"foo", 42, 9, true, 1.234, "thing"}
+
+	buf := bytes.Buffer{}
+	e := NewEncoder(&buf)
+	assertNil(e.Encode(in.s))
+	assertNil(e.Encode(in.i))
+	assertNil(e.Encode(in.u8))
+	assertNil(e.Encode(in.b))
+	assertNil(e.Encode(in.f))
+	assertNil(e.Encode(in.v))
+
+	var out data
+	d := NewDecoder(&buf)
+	assertNil(d.Decode(&out.s))
+	assertNil(d.Decode(&out.i))
+	assertNil(d.Decode(&out.u8))
+	assertNil(d.Decode(&out.b))
+	assertNil(d.Decode(&out.f))
+	assertNil(d.Decode(&out.v))
+
+	assertEqual(in, out)
+}
+
+func TestMap(t *testing.T) {
+	d := NewDecoder(getReader("maps"))
+
+	// Generic map
+	var m Map
+	assertDecode(d, Map{"one": int32(1), "two": int32(2), "three": int32(3)}, &m)
+
+	// Interface as map
+	var i interface{}
+	assertDecode(d, Map{int32(1): "one", int32(2): "two", int32(3): "three"}, &i)
+
+	d = NewDecoder(getReader("maps"))
+	// Specific typed map
+	var m2 map[string]int
+	assertDecode(d, map[string]int{"one": 1, "two": 2, "three": 3}, &m2)
+
+	// Round trip a nested map
+	m = Map{int64(1): "one", "two": int32(2), true: Map{uint8(1): true, uint8(2): false}}
+	bytes, err := Marshal(m, nil)
+	assertNil(err)
+	_, err = Unmarshal(bytes, &i)
+	assertNil(err)
+	assertEqual(m, i)
+}
+
+func TestList(t *testing.T) {
+	d := NewDecoder(getReader("lists"))
+	var l List
+	assertDecode(d, List{int32(32), "foo", true}, &l)
+	assertDecode(d, List{}, &l)
+}
+
+func FIXMETestMessage(t *testing.T) {
+	// FIXME aconway 2015-04-09: integrate Message encoding under marshal/unmarshal API.
+	bytes, err := ioutil.ReadAll(getReader("message"))
+	assertNil(err)
+	m, err := DecodeMessage(bytes)
+	assertNil(err)
+	fmt.Printf("%+v\n", m)
+	assertEqual(m.Body(), "hello")
+
+	bytes2 := make([]byte, len(bytes))
+	bytes2, err = m.Encode(bytes2)
+	assertNil(err)
+	assertEqual(bytes, bytes2)
+}
+
+// FIXME aconway 2015-03-13: finish the full interop test


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


[48/50] [abbrv] qpid-proton git commit: PROTON-865: Blocking sender functionality and handler per connection

Posted by ac...@apache.org.
PROTON-865: Blocking sender functionality and handler per connection


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

Branch: refs/heads/cjansen-cpp-client
Commit: a4565b19b5ec5d08ecea8a94648c95b570fc9e88
Parents: ab4b7b3
Author: Clifford Jansen <cl...@apache.org>
Authored: Wed May 20 07:54:03 2015 -0700
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   7 +
 .../cpp/examples/HelloWorldBlocking.cpp         |  65 +++++++
 .../cpp/include/proton/cpp/BlockingConnection.h |  67 +++++++
 .../cpp/include/proton/cpp/BlockingLink.h       |  59 +++++++
 .../cpp/include/proton/cpp/BlockingSender.h     |  54 ++++++
 .../cpp/include/proton/cpp/Connection.h         |   2 +-
 .../bindings/cpp/include/proton/cpp/Container.h |  15 +-
 .../bindings/cpp/include/proton/cpp/Delivery.h  |   4 +-
 .../bindings/cpp/include/proton/cpp/Duration.h  |  56 ++++++
 proton-c/bindings/cpp/include/proton/cpp/Link.h |   1 +
 .../cpp/include/proton/cpp/MessagingAdapter.h   |   3 -
 .../cpp/include/proton/cpp/MessagingHandler.h   |   6 +
 .../bindings/cpp/include/proton/cpp/Sender.h    |   3 +-
 .../cpp/include/proton/cpp/WaitCondition.h      |  45 +++++
 proton-c/bindings/cpp/src/Connection.cpp        |   4 +-
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    |  28 ++-
 proton-c/bindings/cpp/src/ConnectionImpl.h      |   3 +-
 proton-c/bindings/cpp/src/Container.cpp         |  25 ++-
 proton-c/bindings/cpp/src/ContainerImpl.cpp     | 175 +++++++++++--------
 proton-c/bindings/cpp/src/ContainerImpl.h       |  24 ++-
 proton-c/bindings/cpp/src/Duration.cpp          |  55 ++++++
 proton-c/bindings/cpp/src/Link.cpp              |   4 +
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |   6 +-
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |  57 +++++-
 proton-c/bindings/cpp/src/Sender.cpp            |   3 +-
 .../cpp/src/blocking/BlockingConnection.cpp     |  62 +++++++
 .../cpp/src/blocking/BlockingConnectionImpl.cpp | 124 +++++++++++++
 .../cpp/src/blocking/BlockingConnectionImpl.h   |  63 +++++++
 .../bindings/cpp/src/blocking/BlockingLink.cpp  |  86 +++++++++
 .../cpp/src/blocking/BlockingSender.cpp         |  66 +++++++
 30 files changed, 1060 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 54d8ddd..34123ed 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -40,6 +40,7 @@ set (qpid-proton-cpp-core
     src/Terminus.cpp
     src/Acceptor.cpp
     src/Url.cpp
+    src/Duration.cpp
     src/Message.cpp
     src/MessagingAdapter.cpp
     src/MessagingEvent.cpp
@@ -55,6 +56,10 @@ set (qpid-proton-cpp-core
     src/Logger.cpp
     src/contexts.cpp
     src/exceptions.cpp
+    src/blocking/BlockingConnection.cpp
+    src/blocking/BlockingConnectionImpl.cpp
+    src/blocking/BlockingLink.cpp
+    src/blocking/BlockingSender.cpp
   )
 
 #set_source_files_properties (
@@ -102,6 +107,8 @@ add_executable (SimpleSend examples/SimpleSend.cpp)
 target_link_libraries (SimpleSend qpid-proton-cpp)
 add_executable (Broker examples/Broker.cpp)
 target_link_libraries (Broker qpid-proton-cpp)
+add_executable (HelloWorldBlocking examples/HelloWorldBlocking.cpp)
+target_link_libraries (HelloWorldBlocking qpid-proton-cpp)
 
 
 install (TARGETS qpid-proton-cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp b/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
new file mode 100644
index 0000000..a3f729c
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/HelloWorldBlocking.cpp
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/BlockingSender.h"
+
+#include <iostream>
+
+
+using namespace proton::reactor;
+
+class HelloWorldBlocking : public MessagingHandler {
+  private:
+    std::string server;
+    std::string address;
+  public:
+
+    HelloWorldBlocking(const std::string &s, const std::string &addr) : server(s), address(addr) {}
+
+    void onStart(Event &e) {
+        Connection conn = e.getContainer().connect(server);
+        e.getContainer().createReceiver(conn, address);
+    }
+
+    void onMessage(Event &e) {
+        std::string body = e.getMessage().getBody();
+        std::cout << body << std::endl;
+        e.getConnection().close();
+    }
+
+};
+
+int main(int argc, char **argv) {
+    std::string url("localhost:5672");
+    std::string addr("examples");
+    BlockingConnection conn = BlockingConnection(url);
+    BlockingSender sender = conn.createSender(addr);
+    Message m;
+    m.setBody("Hello World!");
+    sender.send(m);
+    conn.close();
+
+    // Temporary hack until blocking receiver available
+    HelloWorldBlocking hw("localhost:5672", "examples");
+    Container(hw).run();
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
new file mode 100644
index 0000000..aa268db
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
@@ -0,0 +1,67 @@
+#ifndef PROTON_CPP_BLOCKINGCONNECTION_H
+#define PROTON_CPP_BLOCKINGCONNECTION_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/cpp/ImportExport.h"
+#include "proton/cpp/Handle.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/cpp/Duration.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Container;
+class BlockingConnectionImpl;
+class SslDomain;
+class BlockingSender;
+class WaitCondition;
+
+class BlockingConnection : public Handle<BlockingConnectionImpl>
+{
+  public:
+    PROTON_CPP_EXTERN BlockingConnection();
+    PROTON_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
+    PROTON_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
+    PROTON_CPP_EXTERN ~BlockingConnection();
+
+    PROTON_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
+                                         SslDomain *ssld=0, Container *c=0);
+    PROTON_CPP_EXTERN void close();
+
+    PROTON_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
+    PROTON_CPP_EXTERN void wait(WaitCondition &condition);
+    PROTON_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
+    PROTON_CPP_EXTERN Duration getTimeout();
+  private:
+    friend class PrivateImplRef<BlockingConnection>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGCONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
new file mode 100644
index 0000000..7f84ce8
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
@@ -0,0 +1,59 @@
+#ifndef PROTON_CPP_BLOCKINGLINK_H
+#define PROTON_CPP_BLOCKINGLINK_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/cpp/ImportExport.h"
+#include "proton/cpp/Handle.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/cpp/Duration.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/BlockingConnection.h"
+#include "proton/types.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+
+class BlockingLink
+{
+  public:
+    PROTON_CPP_EXTERN void close();
+    ~BlockingLink();
+  protected:
+    PROTON_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
+    PROTON_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
+  private:
+    BlockingConnection connection;
+    Link link;
+    void checkClosed();
+    friend class BlockingConnection;
+    friend class BlockingSender;
+    friend class BlockingReceiver;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGLINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
new file mode 100644
index 0000000..d4ddeae
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
@@ -0,0 +1,54 @@
+#ifndef PROTON_CPP_BLOCKINGSENDER_H
+#define PROTON_CPP_BLOCKINGSENDER_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/cpp/ImportExport.h"
+#include "proton/cpp/Handle.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/cpp/Duration.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/BlockingLink.h"
+#include "proton/types.h"
+#include "proton/delivery.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+class BlockingLink;
+
+class BlockingSender : public BlockingLink
+{
+  public:
+    PROTON_CPP_EXTERN Delivery send(Message &msg);
+    PROTON_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
+  private:
+    PROTON_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
+    friend class BlockingConnection;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGSENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
index 86abbe6..f3397ce 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
@@ -47,7 +47,7 @@ class Connection : public Endpoint, public Handle<ConnectionImpl>
     PROTON_CPP_EXTERN Connection& operator=(const Connection& c);
     PROTON_CPP_EXTERN ~Connection();
 
-    PROTON_CPP_EXTERN Connection(Container &c);
+    PROTON_CPP_EXTERN Connection(Container &c, Handler *h = 0);
     PROTON_CPP_EXTERN Transport &getTransport();
     PROTON_CPP_EXTERN Handler *getOverride();
     PROTON_CPP_EXTERN void setOverride(Handler *h);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
index d596ab1..1d7284d 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Container.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Container.h
@@ -24,6 +24,7 @@
 #include "proton/cpp/ImportExport.h"
 #include "proton/cpp/Handle.h"
 #include "proton/cpp/Acceptor.h"
+#include "proton/cpp/Duration.h"
 #include <proton/reactor.h>
 #include <string>
 
@@ -39,6 +40,7 @@ class MessagingHandler;
 class Sender;
 class Receiver;
 class Link;
+ class Handler;
 
 class Container : public Handle<ContainerImpl>
 {
@@ -48,17 +50,24 @@ class Container : public Handle<ContainerImpl>
     PROTON_CPP_EXTERN Container& operator=(const Container& c);
     PROTON_CPP_EXTERN ~Container();
 
+    PROTON_CPP_EXTERN Container();
     PROTON_CPP_EXTERN Container(MessagingHandler &mhandler);
-    PROTON_CPP_EXTERN Connection connect(std::string &host);
+    PROTON_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
     PROTON_CPP_EXTERN void run();
+    PROTON_CPP_EXTERN void start();
+    PROTON_CPP_EXTERN bool process();
+    PROTON_CPP_EXTERN void stop();
+    PROTON_CPP_EXTERN void wakeup();
+    PROTON_CPP_EXTERN bool isQuiesced();
     PROTON_CPP_EXTERN pn_reactor_t *getReactor();
-    PROTON_CPP_EXTERN pn_handler_t *getGlobalHandler();
-    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
     PROTON_CPP_EXTERN Sender createSender(std::string &url);
     PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
     PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
     PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
     PROTON_CPP_EXTERN std::string getContainerId();
+    PROTON_CPP_EXTERN Duration getTimeout();
+    PROTON_CPP_EXTERN void setTimeout(Duration timeout);
   private:
    friend class PrivateImplRef<Container>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
index a1965f6..8171dd5 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
@@ -22,9 +22,11 @@
  *
  */
 #include "proton/cpp/ImportExport.h"
-#include "proton/cpp/Link.h"
+#include "proton/cpp/ProtonHandle.h"
 
 #include "ProtonImplRef.h"
+
+#include "proton/delivery.h"
 #include "proton/disposition.h"
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Duration.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
new file mode 100644
index 0000000..d5aca03
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
@@ -0,0 +1,56 @@
+#ifndef PROTON_CPP_DURATION_H
+#define PROTON_CPP_DURATION_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/cpp/ImportExport.h"
+#include "proton/types.h"
+
+namespace proton {
+namespace reactor {
+
+/**   \ingroup C++
+ * A duration is a time in milliseconds.
+ */
+class Duration
+{
+  public:
+    PROTON_CPP_EXTERN explicit Duration(uint64_t milliseconds);
+    PROTON_CPP_EXTERN uint64_t getMilliseconds() const;
+    PROTON_CPP_EXTERN static const Duration FOREVER;
+    PROTON_CPP_EXTERN static const Duration IMMEDIATE;
+    PROTON_CPP_EXTERN static const Duration SECOND;
+    PROTON_CPP_EXTERN static const Duration MINUTE;
+  private:
+    uint64_t milliseconds;
+};
+
+PROTON_CPP_EXTERN Duration operator*(const Duration& duration,
+                                         uint64_t multiplier);
+PROTON_CPP_EXTERN Duration operator*(uint64_t multiplier,
+                                         const Duration& duration);
+PROTON_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
+PROTON_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_DURATION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
index 265d80d..391e5fc 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Link.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Link.h
@@ -50,6 +50,7 @@ class Link : public Endpoint, public ProtonHandle<pn_link_t>
     PROTON_CPP_EXTERN Terminus getTarget();
     PROTON_CPP_EXTERN Terminus getRemoteSource();
     PROTON_CPP_EXTERN Terminus getRemoteTarget();
+    PROTON_CPP_EXTERN std::string getName();
     PROTON_CPP_EXTERN pn_link_t *getPnLink() const;
     virtual PROTON_CPP_EXTERN Connection &getConnection();
     PROTON_CPP_EXTERN Link getNext(Endpoint::State mask);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
index 36a92e4..280df5b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -71,9 +71,6 @@ class MessagingAdapter : public MessagingHandler
     PROTON_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
   private:
     MessagingHandler &delegate;  // The handler for generated MessagingEvent's
-    bool autoSettle;
-    bool autoAccept;
-    bool peerCloseIsError;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index 4f00681..c6d8f72 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -30,6 +30,7 @@ namespace proton {
 namespace reactor {
 
 class Event;
+class MessagingAdapter;
 
 class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
 {
@@ -80,9 +81,14 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
     bool autoSettle;
     bool autoAccept;
     bool peerCloseIsError;
+    MessagingAdapter *messagingAdapter;
+    Handler *flowController;
+    PROTON_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+                                       bool peerCloseIsError=false);
   private:
     friend class ContainerImpl;
     friend class MessagingAdapter;
+    void createHelpers();
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
index 9b8683d..c63161c 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
@@ -22,6 +22,7 @@
  *
  */
 #include "proton/cpp/ImportExport.h"
+#include "proton/cpp/Delivery.h"
 #include "proton/cpp/Link.h"
 #include "proton/cpp/Message.h"
 
@@ -40,7 +41,7 @@ class Sender : public Link
     PROTON_CPP_EXTERN Sender(pn_link_t *lnk);
     PROTON_CPP_EXTERN Sender();
     PROTON_CPP_EXTERN Sender(const Link& c);
-    PROTON_CPP_EXTERN void send(Message &m);
+    PROTON_CPP_EXTERN Delivery send(Message &m);
   protected:
     virtual void verifyType(pn_link_t *l);
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
new file mode 100644
index 0000000..f4c7cb5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
@@ -0,0 +1,45 @@
+#ifndef PROTON_CPP_WAITCONDITION_H
+#define PROTON_CPP_WAITCONDITION_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/cpp/ImportExport.h"
+
+namespace proton {
+namespace reactor {
+
+// Interface class to indicates that an expected contion has been
+// achieved, i.e. for BlockingConnection.wait()
+
+class WaitCondition
+{
+  public:
+    PROTON_CPP_EXTERN virtual ~WaitCondition();
+
+    // Overide this member function to indicate whether an expected
+    // condition is achieved and requires no further waiting.
+    virtual bool achieved() = 0;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_WAITCONDITION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
index 1db8fbc..67e7d0c 100644
--- a/proton-c/bindings/cpp/src/Connection.cpp
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -42,8 +42,8 @@ Connection::Connection(const Connection& c) : Handle<ConnectionImpl>() { PI::cop
 Connection& Connection::operator=(const Connection& c) { return PI::assign(*this, c); }
 Connection::~Connection() { PI::dtor(*this); }
 
-Connection::Connection(Container &c) {
-    ConnectionImpl *cimpl = new ConnectionImpl(c);
+Connection::Connection(Container &c, Handler *h) {
+    ConnectionImpl *cimpl = new ConnectionImpl(c, h);
     PI::ctor(*this, cimpl);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
index 9cadffe..f7cc5f9 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -25,6 +25,8 @@
 #include "proton/cpp/Transport.h"
 #include "Msg.h"
 #include "contexts.h"
+#include "PrivateImplRef.h"
+#include "ContainerImpl.h"
 
 #include "proton/connection.h"
 
@@ -41,12 +43,25 @@ void ConnectionImpl::decref(ConnectionImpl *impl) {
         delete impl;
 }
 
-ConnectionImpl::ConnectionImpl(Container &c, pn_connection_t *pnConn) : container(c), refCount(0), override(0), transport(0), defaultSession(0),
-                                               pnConnection(pnConn),
-                                               reactorReference(this)
+ConnectionImpl::ConnectionImpl(Container &c, pn_connection_t &pnConn)
+    : container(c), refCount(0), override(0), transport(0), defaultSession(0),
+      pnConnection(&pnConn), reactorReference(this)
 {
-    if (!pnConnection)
-        pnConnection = pn_reactor_connection(container.getReactor(), NULL);
+    setConnectionContext(pnConnection, this);
+}
+
+ConnectionImpl::ConnectionImpl(Container &c, Handler *handler)
+    : container(c), refCount(0), override(0), transport(0), defaultSession(0),
+      reactorReference(this)
+{
+    pn_handler_t *chandler = 0;
+    if (handler) {
+        ContainerImpl *containerImpl = PrivateImplRef<Container>::get(c);
+        chandler = containerImpl->wrapHandler(handler);
+    }
+    pnConnection = pn_reactor_connection(container.getReactor(), chandler);
+    if (chandler)
+        pn_decref(chandler);
     setConnectionContext(pnConnection, this);
 }
 
@@ -112,7 +127,7 @@ Connection &ConnectionImpl::getReactorReference(pn_connection_t *conn) {
         Container container(getContainerContext(reactor));
         if (!container)  // can't be one created by our container
             throw ProtonException(MSG("Unknown Proton connection specifier"));
-        impl = new ConnectionImpl(container, conn);
+        impl = new ConnectionImpl(container, *conn);
     }
     return impl->reactorReference;
 }
@@ -121,5 +136,4 @@ Link ConnectionImpl::getLinkHead(Endpoint::State mask) {
     return Link(pn_link_head(pnConnection, mask));
 }
 
-
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
index 11b5765..48210a3 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -39,7 +39,8 @@ class Container;
 class ConnectionImpl : public Endpoint
 {
   public:
-    PROTON_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t *pnConn = 0);
+    PROTON_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
+    PROTON_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
     PROTON_CPP_EXTERN ~ConnectionImpl();
     PROTON_CPP_EXTERN Transport &getTransport();
     PROTON_CPP_EXTERN Handler *getOverride();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index 4eccb15..e72f484 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -53,17 +53,23 @@ Container::Container(MessagingHandler &mhandler) {
     PI::ctor(*this, cimpl);
 }
 
-Connection Container::connect(std::string &host) { return impl->connect(host); }
+Container::Container() {
+    ContainerImpl *cimpl = new ContainerImpl();
+    PI::ctor(*this, cimpl);
+}
 
-pn_reactor_t *Container::getReactor() { return impl->getReactor(); }
+Connection Container::connect(std::string &host, Handler *h) { return impl->connect(host, h); }
 
-pn_handler_t *Container::getGlobalHandler() { return impl->getGlobalHandler(); }
+pn_reactor_t *Container::getReactor() { return impl->getReactor(); }
 
 std::string Container::getContainerId() { return impl->getContainerId(); }
 
+Duration Container::getTimeout() { return impl->getTimeout(); }
+void Container::setTimeout(Duration timeout) { impl->setTimeout(timeout); }
+
 
-Sender Container::createSender(Connection &connection, std::string &addr) {
-    return impl->createSender(connection, addr);
+Sender Container::createSender(Connection &connection, std::string &addr, Handler *h) {
+    return impl->createSender(connection, addr, h);
 }
 
 Sender Container::createSender(std::string &urlString) {
@@ -83,8 +89,11 @@ Acceptor Container::listen(const std::string &urlString) {
 }
 
 
-void Container::run() {
-    impl->run();
-}
+void Container::run() { impl->run(); }
+void Container::start() { impl->start(); }
+bool Container::process() { return impl->process(); }
+void Container::stop() { impl->stop(); }
+void Container::wakeup() { impl->wakeup(); }
+bool Container::isQuiesced() { return impl->isQuiesced(); }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 1cabf6c..1424dbb 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -116,41 +116,19 @@ class OverrideHandler : public Handler
         pn_handler_dispatch(baseHandler, cevent, (pn_event_type_t) type);
 
         if (conn && type == PN_CONNECTION_FINAL) {
-            //  TODO:  this must be the last acation of the last handler looking at
+            //  TODO:  this must be the last action of the last handler looking at
             //  connection events. Better: generate a custom FINAL event (or task).  Or move to
             //  separate event streams per connection as part of multi threading support.
             ConnectionImpl *cimpl = getConnectionContext(conn);
             if (cimpl)
                 cimpl->reactorDetach();
-            // TODO: remember all connections and do reactorDetach of zombies connections
-            // not pn_connection_release'd at PN_REACTOR_FINAL.
+            // TODO: remember all connections and do reactorDetach of zombie connections
+            // not yet pn_connection_release'd at PN_REACTOR_FINAL.
         }
     }
 };
 
 
-class CFlowController : public ProtonHandler
-{
-  public:
-    pn_handler_t *flowcontroller;
-
-    CFlowController(int window) : flowcontroller(pn_flowcontroller(window)) {}
-    ~CFlowController() {
-        pn_decref(flowcontroller);
-    }
-
-    void redirect(Event &e) {
-        ProtonEvent *pne = dynamic_cast<ProtonEvent *>(&e);
-        pn_handler_dispatch(flowcontroller, pne->getPnEvent(), (pn_event_type_t) pne->getType());
-    }
-
-    virtual void onLinkLocalOpen(Event &e) { redirect(e); }
-    virtual void onLinkRemoteOpen(Event &e) { redirect(e); }
-    virtual void onLinkFlow(Event &e) { redirect(e); }
-    virtual void onDelivery(Event &e) { redirect(e); }
-};
-
-
 namespace {
 
 // TODO: configurable policy.  SessionPerConnection for now.
@@ -165,7 +143,6 @@ Session getDefaultSession(pn_connection_t *conn, pn_session_t **ses) {
 
 struct InboundContext {
     ContainerImpl *containerImpl;
-    Container containerRef;  // create only once for all inbound events
     Handler *cppHandler;
 };
 
@@ -174,11 +151,6 @@ ContainerImpl *getContainerImpl(pn_handler_t *c_handler) {
     return ctxt->containerImpl;
 }
 
-Container &getContainerRef(pn_handler_t *c_handler) {
-    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
-    return ctxt->containerRef;
-}
-
 Handler &getCppHandler(pn_handler_t *c_handler) {
     struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
     return *ctxt->cppHandler;
@@ -186,21 +158,19 @@ Handler &getCppHandler(pn_handler_t *c_handler) {
 
 void cpp_handler_dispatch(pn_handler_t *c_handler, pn_event_t *cevent, pn_event_type_t type)
 {
-    MessagingEvent mevent(cevent, type, getContainerRef(c_handler));
+    Container c(getContainerImpl(c_handler)); // Ref counted per event, but when is the last event if stop() never called?
+    MessagingEvent mevent(cevent, type, c);
     mevent.dispatch(getCppHandler(c_handler));
 }
 
 void cpp_handler_cleanup(pn_handler_t *c_handler)
 {
-    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
-    ctxt->containerRef.~Container();
 }
 
 pn_handler_t *cpp_handler(ContainerImpl *c, Handler *h)
 {
     pn_handler_t *handler = pn_handler_new(cpp_handler_dispatch, sizeof(struct InboundContext), cpp_handler_cleanup);
     struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(handler);
-    new (&ctxt->containerRef) Container(c);
     ctxt->containerImpl = c;
     ctxt->cppHandler = h;
     return handler;
@@ -220,18 +190,29 @@ void ContainerImpl::decref(ContainerImpl *impl) {
         delete impl;
 }
 
-ContainerImpl::ContainerImpl(MessagingHandler &mhandler) :
-    reactor(0), globalHandler(0), messagingHandler(mhandler), containerId(generateUuid()),
+ContainerImpl::ContainerImpl(Handler &h) :
+    reactor(0), handler(&h), messagingAdapter(0),
+    overrideHandler(0), flowController(0), containerId(generateUuid()),
     refCount(0)
-{
-}
+{}
+
+ContainerImpl::ContainerImpl() :
+    reactor(0), handler(0), messagingAdapter(0),
+    overrideHandler(0), flowController(0), containerId(generateUuid()),
+    refCount(0)
+{}
 
-ContainerImpl::~ContainerImpl() {}
+ContainerImpl::~ContainerImpl() {
+    delete overrideHandler;
+    delete flowController;
+    delete messagingAdapter;
+    pn_reactor_free(reactor);
+}
 
-Connection ContainerImpl::connect(std::string &host) {
-    if (!reactor) throw ProtonException(MSG("Container not initialized"));
+Connection ContainerImpl::connect(std::string &host, Handler *h) {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
     Container cntnr(this);
-    Connection connection(cntnr);
+    Connection connection(cntnr, handler);
     Connector *connector = new Connector(connection);
     // Connector self-deletes depending on reconnect logic
     connector->setAddress(host);  // TODO: url vector
@@ -242,15 +223,36 @@ Connection ContainerImpl::connect(std::string &host) {
 
 pn_reactor_t *ContainerImpl::getReactor() { return reactor; }
 
-pn_handler_t *ContainerImpl::getGlobalHandler() { return globalHandler; }
 
 std::string ContainerImpl::getContainerId() { return containerId; }
 
+Duration ContainerImpl::getTimeout() {
+    pn_millis_t tmo = pn_reactor_get_timeout(reactor);
+    if (tmo == PN_MILLIS_MAX)
+        return Duration::FOREVER;
+    return Duration(tmo);
+}
 
-Sender ContainerImpl::createSender(Connection &connection, std::string &addr) {
+void ContainerImpl::setTimeout(Duration timeout) {
+    if (timeout == Duration::FOREVER || timeout.getMilliseconds() > PN_MILLIS_MAX)
+        pn_reactor_set_timeout(reactor, PN_MILLIS_MAX);
+    else {
+        pn_millis_t tmo = timeout.getMilliseconds();
+        pn_reactor_set_timeout(reactor, tmo);
+    }
+}
+
+
+Sender ContainerImpl::createSender(Connection &connection, std::string &addr, Handler *h) {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
     Session session = getDefaultSession(connection.getPnConnection(), &getImpl(connection)->defaultSession);
     Sender snd = session.createSender(containerId  + '-' + addr);
-    pn_terminus_set_address(pn_link_target(snd.getPnLink()), addr.c_str());
+    pn_link_t *lnk = snd.getPnLink();
+    pn_terminus_set_address(pn_link_target(lnk), addr.c_str());
+    if (h) {
+        pn_record_t *record = pn_link_attachments(lnk);
+        pn_record_set_handler(record, wrapHandler(h));
+    }
     snd.open();
 
     ConnectionImpl *connImpl = getImpl(connection);
@@ -258,7 +260,8 @@ Sender ContainerImpl::createSender(Connection &connection, std::string &addr) {
 }
 
 Sender ContainerImpl::createSender(std::string &urlString) {
-    Connection conn = connect(urlString);
+    if (!reactor) throw ProtonException(MSG("Container not started"));
+    Connection conn = connect(urlString, 0);
     Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
     std::string path = Url(urlString).getPath();
     Sender snd = session.createSender(containerId + '-' + path);
@@ -270,6 +273,7 @@ Sender ContainerImpl::createSender(std::string &urlString) {
 }
 
 Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr) {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
     ConnectionImpl *connImpl = getImpl(connection);
     Session session = getDefaultSession(connImpl->pnConnection, &connImpl->defaultSession);
     Receiver rcv = session.createReceiver(containerId + '-' + addr);
@@ -279,8 +283,9 @@ Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr
 }
 
 Receiver ContainerImpl::createReceiver(const std::string &urlString) {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
     // TODO: const cleanup of API
-    Connection conn = connect(const_cast<std::string &>(urlString));
+    Connection conn = connect(const_cast<std::string &>(urlString), 0);
     Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
     std::string path = Url(urlString).getPath();
     Receiver rcv = session.createReceiver(containerId + '-' + path);
@@ -298,50 +303,76 @@ Acceptor ContainerImpl::acceptor(const std::string &host, const std::string &por
 }
 
 Acceptor ContainerImpl::listen(const std::string &urlString) {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
     Url url(urlString);
     // TODO: SSL
     return acceptor(url.getHost(), url.getPort());
 }
 
 
-void ContainerImpl::run() {
+pn_handler_t *ContainerImpl::wrapHandler(Handler *h) {
+    return cpp_handler(this, h);
+}
+
+
+void ContainerImpl::initializeReactor() {
+    if (reactor) throw ProtonException(MSG("Container already running"));
     reactor = pn_reactor();
 
     // Set our context on the reactor
     setContainerContext(reactor, this);
 
-    int prefetch = messagingHandler.prefetch;
-    Handler *flowController = 0;
-
-    // Set the reactor's main/default handler (see note below)
-    if (prefetch) {
-        flowController = new CFlowController(prefetch);
-        messagingHandler.addChildHandler(*flowController);
+    if (handler) {
+        pn_handler_t *cppHandler = cpp_handler(this, handler);
+        pn_reactor_set_handler(reactor, cppHandler);
+        pn_decref(cppHandler);
     }
-    MessagingAdapter messagingAdapter(messagingHandler);
-    messagingHandler.addChildHandler(messagingAdapter);
-    pn_handler_t *cppHandler = cpp_handler(this, &messagingHandler);
-    pn_reactor_set_handler(reactor, cppHandler);
 
     // Set our own global handler that "subclasses" the existing one
-    pn_handler_t *cGlobalHandler = pn_reactor_get_global_handler(reactor);
-    pn_incref(cGlobalHandler);
-    OverrideHandler overrideHandler(cGlobalHandler);
-    pn_handler_t *cppGlobalHandler = cpp_handler(this, &overrideHandler);
+    pn_handler_t *globalHandler = pn_reactor_get_global_handler(reactor);
+    overrideHandler = new OverrideHandler(globalHandler);
+    pn_handler_t *cppGlobalHandler = cpp_handler(this, overrideHandler);
     pn_reactor_set_global_handler(reactor, cppGlobalHandler);
+    pn_decref(cppGlobalHandler);
 
     // Note: we have just set up the following 4/5 handlers that see events in this order:
     // messagingHandler (Proton C events), pn_flowcontroller (optional), messagingAdapter,
-    // messagingHandler (Messaging events from the messagingAdapter), connector override,
-    // the reactor's default globalhandler (pn_iohandler)
+    // messagingHandler (Messaging events from the messagingAdapter, i.e. the delegate),
+    // connector override, the reactor's default globalhandler (pn_iohandler)
+}
+
+void ContainerImpl::run() {
+    initializeReactor();
     pn_reactor_run(reactor);
+}
 
-    pn_decref(cppHandler);
-    pn_decref(cppGlobalHandler);
-    pn_decref(cGlobalHandler);
-    pn_reactor_free(reactor);
-    reactor = 0;
-    delete(flowController);
+void ContainerImpl::start() {
+    initializeReactor();
+    pn_reactor_start(reactor);
+}
+
+bool ContainerImpl::process() {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
+    bool result = pn_reactor_process(reactor);
+    // TODO: check errors
+    return result;
+}
+
+void ContainerImpl::stop() {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
+    pn_reactor_stop(reactor);
+    // TODO: check errors
+}
+
+void ContainerImpl::wakeup() {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
+    pn_reactor_wakeup(reactor);
+    // TODO: check errors
+}
+
+bool ContainerImpl::isQuiesced() {
+    if (!reactor) throw ProtonException(MSG("Container not started"));
+    return pn_reactor_quiesced(reactor);
 }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
index f7b5b9e..65a6651 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.h
+++ b/proton-c/bindings/cpp/src/ContainerImpl.h
@@ -25,6 +25,7 @@
 #include "proton/cpp/MessagingHandler.h"
 #include "proton/cpp/Connection.h"
 #include "proton/cpp/Link.h"
+#include "proton/cpp/Duration.h"
 
 #include "proton/reactor.h"
 
@@ -40,26 +41,37 @@ class Acceptor;
 class ContainerImpl
 {
   public:
-    PROTON_CPP_EXTERN ContainerImpl(MessagingHandler &mhandler);
+    PROTON_CPP_EXTERN ContainerImpl(Handler &h);
+    PROTON_CPP_EXTERN ContainerImpl();
     PROTON_CPP_EXTERN ~ContainerImpl();
-    PROTON_CPP_EXTERN Connection connect(std::string &host);
+    PROTON_CPP_EXTERN Connection connect(std::string &host, Handler *h);
     PROTON_CPP_EXTERN void run();
     PROTON_CPP_EXTERN pn_reactor_t *getReactor();
-    PROTON_CPP_EXTERN pn_handler_t *getGlobalHandler();
-    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h);
     PROTON_CPP_EXTERN Sender createSender(std::string &url);
     PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
     PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
     PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
     PROTON_CPP_EXTERN std::string getContainerId();
+    PROTON_CPP_EXTERN Duration getTimeout();
+    PROTON_CPP_EXTERN void setTimeout(Duration timeout);
+    void start();
+    bool process();
+    void stop();
+    void wakeup();
+    bool isQuiesced();
+    pn_handler_t *wrapHandler(Handler *h);
     static void incref(ContainerImpl *);
     static void decref(ContainerImpl *);
   private:
     void dispatch(pn_event_t *event, pn_event_type_t type);
     Acceptor acceptor(const std::string &host, const std::string &port);
+    void initializeReactor();
     pn_reactor_t *reactor;
-    pn_handler_t *globalHandler;
-    MessagingHandler &messagingHandler;
+    Handler *handler;
+    MessagingAdapter *messagingAdapter;
+    Handler *overrideHandler;
+    Handler *flowController;
     std::string containerId;
     int refCount;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/Duration.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Duration.cpp b/proton-c/bindings/cpp/src/Duration.cpp
new file mode 100644
index 0000000..f4155d9
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Duration.cpp
@@ -0,0 +1,55 @@
+/*
+ *
+ * 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/cpp/Duration.h"
+#include <limits>
+
+namespace proton {
+namespace reactor {
+
+Duration::Duration(uint64_t ms) : milliseconds(ms) {}
+uint64_t Duration::getMilliseconds() const { return milliseconds; }
+
+Duration operator*(const Duration& duration, uint64_t multiplier)
+{
+    return Duration(duration.getMilliseconds() * multiplier);
+}
+
+Duration operator*(uint64_t multiplier, const Duration& duration)
+{
+    return Duration(duration.getMilliseconds() * multiplier);
+}
+
+bool operator==(const Duration& a, const Duration& b)
+{
+    return a.getMilliseconds() == b.getMilliseconds();
+}
+
+bool operator!=(const Duration& a, const Duration& b)
+{
+    return a.getMilliseconds() != b.getMilliseconds();
+}
+
+const Duration Duration::FOREVER(std::numeric_limits<uint64_t>::max());
+const Duration Duration::IMMEDIATE(0);
+const Duration Duration::SECOND(1000);
+const Duration Duration::MINUTE(SECOND * 60);
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/Link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp
index aab01d9..59cf039 100644
--- a/proton-c/bindings/cpp/src/Link.cpp
+++ b/proton-c/bindings/cpp/src/Link.cpp
@@ -96,6 +96,10 @@ Terminus Link::getRemoteTarget() {
     return Terminus(pn_link_remote_target(impl), this);
 }
 
+std::string Link::getName() {
+    return std::string(pn_link_name(impl));
+}
+
 Connection &Link::getConnection() {
     pn_session_t *s = pn_link_session(impl);
     pn_connection_t *c = pn_session_connection(s);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index f2916db..625485e 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -32,14 +32,12 @@
 
 namespace proton {
 namespace reactor {
-
 MessagingAdapter::MessagingAdapter(MessagingHandler &delegate_) :
-    autoSettle(delegate_.autoSettle),
-    autoAccept(delegate_.autoAccept),
-    peerCloseIsError(delegate_.peerCloseIsError),
+    MessagingHandler(true, delegate_.prefetch, delegate_.autoSettle, delegate_.autoAccept, delegate_.peerCloseIsError),
     delegate(delegate_)
 {};
 
+
 MessagingAdapter::~MessagingAdapter(){};
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
index 7a4a5cb..925186a 100644
--- a/proton-c/bindings/cpp/src/MessagingHandler.cpp
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -26,11 +26,64 @@
 namespace proton {
 namespace reactor {
 
+namespace {
+class CFlowController : public ProtonHandler
+{
+  public:
+    pn_handler_t *flowcontroller;
+
+    CFlowController(int window) : flowcontroller(pn_flowcontroller(window)) {}
+    ~CFlowController() {
+        pn_decref(flowcontroller);
+    }
+
+    void redirect(Event &e) {
+        ProtonEvent *pne = dynamic_cast<ProtonEvent *>(&e);
+        pn_handler_dispatch(flowcontroller, pne->getPnEvent(), (pn_event_type_t) pne->getType());
+    }
+
+    virtual void onLinkLocalOpen(Event &e) { redirect(e); }
+    virtual void onLinkRemoteOpen(Event &e) { redirect(e); }
+    virtual void onLinkFlow(Event &e) { redirect(e); }
+    virtual void onDelivery(Event &e) { redirect(e); }
+};
+
+} // namespace
+
+
+
+
 MessagingHandler::MessagingHandler(int prefetch0, bool autoAccept0, bool autoSettle0, bool peerCloseIsError0) :
     prefetch(prefetch0), autoAccept(autoAccept0), autoSettle(autoSettle0), peerCloseIsError(peerCloseIsError0)
-{}
+{
+    createHelpers();
+}
+
+MessagingHandler::MessagingHandler(bool rawHandler, int prefetch0, bool autoAccept0, bool autoSettle0,
+                                   bool peerCloseIsError0) :
+    prefetch(prefetch0), autoAccept(autoAccept0), autoSettle(autoSettle0), peerCloseIsError(peerCloseIsError0)
+{
+    if (rawHandler) {
+        flowController = 0;
+        messagingAdapter = 0;
+    } else {
+        createHelpers();
+    }
+}
+
+void MessagingHandler::createHelpers() {
+    if (prefetch > 0) {
+        flowController = new CFlowController(prefetch);
+        addChildHandler(*flowController);
+    }
+    messagingAdapter = new MessagingAdapter(*this);
+    addChildHandler(*messagingAdapter);
+}
 
-MessagingHandler::~MessagingHandler(){};
+MessagingHandler::~MessagingHandler(){
+    delete flowController;
+    delete messagingAdapter;
+};
 
 void MessagingHandler::onAbort(Event &e) { onUnhandled(e); }
 void MessagingHandler::onAccepted(Event &e) { onUnhandled(e); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
index c521ad1..c8f962e 100644
--- a/proton-c/bindings/cpp/src/Sender.cpp
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -54,7 +54,7 @@ namespace{
 uint64_t tagCounter = 0;
 }
 
-void Sender::send(Message &message) {
+Delivery Sender::send(Message &message) {
     char tag[8];
     void *ptr = &tag;
     uint64_t id = ++tagCounter;
@@ -67,6 +67,7 @@ void Sender::send(Message &message) {
     pn_link_advance(link);
     if (pn_link_snd_settle_mode(link) == PN_SND_SETTLED)
         pn_delivery_settle(dlv);
+    return Delivery(dlv);
 }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
new file mode 100644
index 0000000..3fb6010
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/BlockingConnection.h"
+#include "proton/cpp/BlockingSender.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+#include "BlockingConnectionImpl.h"
+#include "PrivateImplRef.h"
+
+namespace proton {
+namespace reactor {
+
+template class Handle<BlockingConnectionImpl>;
+typedef PrivateImplRef<BlockingConnection> PI;
+
+BlockingConnection::BlockingConnection() {PI::ctor(*this, 0); }
+
+BlockingConnection::BlockingConnection(const BlockingConnection& c) : Handle<BlockingConnectionImpl>() { PI::copy(*this, c); }
+
+BlockingConnection& BlockingConnection::operator=(const BlockingConnection& c) { return PI::assign(*this, c); }
+BlockingConnection::~BlockingConnection() { PI::dtor(*this); }
+
+BlockingConnection::BlockingConnection(std::string &url, Duration d, SslDomain *ssld, Container *c) {
+    BlockingConnectionImpl *cimpl = new BlockingConnectionImpl(url, d,ssld, c);
+    PI::ctor(*this, cimpl);
+}
+
+void BlockingConnection::close() { impl->close(); }
+
+void BlockingConnection::wait(WaitCondition &cond) { return impl->wait(cond); }
+void BlockingConnection::wait(WaitCondition &cond, std::string &msg, Duration timeout) {
+    return impl->wait(cond, msg, timeout);
+}
+
+BlockingSender BlockingConnection::createSender(std::string &address, Handler *h) {
+    Sender sender = impl->container.createSender(impl->connection, address, h);
+    return BlockingSender(*this, sender);
+}
+
+Duration BlockingConnection::getTimeout() { return impl->getTimeout(); }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
new file mode 100644
index 0000000..bdda697
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Duration.h"
+#include "proton/cpp/exceptions.h"
+#include "proton/cpp/WaitCondition.h"
+#include "BlockingConnectionImpl.h"
+#include "Msg.h"
+#include "contexts.h"
+
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+WaitCondition::~WaitCondition() {}
+
+
+void BlockingConnectionImpl::incref(BlockingConnectionImpl *impl) {
+    impl->refCount++;
+}
+
+void BlockingConnectionImpl::decref(BlockingConnectionImpl *impl) {
+    impl->refCount--;
+    if (impl->refCount == 0)
+        delete impl;
+}
+
+namespace {
+struct ConnectionOpening : public WaitCondition {
+    ConnectionOpening(pn_connection_t *c) : pnConnection(c) {}
+    bool achieved() { return (pn_connection_state(pnConnection) & PN_REMOTE_UNINIT); }
+    pn_connection_t *pnConnection;
+};
+
+struct ConnectionClosed : public WaitCondition {
+    ConnectionClosed(pn_connection_t *c) : pnConnection(c) {}
+    bool achieved() { return !(pn_connection_state(pnConnection) & PN_REMOTE_ACTIVE); }
+    pn_connection_t *pnConnection;
+};
+
+}
+
+
+BlockingConnectionImpl::BlockingConnectionImpl(std::string &u, Duration timeout0, SslDomain *ssld, Container *c)
+    : url(u), timeout(timeout0), refCount(0)
+{
+    if (c)
+        container = *c;
+    container.start();
+    container.setTimeout(timeout);
+    // Create connection and send the connection events here
+    connection = container.connect(url, static_cast<Handler *>(this));
+    ConnectionOpening cond(connection.getPnConnection());
+    wait(cond);
+}
+
+BlockingConnectionImpl::~BlockingConnectionImpl() {
+    container = Container();
+}
+
+void BlockingConnectionImpl::close() {
+    connection.close();
+    ConnectionClosed cond(connection.getPnConnection());
+    wait(cond);
+}
+
+void BlockingConnectionImpl::wait(WaitCondition &condition) {
+    std::string empty;
+    wait(condition, empty, timeout);
+}
+
+void BlockingConnectionImpl::wait(WaitCondition &condition, std::string &msg, Duration waitTimeout) {
+    if (waitTimeout == Duration::FOREVER) {
+        while (!condition.achieved()) {
+            container.process();
+        }
+    }
+
+    pn_reactor_t *reactor = container.getReactor();
+    pn_millis_t origTimeout = pn_reactor_get_timeout(reactor);
+    pn_reactor_set_timeout(reactor, waitTimeout.getMilliseconds());
+    try {
+        pn_timestamp_t now = pn_reactor_mark(reactor);
+        pn_timestamp_t deadline = now + waitTimeout.getMilliseconds();
+        while (!condition.achieved()) {
+            container.process();
+            if (deadline < pn_reactor_mark(reactor)) {
+                std::string txt = "Connection timed out";
+                if (!msg.empty())
+                    txt += ": " + msg;
+                // TODO: proper Timeout exception
+                throw ProtonException(MSG(txt));
+            }
+        }
+    } catch (...) {
+        pn_reactor_set_timeout(reactor, origTimeout);
+        throw;
+    }
+    pn_reactor_set_timeout(reactor, origTimeout);
+}
+
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
new file mode 100644
index 0000000..5f263ab
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.h
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_CONNECTIONIMPL_H
+#define PROTON_CPP_CONNECTIONIMPL_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/cpp/ImportExport.h"
+#include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Container.h"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class SslDomain;
+
+ class BlockingConnectionImpl : public MessagingHandler
+{
+  public:
+    PROTON_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
+    PROTON_CPP_EXTERN ~BlockingConnectionImpl();
+    PROTON_CPP_EXTERN void close();
+    PROTON_CPP_EXTERN void wait(WaitCondition &condition);
+    PROTON_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
+    PROTON_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
+    Duration getTimeout() { return timeout; }
+    static void incref(BlockingConnectionImpl *);
+    static void decref(BlockingConnectionImpl *);
+  private:
+    friend class BlockingConnection;
+    Container container;
+    Connection connection;
+    std::string url;
+    Duration timeout;
+    int refCount;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
new file mode 100644
index 0000000..5a572ae
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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/cpp/BlockingLink.h"
+#include "proton/cpp/BlockingConnection.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/WaitCondition.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+
+
+namespace proton {
+namespace reactor {
+
+namespace {
+struct LinkOpened : public WaitCondition {
+    LinkOpened(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_UNINIT); }
+    pn_link_t *pnLink;
+};
+
+struct LinkClosed : public WaitCondition {
+    LinkClosed(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return (pn_link_state(pnLink) & PN_REMOTE_CLOSED); }
+    pn_link_t *pnLink;
+};
+
+struct LinkNotOpen : public WaitCondition {
+    LinkNotOpen(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_ACTIVE); }
+    pn_link_t *pnLink;
+};
+
+
+} // namespace
+
+
+BlockingLink::BlockingLink(BlockingConnection *c, pn_link_t *pnl) : connection(*c), link(pnl) {
+    std::string msg = "Opening link " + link.getName();
+    LinkOpened linkOpened(link.getPnLink());
+    connection.wait(linkOpened, msg);
+}
+
+BlockingLink::~BlockingLink() {}
+
+void BlockingLink::waitForClosed(Duration timeout) {
+    std::string msg = "Closing link " + link.getName();
+    LinkClosed linkClosed(link.getPnLink());
+    connection.wait(linkClosed, msg);
+    checkClosed();
+}
+
+void BlockingLink::checkClosed() {
+    pn_link_t * pnLink = link.getPnLink();
+    if (pn_link_state(pnLink) & PN_REMOTE_CLOSED) {
+        link.close();
+        // TODO: LinkDetached exception
+        throw ProtonException(MSG("Link detached"));
+    }
+}
+
+void BlockingLink::close() {
+    link.close();
+    std::string msg = "Closing link " + link.getName();
+    LinkNotOpen linkNotOpen(link.getPnLink());
+    connection.wait(linkNotOpen, msg);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a4565b19/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
new file mode 100644
index 0000000..dc6b9bd
--- /dev/null
+++ b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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/cpp/BlockingSender.h"
+#include "proton/cpp/BlockingConnection.h"
+#include "proton/cpp/WaitCondition.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+
+
+namespace proton {
+namespace reactor {
+
+namespace {
+struct DeliverySettled : public WaitCondition {
+    DeliverySettled(pn_delivery_t *d) : pnDelivery(d) {}
+    bool achieved() { return pn_delivery_settled(pnDelivery); }
+    pn_delivery_t *pnDelivery;
+};
+
+} // namespace
+
+
+BlockingSender::BlockingSender(BlockingConnection &c, Sender &l) : BlockingLink(&c, l.getPnLink()) {
+    std::string ta = link.getTarget().getAddress();
+    std::string rta = link.getRemoteTarget().getAddress();
+    if (ta.empty() || ta.compare(rta) != 0) {
+        waitForClosed();
+        link.close();
+        std::string txt = "Failed to open sender " + link.getName() + ", target does not match";
+        throw ProtonException(MSG("Container not started"));
+    }
+}
+
+Delivery BlockingSender::send(Message &msg, Duration timeout) {
+    Sender snd = link;
+    Delivery dlv = snd.send(msg);
+    std::string txt = "Sending on sender " + link.getName();
+    DeliverySettled cond(dlv.getPnDelivery());
+    connection.wait(cond, txt, timeout);
+    return dlv;
+}
+
+Delivery BlockingSender::send(Message &msg) {
+    // Use default timeout
+    return send(msg, connection.getTimeout());
+}
+
+}} // namespace proton::reactor


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


[37/50] [abbrv] qpid-proton git commit: PROTON-865: most of MessagingAdapter in place, SimpleSend/Recv

Posted by ac...@apache.org.
PROTON-865: most of MessagingAdapter in place, SimpleSend/Recv


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

Branch: refs/heads/cjansen-cpp-client
Commit: 40b63a1357fd17728262bde220f2b1e6b62c3a73
Parents: 8c06706
Author: Clifford Jansen <cl...@apache.org>
Authored: Tue May 5 06:48:48 2015 -0700
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   4 +
 proton-c/bindings/cpp/examples/SimpleRecv.cpp   | 109 +++++++
 proton-c/bindings/cpp/examples/SimpleSend.cpp   | 117 +++++++
 .../bindings/cpp/include/proton/cpp/Container.h |   1 +
 .../bindings/cpp/include/proton/cpp/Message.h   |  23 +-
 .../cpp/include/proton/cpp/MessagingAdapter.h   |  30 +-
 .../cpp/include/proton/cpp/MessagingEvent.h     |  16 +-
 .../cpp/include/proton/cpp/MessagingHandler.h   |  13 +-
 .../bindings/cpp/include/proton/cpp/Session.h   |   8 +-
 proton-c/bindings/cpp/src/Connection.cpp        |   2 +-
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    |  12 +-
 proton-c/bindings/cpp/src/Connector.cpp         |   5 +-
 proton-c/bindings/cpp/src/Container.cpp         |   4 +
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |  87 +++--
 proton-c/bindings/cpp/src/ContainerImpl.h       |   1 +
 proton-c/bindings/cpp/src/Message.cpp           | 194 ++++++++++--
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  | 316 ++++++++++++++++---
 proton-c/bindings/cpp/src/MessagingEvent.cpp    |  31 +-
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |  12 +-
 proton-c/bindings/cpp/src/Session.cpp           |  29 +-
 proton-c/bindings/cpp/src/contexts.cpp          |  47 +--
 proton-c/bindings/cpp/src/contexts.h            |   4 +
 22 files changed, 897 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 7e456a5..68baad7 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -93,6 +93,10 @@ add_executable (HelloWorld examples/HelloWorld.cpp)
 target_link_libraries (HelloWorld qpid-proton-cpp)
 add_executable (HelloWorldDirect examples/HelloWorldDirect.cpp)
 target_link_libraries (HelloWorldDirect qpid-proton-cpp)
+add_executable (SimpleRecv examples/SimpleRecv.cpp)
+target_link_libraries (SimpleRecv qpid-proton-cpp)
+add_executable (SimpleSend examples/SimpleSend.cpp)
+target_link_libraries (SimpleSend qpid-proton-cpp)
 
 install (TARGETS qpid-proton-cpp
   EXPORT  proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/examples/SimpleRecv.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/SimpleRecv.cpp b/proton-c/bindings/cpp/examples/SimpleRecv.cpp
new file mode 100644
index 0000000..22778f0
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/SimpleRecv.cpp
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Link.h"
+
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+using namespace proton::reactor;
+
+class Recv : public MessagingHandler {
+  private:
+    std::string url;
+    int expected;
+    int received;
+  public:
+
+    Recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
+
+    void onStart(Event &e) {
+        e.getContainer().createReceiver(url);
+    }
+
+    void onMessage(Event &e) {
+        uint64_t id = 0;
+        Message msg = e.getMessage();
+        if (msg.getIdType() == PN_ULONG) {
+            id = msg.getId();
+            if (id < received)
+                return; // ignore duplicate
+        }
+        if (expected == 0 || received < expected) {
+            std::cout << '[' << id << "]: " << msg.getBody() << std::endl;
+            received++;
+            if (received == expected) {
+                e.getReceiver().close();
+                e.getConnection().close();
+            }
+        }
+    }
+};
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr);
+
+int main(int argc, char **argv) {
+    int messageCount = 100;
+    std::string address("localhost:5672/examples");
+    parse_options(argc, argv, messageCount, address);
+    Recv recv(address, messageCount);
+    Container(recv).run();
+}
+
+
+static void usage() {
+    std::cout << "Usage: SimpleRecv -m message_count -a address:" << std::endl;
+    exit (1);
+}
+
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr) {
+    int c, i;
+    for (i = 1; i < argc; i++) {
+        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
+            c = argv[i][1];
+            const char *nextarg = i < argc ? argv[i+1] : NULL;
+
+            switch (c) {
+            case 'a':
+                if (!nextarg) usage();
+                addr = nextarg;
+                i++;
+                break;
+            case 'm':
+                if (!nextarg) usage();
+                unsigned newc;
+                if (sscanf( nextarg, "%d", &newc) != 1) usage();
+                count = newc;
+                i++;
+                break;
+            default:
+                usage();
+            }
+        }
+        else usage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/examples/SimpleSend.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/SimpleSend.cpp b/proton-c/bindings/cpp/examples/SimpleSend.cpp
new file mode 100644
index 0000000..89ca39d
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/SimpleSend.cpp
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Connection.h"
+
+#include <iostream>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+using namespace proton::reactor;
+
+class Send : public MessagingHandler {
+  private:
+    std::string url;
+    int sent;
+    int confirmed;
+    int total;
+  public:
+
+    Send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
+
+    void onStart(Event &e) {
+        e.getContainer().createSender(url);
+    }
+
+    void onSendable(Event &e) {
+        Sender sender = e.getSender();
+        while (sender.getCredit() && sent < total) {
+            Message msg;
+            msg.setId(sent + 1);
+            // TODO: fancy map body content as in Python example.  Simple binary for now.
+            const char *bin = "some arbitrary binary data";
+            msg.setBody(bin, strlen(bin));
+            sender.send(msg);
+            sent++;
+        }
+    }
+
+    void onAccepted(Event &e) {
+        confirmed++;
+        if (confirmed == total) {
+            std::cout << "all messages confirmed" << std::endl;
+            e.getConnection().close();
+        }
+    }
+
+    void onDisconnected(Event &e) {
+        sent = confirmed;
+    }
+};
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr);
+
+int main(int argc, char **argv) {
+    int messageCount = 100;
+    std::string address("localhost:5672/examples");
+    parse_options(argc, argv, messageCount, address);
+    Send send(address, messageCount);
+    Container(send).run();
+}
+
+
+static void usage() {
+    std::cout << "Usage: SimpleSend -m message_count -a address:" << std::endl;
+    exit (1);
+}
+
+
+static void parse_options(int argc, char **argv, int &count, std::string &addr) {
+    int c, i;
+    for (i = 1; i < argc; i++) {
+        if (strlen(argv[i]) == 2 && argv[i][0] == '-') {
+            c = argv[i][1];
+            const char *nextarg = i < argc ? argv[i+1] : NULL;
+
+            switch (c) {
+            case 'a':
+                if (!nextarg) usage();
+                addr = nextarg;
+                i++;
+                break;
+            case 'm':
+                if (!nextarg) usage();
+                unsigned newc;
+                if (sscanf( nextarg, "%d", &newc) != 1) usage();
+                count = newc;
+                i++;
+                break;
+            default:
+                usage();
+            }
+        }
+        else usage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
index fbb1a83..d596ab1 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Container.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Container.h
@@ -56,6 +56,7 @@ class Container : public Handle<ContainerImpl>
     PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
     PROTON_CPP_EXTERN Sender createSender(std::string &url);
     PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
     PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
     PROTON_CPP_EXTERN std::string getContainerId();
   private:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
index 51ca731..ae29ca2 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Message.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Message.h
@@ -22,6 +22,7 @@
  *
  */
 #include "proton/cpp/ImportExport.h"
+#include "proton/cpp/ProtonHandle.h"
 #include "proton/message.h"
 #include <string>
 
@@ -29,22 +30,36 @@
 namespace proton {
 namespace reactor {
 
-class Message
+class Message : public ProtonHandle<pn_message_t>
 {
   public:
     PROTON_CPP_EXTERN Message();
-    PROTON_CPP_EXTERN ~Message();
+    PROTON_CPP_EXTERN Message(pn_message_t *);
     PROTON_CPP_EXTERN Message(const Message&);
     PROTON_CPP_EXTERN Message& operator=(const Message&);
+    PROTON_CPP_EXTERN ~Message();
+
+    PROTON_CPP_EXTERN pn_message_t *getPnMessage() const;
+
+    PROTON_CPP_EXTERN void setId(uint64_t id);
+    PROTON_CPP_EXTERN uint64_t getId();
+    PROTON_CPP_EXTERN pn_type_t getIdType();
 
-    PROTON_CPP_EXTERN pn_message_t *getPnMessage();
     PROTON_CPP_EXTERN void setBody(const std::string &data);
     PROTON_CPP_EXTERN std::string getBody();
+
+    PROTON_CPP_EXTERN void getBody(std::string &str);
+
+    PROTON_CPP_EXTERN void setBody(const char *, size_t len);
+    PROTON_CPP_EXTERN size_t getBody(char *, size_t len);
+    PROTON_CPP_EXTERN size_t getBinaryBodySize();
+
+
     PROTON_CPP_EXTERN void encode(std::string &data);
     PROTON_CPP_EXTERN void decode(const std::string &data);
 
   private:
-    pn_message_t *pnMessage;
+    friend class ProtonImplRef<Message>;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
index 8551c9c..ac8b483 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -32,10 +32,10 @@
 namespace proton {
 namespace reactor {
 
-// For now, stands in for Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
+// Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
 
 
-class MessagingAdapter : public ProtonHandler
+class MessagingAdapter : public MessagingHandler
 {
   public:
     PROTON_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
@@ -44,11 +44,37 @@ class MessagingAdapter : public ProtonHandler
     PROTON_CPP_EXTERN virtual void onLinkFlow(Event &e);
     PROTON_CPP_EXTERN virtual void onDelivery(Event &e);
     PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionError(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
     PROTON_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+    PROTON_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionClosed(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionClosing(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionError(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionOpened(Event &e);
+    PROTON_CPP_EXTERN virtual void onSessionOpening(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkClosed(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkClosing(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkError(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
     PROTON_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkOpened(Event &e);
+    PROTON_CPP_EXTERN virtual void onLinkOpening(Event &e);
+    PROTON_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
   private:
     MessagingHandler &delegate;  // The actual MessagingHandler
     pn_handler_t *handshaker;
+    bool autoSettle;
+    bool autoAccept;
+    bool peerCloseIsError;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
index d8d5c7f..de79618 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
@@ -37,17 +37,19 @@ typedef enum {
     PN_MESSAGING_ABORT,
     PN_MESSAGING_ACCEPTED,
     PN_MESSAGING_COMMIT,
-    PN_MESSAGING_CONNECTION_CLOSE,
     PN_MESSAGING_CONNECTION_CLOSED,
     PN_MESSAGING_CONNECTION_CLOSING,
-    PN_MESSAGING_CONNECTION_OPEN,
+    PN_MESSAGING_CONNECTION_ERROR,
     PN_MESSAGING_CONNECTION_OPENED,
+    PN_MESSAGING_CONNECTION_OPENING,
     PN_MESSAGING_DISCONNECTED,
     PN_MESSAGING_FETCH,
     PN_MESSAGING_ID_LOADED,
+    PN_MESSAGING_LINK_CLOSED,
     PN_MESSAGING_LINK_CLOSING,
     PN_MESSAGING_LINK_OPENED,
     PN_MESSAGING_LINK_OPENING,
+    PN_MESSAGING_LINK_ERROR,
     PN_MESSAGING_MESSAGE,
     PN_MESSAGING_QUIT,
     PN_MESSAGING_RECORD_INSERTED,
@@ -57,19 +59,25 @@ typedef enum {
     PN_MESSAGING_REQUEST,
     PN_MESSAGING_RESPONSE,
     PN_MESSAGING_SENDABLE,
+    PN_MESSAGING_SESSION_CLOSED,
+    PN_MESSAGING_SESSION_CLOSING,
+    PN_MESSAGING_SESSION_OPENED,
+    PN_MESSAGING_SESSION_OPENING,
+    PN_MESSAGING_SESSION_ERROR,
     PN_MESSAGING_SETTLED,
     PN_MESSAGING_START,
     PN_MESSAGING_TIMER,
     PN_MESSAGING_TRANSACTION_ABORTED,
     PN_MESSAGING_TRANSACTION_COMMITTED,
-    PN_MESSAGING_TRANSACTION_DECLARED
+    PN_MESSAGING_TRANSACTION_DECLARED,
+    PN_MESSAGING_TRANSPORT_CLOSED
 } MessagingEventType_t;
 
 class MessagingEvent : public ProtonEvent
 {
   public:
     MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
-    MessagingEvent(MessagingEventType_t t, ProtonEvent *parent, Container &c);
+    MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
     ~MessagingEvent();
     virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
     virtual PROTON_CPP_EXTERN Connection &getConnection();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index 875af43..51f679a 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -34,20 +34,23 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler
 {
   public:
     PROTON_CPP_EXTERN MessagingHandler();
+//ZZZ    PROTON_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, autoSettle=true, peerCloseIsError=false);
     virtual ~MessagingHandler();
 
     virtual void onAbort(Event &e);
     virtual void onAccepted(Event &e);
     virtual void onCommit(Event &e);
-    virtual void onConnectionClose(Event &e);
     virtual void onConnectionClosed(Event &e);
     virtual void onConnectionClosing(Event &e);
-    virtual void onConnectionOpen(Event &e);
+    virtual void onConnectionError(Event &e);
+    virtual void onConnectionOpening(Event &e);
     virtual void onConnectionOpened(Event &e);
     virtual void onDisconnected(Event &e);
     virtual void onFetch(Event &e);
     virtual void onIdLoaded(Event &e);
+    virtual void onLinkClosed(Event &e);
     virtual void onLinkClosing(Event &e);
+    virtual void onLinkError(Event &e);
     virtual void onLinkOpened(Event &e);
     virtual void onLinkOpening(Event &e);
     virtual void onMessage(Event &e);
@@ -59,12 +62,18 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler
     virtual void onRequest(Event &e);
     virtual void onResponse(Event &e);
     virtual void onSendable(Event &e);
+    virtual void onSessionClosed(Event &e);
+    virtual void onSessionClosing(Event &e);
+    virtual void onSessionError(Event &e);
+    virtual void onSessionOpened(Event &e);
+    virtual void onSessionOpening(Event &e);
     virtual void onSettled(Event &e);
     virtual void onStart(Event &e);
     virtual void onTimer(Event &e);
     virtual void onTransactionAborted(Event &e);
     virtual void onTransactionCommitted(Event &e);
     virtual void onTransactionDeclared(Event &e);
+    virtual void onTransportClosed(Event &e);
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/include/proton/cpp/Session.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h
index e556cde..68f5e40 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Session.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Session.h
@@ -27,6 +27,7 @@
 
 #include "proton/types.h"
 #include "proton/link.h"
+#include "ProtonImplRef.h"
 #include <string>
 
 struct pn_connection_t;
@@ -38,19 +39,22 @@ class Container;
 class Handler;
 class Transport;
 
-class Session : public Endpoint
+ class Session : public Endpoint, public ProtonHandle<pn_session_t>
 {
   public:
     PROTON_CPP_EXTERN Session(pn_session_t *s);
+    PROTON_CPP_EXTERN Session();
     PROTON_CPP_EXTERN ~Session();
     PROTON_CPP_EXTERN void open();
+    PROTON_CPP_EXTERN Session(const Session&);
+    PROTON_CPP_EXTERN Session& operator=(const Session&);
     PROTON_CPP_EXTERN void close();
     PROTON_CPP_EXTERN pn_session_t *getPnSession();
     virtual PROTON_CPP_EXTERN Connection &getConnection();
     Receiver createReceiver(std::string name);
     Sender createSender(std::string name);
   private:
-    pn_session_t *pnSession;
+    friend class ProtonImplRef<Session>;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
index e85b323..49d171e 100644
--- a/proton-c/bindings/cpp/src/Connection.cpp
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -35,7 +35,7 @@ namespace reactor {
 template class Handle<ConnectionImpl>;
 typedef PrivateImplRef<Connection> PI;
 
-Connection::Connection() {}
+Connection::Connection() {PI::ctor(*this, 0); }
 Connection::Connection(ConnectionImpl* p) { PI::ctor(*this, p); }
 Connection::Connection(const Connection& c) : Handle<ConnectionImpl>() { PI::copy(*this, c); }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
index 2feecb5..be01f8d 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -22,6 +22,7 @@
 #include "proton/cpp/Handler.h"
 #include "proton/cpp/exceptions.h"
 #include "ConnectionImpl.h"
+#include "proton/cpp/Transport.h"
 #include "Msg.h"
 #include "contexts.h"
 
@@ -47,7 +48,10 @@ ConnectionImpl::ConnectionImpl(Container &c) : container(c), refCount(0), overri
     setConnectionContext(pnConnection, this);
 }
 
-ConnectionImpl::~ConnectionImpl() {}
+ConnectionImpl::~ConnectionImpl() {
+    delete transport;
+    delete override;
+}
 
 Transport &ConnectionImpl::getTransport() {
     if (transport)
@@ -56,7 +60,11 @@ Transport &ConnectionImpl::getTransport() {
 }
 
 Handler* ConnectionImpl::getOverride() { return override; }
-void ConnectionImpl::setOverride(Handler *h) { override = h; }
+void ConnectionImpl::setOverride(Handler *h) {
+    if (override)
+        delete override;
+    override = h;
+}
 
 void ConnectionImpl::open() {
     pn_connection_open(pnConnection);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/Connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connector.cpp b/proton-c/bindings/cpp/src/Connector.cpp
index 6885575..8ebdfb6 100644
--- a/proton-c/bindings/cpp/src/Connector.cpp
+++ b/proton-c/bindings/cpp/src/Connector.cpp
@@ -62,15 +62,14 @@ void Connector::onConnectionRemoteOpen(Event &e) {
 }
 
 void Connector::onConnectionInit(Event &e) {
-
 }
 
 void Connector::onTransportClosed(Event &e) {
     // TODO: prepend with reconnect logic
     PN_CPP_LOG(info, "Disconnected");
-    connection.setOverride(0);  // No more call backs
     pn_connection_release(connection.impl->pnConnection);
-    delete this;
+    // No more interaction, so drop our counted reference.
+    connection = Connection();
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index 8e79b15..4eccb15 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -74,6 +74,10 @@ Receiver Container::createReceiver(Connection &connection, std::string &addr) {
     return impl->createReceiver(connection, addr);
 }
 
+Receiver Container::createReceiver(const std::string &url) {
+    return impl->createReceiver(url);
+}
+
 Acceptor Container::listen(const std::string &urlString) {
     return impl->listen(urlString);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 7ff9c1d..df8c716 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -37,6 +37,7 @@
 
 #include "proton/connection.h"
 #include "proton/session.h"
+#include "proton/handlers.h"
 
 namespace proton {
 namespace reactor {
@@ -64,23 +65,20 @@ class CHandler : public Handler
         pn_decref(pnHandler);
     }
     pn_handler_t *getPnHandler() { return pnHandler; }
+
+    virtual void onUnhandled(Event &e) {
+        ProtonEvent *pne = dynamic_cast<ProtonEvent *>(&e);
+        if (!pne) return;
+        int type = pne->getType();
+        if (!type) return;  // Not from the reactor
+        pn_handler_dispatch(pnHandler, pne->getPnEvent(), (pn_event_type_t) type);
+    }
+
   private:
     pn_handler_t *pnHandler;
 };
 
 
-void dispatch(Handler &h, MessagingEvent &e) {
-    // TODO: also dispatch to add()'ed Handlers
-    CHandler *chandler;
-    int type = e.getType();
-    if (type &&  (chandler = dynamic_cast<CHandler*>(&h))) {
-        // event and handler are both native Proton C
-        pn_handler_dispatch(chandler->getPnHandler(), e.getPnEvent(), (pn_event_type_t) type);
-    }
-    else
-        e.dispatch(h);
-}
-
 // Used to sniff for Connector events before the reactor's global handler sees them.
 class OverrideHandler : public Handler
 {
@@ -109,8 +107,9 @@ class OverrideHandler : public Handler
             ConnectionImpl *connection = getConnectionContext(conn);
             if (connection) {
                 Handler *override = connection->getOverride();
-                if (override)
+                if (override) {
                     e.dispatch(*override);
+                }
             }
         }
 
@@ -127,6 +126,29 @@ class OverrideHandler : public Handler
     }
 };
 
+
+class CFlowController : public ProtonHandler
+{
+  public:
+    pn_handler_t *flowcontroller;
+
+    CFlowController(int window) : flowcontroller(pn_flowcontroller(window)) {}
+    ~CFlowController() {
+        pn_decref(flowcontroller);
+    }
+
+    void redirect(Event &e) {
+        ProtonEvent *pne = dynamic_cast<ProtonEvent *>(&e);
+        pn_handler_dispatch(flowcontroller, pne->getPnEvent(), (pn_event_type_t) pne->getType());
+    }
+
+    virtual void onLinkLocalOpen(Event &e) { redirect(e); }
+    virtual void onLinkRemoteOpen(Event &e) { redirect(e); }
+    virtual void onLinkFlow(Event &e) { redirect(e); }
+    virtual void onDelivery(Event &e) { redirect(e); }
+};
+
+
 namespace {
 
 // TODO: configurable policy.  SessionPerConnection for now.
@@ -162,8 +184,8 @@ Handler &getCppHandler(pn_handler_t *c_handler) {
 
 void cpp_handler_dispatch(pn_handler_t *c_handler, pn_event_t *cevent, pn_event_type_t type)
 {
-    MessagingEvent ev(cevent, type, getContainerRef(c_handler));
-    dispatch(getCppHandler(c_handler), ev);
+    MessagingEvent mevent(cevent, type, getContainerRef(c_handler));
+    mevent.dispatch(getCppHandler(c_handler));
 }
 
 void cpp_handler_cleanup(pn_handler_t *c_handler)
@@ -176,7 +198,7 @@ pn_handler_t *cpp_handler(ContainerImpl *c, Handler *h)
 {
     pn_handler_t *handler = pn_handler_new(cpp_handler_dispatch, sizeof(struct InboundContext), cpp_handler_cleanup);
     struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(handler);
-    ctxt->containerRef = Container(c);
+    new (&ctxt->containerRef) Container(c);
     ctxt->containerImpl = c;
     ctxt->cppHandler = h;
     return handler;
@@ -254,6 +276,17 @@ Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr
     return rcv;
 }
 
+Receiver ContainerImpl::createReceiver(const std::string &urlString) {
+    // TODO: const cleanup of API
+    Connection conn = connect(const_cast<std::string &>(urlString));
+    Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
+    std::string path = Url(urlString).getPath();
+    Receiver rcv = session.createReceiver(containerId + '-' + path);
+    pn_terminus_set_address(pn_link_source(rcv.getPnLink()), path.c_str());
+    rcv.open();
+    return rcv;
+}
+
 Acceptor ContainerImpl::acceptor(const std::string &host, const std::string &port) {
     pn_acceptor_t *acptr = pn_reactor_acceptor(reactor, host.c_str(), port.c_str(), NULL);
     if (acptr)
@@ -271,11 +304,20 @@ Acceptor ContainerImpl::listen(const std::string &urlString) {
 
 void ContainerImpl::run() {
     reactor = pn_reactor();
+
     // Set our context on the reactor
     setContainerContext(reactor, this);
 
+    int prefetch = 10; // TODO: configurable
+    Handler *flowController = 0;
+
+
     // Set the reactor's main/default handler (see note below)
     MessagingAdapter messagingAdapter(messagingHandler);
+    if (prefetch) {
+        flowController = new CFlowController(prefetch);
+        messagingHandler.addChildHandler(*flowController);
+    }
     messagingHandler.addChildHandler(messagingAdapter);
     pn_handler_t *cppHandler = cpp_handler(this, &messagingHandler);
     pn_reactor_set_handler(reactor, cppHandler);
@@ -287,15 +329,18 @@ void ContainerImpl::run() {
     pn_handler_t *cppGlobalHandler = cpp_handler(this, &overrideHandler);
     pn_reactor_set_global_handler(reactor, cppGlobalHandler);
 
-    // Note: we have just set up the following 4 handlers that see events in this order:
-    // messagingHandler, messagingAdapter, connector override, the reactor's default global
-    // handler (pn_iohandler)
-    // TODO: remove fifth pn_handshaker once messagingAdapter matures
-
+    // Note: we have just set up the following 4/5 handlers that see events in this order:
+    // messagingHandler (Proton C events), pn_flowcontroller (optional), messagingAdapter,
+    // messagingHandler (Messaging events from the messagingAdapter), connector override,
+    // the reactor's default globalhandler (pn_iohandler)
     pn_reactor_run(reactor);
+
+    pn_decref(cppHandler);
+    pn_decref(cppGlobalHandler);
     pn_decref(cGlobalHandler);
     pn_reactor_free(reactor);
     reactor = 0;
+    delete(flowController);
 }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
index a14bf52..8a6faba 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.h
+++ b/proton-c/bindings/cpp/src/ContainerImpl.h
@@ -49,6 +49,7 @@ class ContainerImpl
     PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
     PROTON_CPP_EXTERN Sender createSender(std::string &url);
     PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url); //ZZZ
     PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
     PROTON_CPP_EXTERN std::string getContainerId();
     static void incref(ContainerImpl *);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/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 840a10b..ead6eb1 100644
--- a/proton-c/bindings/cpp/src/Message.cpp
+++ b/proton-c/bindings/cpp/src/Message.cpp
@@ -22,33 +22,128 @@
 #include "proton/cpp/Message.h"
 #include "proton/cpp/exceptions.h"
 #include "Msg.h"
+#include "ProtonImplRef.h"
+
+#include <cstring>
 
 namespace proton {
 namespace reactor {
 
-Message::Message() : pnMessage(pn_message()){}
+template class ProtonHandle<pn_message_t>;
+typedef ProtonImplRef<Message> PI;
 
-Message::~Message() {
-    pn_decref(pnMessage);
+Message::Message() {
+    PI::ctor(*this, 0);
+}
+Message::Message(pn_message_t *p) {
+    PI::ctor(*this, p);
 }
+Message::Message(const Message& m) : ProtonHandle<pn_message_t>() {
+    PI::copy(*this, m);
+}
+Message& Message::operator=(const Message& m) {
+    return PI::assign(*this, m);
+}
+Message::~Message() { PI::dtor(*this); }
 
-Message::Message(const Message& m) : pnMessage(m.pnMessage) {
-    pn_incref(pnMessage);
+namespace {
+void confirm(pn_message_t *&p) {
+    if (p) return;
+    p = pn_message(); // Correct refcount of 1
+    if (!p)
+        throw ProtonException(MSG("No memory"));
 }
 
-Message& Message::operator=(const Message& m) {
-    pnMessage = m.pnMessage;
-    pn_incref(pnMessage);
-    return *this;
+void getFormatedStringContent(pn_data_t *data, std::string &str) {
+    pn_data_rewind(data);
+    size_t sz = str.capacity();
+    if (sz < 512) sz = 512;
+    while (true) {
+        str.resize(sz);
+        int err = pn_data_format(data, (char *) str.data(), &sz);
+        if (err) {
+            if (err != PN_OVERFLOW)
+                throw ProtonException(MSG("Unexpected message body data error"));
+        }
+        else {
+            str.resize(sz);
+            return;
+        }
+        sz *= 2;
+    }
+}
+
+} // namespace
+
+void Message::setId(uint64_t id) {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_ulong(data, id))
+        throw ProtonException(MSG("setId error " << err));
+}
+
+uint64_t Message::getId() {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_ULONG) {
+        return pn_data_get_ulong(data);
+    }
+    throw ProtonException(MSG("Message ID is not a ULONG"));
+}
+
+pn_type_t Message::getIdType() {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data)) {
+        pn_type_t type = pn_data_type(data);
+        switch (type) {
+        case PN_ULONG:
+        case PN_STRING:
+        case PN_BINARY:
+        case PN_UUID:
+            return type;
+            break;
+        default:
+            break;
+        }
+    }
+    return PN_NULL;
 }
 
 void Message::setBody(const std::string &buf) {
-    pn_data_t *body = pn_message_body(pnMessage);
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_clear(body);
     pn_data_put_string(body, pn_bytes(buf.size(), buf.data()));
 }
 
+void Message::getBody(std::string &str) {
+    // User supplied string/buffer
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_rewind(body);
+
+    if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
+        pn_bytes_t bytes= pn_data_get_string(body);
+        if (!pn_data_next(body)) {
+            // String data and nothing else
+            str.resize(bytes.size);
+            memmove((void *) str.data(), bytes.start, bytes.size);
+            return;
+        }
+    }
+
+    getFormatedStringContent(body, str);
+}
+
 std::string Message::getBody() {
-    pn_data_t *body = pn_message_body(pnMessage);
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_rewind(body);
+
     if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
         pn_bytes_t bytes= pn_data_get_string(body);
         if (!pn_data_next(body)) {
@@ -57,36 +152,73 @@ std::string Message::getBody() {
         }
     }
 
-    pn_data_rewind(body);
     std::string str;
-    size_t sz = 1024;
-    str.resize(sz);
-    int err = pn_data_format(body, (char *) str.data(), &sz);
-    if (err == PN_OVERFLOW)
-        throw ProtonException(MSG("TODO: sizing loop missing"));
-    if (err) throw ProtonException(MSG("Unexpected data error"));
-    str.resize(sz);
+    getFormatedStringContent(body, str);
     return str;
 }
 
+void Message::setBody(const char *bytes, size_t len) {
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_clear(body);
+    pn_data_put_binary(body, pn_bytes(len, bytes));
+}
+
+size_t Message::getBody(char *bytes, size_t len) {
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_rewind(body);
+    if (pn_data_size(body) == 1 && pn_data_next(body) && pn_data_type(body) == PN_BINARY) {
+        pn_bytes_t pnb = pn_data_get_binary(body);
+        if (len >= pnb.size) {
+            memmove(bytes, pnb.start, pnb.size);
+            return pnb.size;
+        }
+        throw ProtonException(MSG("Binary buffer too small"));
+    }
+    throw ProtonException(MSG("Not simple binary data"));
+}
+
+
+
+size_t Message::getBinaryBodySize() {
+    confirm(impl);
+    pn_data_t *body = pn_message_body(impl);
+    pn_data_rewind(body);
+    if (pn_data_size(body) == 1 && pn_data_next(body) && pn_data_type(body) == PN_BINARY) {
+        pn_bytes_t bytes = pn_data_get_binary(body);
+        return bytes.size;
+    }
+    return 0;
+}
+
+
 void Message::encode(std::string &s) {
-    size_t sz = 1024;
-    if (s.capacity() > sz)
-        sz = s.capacity();
-    else
-        s.reserve(sz);
-    s.resize(sz);
-    int err = pn_message_encode(pnMessage, (char *) s.data(), &sz);
-    if (err == PN_OVERFLOW)
-        throw ProtonException(MSG("TODO: fix overflow with dynamic buffer resizing"));
-    if (err) throw ProtonException(MSG("unexpected error"));
-    s.resize(sz);
+    confirm(impl);
+    size_t sz = s.capacity();
+    if (sz < 512) sz = 512;
+    while (true) {
+        s.resize(sz);
+        int err = pn_message_encode(impl, (char *) s.data(), &sz);
+        if (err) {
+            if (err != PN_OVERFLOW)
+                throw ProtonException(MSG("unexpected error"));
+        } else {
+            s.resize(sz);
+            return;
+        }
+        sz *= 2;
+    }
 }
 
 void Message::decode(const std::string &s) {
-    int err = pn_message_decode(pnMessage, s.data(), s.size());
+    confirm(impl);
+    int err = pn_message_decode(impl, s.data(), s.size());
     if (err) throw ProtonException(MSG("unexpected error"));
 }
 
+pn_message_t *Message::getPnMessage() const {
+    return impl;
+}
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index 9cab2b3..1097305 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -28,23 +28,26 @@
 #include "proton/handlers.h"
 #include "proton/delivery.h"
 #include "proton/connection.h"
+#include "proton/session.h"
 
 namespace proton {
 namespace reactor {
 
-MessagingAdapter::MessagingAdapter(MessagingHandler &d) : delegate(d), handshaker(pn_handshaker()) {
-    pn_handler_t *flowcontroller = pn_flowcontroller(10);
-    pn_handler_add(handshaker, flowcontroller);
-    pn_decref(flowcontroller);
+MessagingAdapter::MessagingAdapter(MessagingHandler &d) : delegate(d), handshaker(pn_handshaker()),
+                                                          autoSettle(true), autoAccept(true),
+                                                          peerCloseIsError(false) {
 };
 MessagingAdapter::~MessagingAdapter(){
     pn_decref(handshaker);
 };
 
+
 void MessagingAdapter::onReactorInit(Event &e) {
-    // create onStart extended event
-    MessagingEvent mevent(PN_MESSAGING_START, NULL, e.getContainer());
-    mevent.dispatch(delegate);
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        MessagingEvent mevent(PN_MESSAGING_START, *pe);
+        delegate.onStart(mevent);
+    }
 }
 
 void MessagingAdapter::onLinkFlow(Event &e) {
@@ -54,8 +57,8 @@ void MessagingAdapter::onLinkFlow(Event &e) {
         pn_link_t *lnk = pn_event_link(pne);
         if (lnk && pn_link_is_sender(lnk) && pn_link_credit(lnk) > 0) {
             // create onMessage extended event
-            MessagingEvent mevent(PN_MESSAGING_SENDABLE, pe, e.getContainer());
-            mevent.dispatch(delegate);
+            MessagingEvent mevent(PN_MESSAGING_SENDABLE, *pe);
+            delegate.onSendable(mevent);;
         }
    }
 }
@@ -85,32 +88,60 @@ void MessagingAdapter::onDelivery(Event &e) {
         if (pn_link_is_receiver(lnk)) {
             if (!pn_delivery_partial(dlv) && pn_delivery_readable(dlv)) {
                 // generate onMessage
-                MessagingEvent mevent(PN_MESSAGING_MESSAGE, pe, pe->getContainer());
+                MessagingEvent mevent(PN_MESSAGING_MESSAGE, *pe);
                 Message m(receiveMessage(lnk, dlv));
                 mevent.setMessage(m);
-                // TODO: check if endpoint closed...
-                mevent.dispatch(delegate);
-                // only do auto accept for now
-                pn_delivery_update(dlv, PN_ACCEPTED);
-                pn_delivery_settle(dlv);
-                // TODO: generate onSettled
+                if (pn_link_state(lnk) & PN_LOCAL_CLOSED) {
+                    if (autoAccept) {
+                        pn_delivery_update(dlv, PN_RELEASED);
+                        pn_delivery_settle(dlv);
+                    }
+                }
+                else {
+                    try {
+                        delegate.onMessage(mevent);
+                        if (autoAccept) {
+                            pn_delivery_update(dlv, PN_ACCEPTED);
+                            pn_delivery_settle(dlv);
+                        }
+                    }
+                    catch (MessageReject &) {
+                        pn_delivery_update(dlv, PN_REJECTED);
+                        pn_delivery_settle(dlv);
+                    }
+                    catch (MessageRelease &) {
+                        pn_delivery_update(dlv, PN_REJECTED);
+                        pn_delivery_settle(dlv);
+                    }
+                }
+            }
+            else if (pn_delivery_updated(dlv) && pn_delivery_settled(dlv)) {
+                MessagingEvent mevent(PN_MESSAGING_SETTLED, *pe);
+                delegate.onSettled(mevent);
             }
         } else {
             // Sender
             if (pn_delivery_updated(dlv)) {
                 uint64_t rstate = pn_delivery_remote_state(dlv);
-                if (rstate == PN_ACCEPTED)
-                    // generate onAccepted
-                    MessagingEvent(PN_MESSAGING_ACCEPTED, pe, pe->getContainer()).dispatch(delegate);
-                else if (rstate = PN_REJECTED)
-                    MessagingEvent(PN_MESSAGING_REJECTED, pe, pe->getContainer()).dispatch(delegate);
-                else if (rstate == PN_RELEASED || rstate == PN_MODIFIED)
-                    MessagingEvent(PN_MESSAGING_RELEASED, pe, pe->getContainer()).dispatch(delegate);
-
-                if (pn_delivery_settled(dlv))
-                    MessagingEvent(PN_MESSAGING_SETTLED, pe, pe->getContainer()).dispatch(delegate);
-
-                pn_delivery_settle(dlv); // TODO: only if auto settled
+                if (rstate == PN_ACCEPTED) {
+                    MessagingEvent mevent(PN_MESSAGING_ACCEPTED, *pe);
+                    delegate.onAccepted(mevent);
+                }
+                else if (rstate = PN_REJECTED) {
+                    MessagingEvent mevent(PN_MESSAGING_REJECTED, *pe);
+                    delegate.onRejected(mevent);
+                }
+                else if (rstate == PN_RELEASED || rstate == PN_MODIFIED) {
+                    MessagingEvent mevent(PN_MESSAGING_RELEASED, *pe);
+                    delegate.onReleased(mevent);
+                }
+
+                if (pn_delivery_settled(dlv)) {
+                    MessagingEvent mevent(PN_MESSAGING_SETTLED, *pe);
+                    delegate.onSettled(mevent);
+                }
+                if (autoSettle)
+                    pn_delivery_settle(dlv);
             }
         }
     }
@@ -140,52 +171,247 @@ bool isRemoteClosed(pn_state_t state) {
 
 } // namespace
 
+void MessagingAdapter::onLinkRemoteClose(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *cevent = pe->getPnEvent();
+        pn_link_t *lnk = pn_event_link(cevent);
+        pn_state_t state = pn_link_state(lnk);
+        if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
+            MessagingEvent mevent(PN_MESSAGING_LINK_ERROR, *pe);
+            onLinkError(mevent);
+        }
+        else if (isLocalClosed(state)) {
+            MessagingEvent mevent(PN_MESSAGING_LINK_CLOSED, *pe);
+            onLinkClosed(mevent);
+        }
+        else {
+            MessagingEvent mevent(PN_MESSAGING_LINK_CLOSING, *pe);
+            onLinkClosing(mevent);
+        }
+        pn_link_close(lnk);
+    }
+}
+
+void MessagingAdapter::onSessionRemoteClose(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *cevent = pe->getPnEvent();
+        pn_session_t *session = pn_event_session(cevent);
+        pn_state_t state = pn_session_state(session);
+        if (pn_condition_is_set(pn_session_remote_condition(session))) {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_ERROR, *pe);
+            onSessionError(mevent);
+        }
+        else if (isLocalClosed(state)) {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_CLOSED, *pe);
+            onSessionClosed(mevent);
+        }
+        else {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_CLOSING, *pe);
+            onSessionClosing(mevent);
+        }
+        pn_session_close(session);
+    }
+}
+
 void MessagingAdapter::onConnectionRemoteClose(Event &e) {
     ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
     if (pe) {
         pn_event_t *cevent = pe->getPnEvent();
-        pn_connection_t *conn = pn_event_connection(cevent);
-        // TODO: remote condition -> error
-        if (isLocalClosed(pn_connection_state(conn))) {
-            MessagingEvent(PN_MESSAGING_CONNECTION_CLOSED, pe, pe->getContainer()).dispatch(delegate);
+        pn_connection_t *connection = pn_event_connection(cevent);
+        pn_state_t state = pn_connection_state(connection);
+        if (pn_condition_is_set(pn_connection_remote_condition(connection))) {
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_ERROR, *pe);
+            onConnectionError(mevent);
+        }
+        else if (isLocalClosed(state)) {
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_CLOSED, *pe);
+            onConnectionClosed(mevent);
         }
         else {
-            MessagingEvent(PN_MESSAGING_CONNECTION_CLOSING, pe, pe->getContainer()).dispatch(delegate);
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_CLOSING, *pe);
+            onConnectionClosing(mevent);
+        }
+        pn_connection_close(connection);
+    }
+}
+
+void MessagingAdapter::onConnectionLocalOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_connection_t *connection = pn_event_connection(pe->getPnEvent());
+        if (isRemoteOpen(pn_connection_state(connection))) {
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_OPENED, *pe);
+            onConnectionOpened(mevent);
+        }
+    }
+}
+
+void MessagingAdapter::onConnectionRemoteOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_connection_t *connection = pn_event_connection(pe->getPnEvent());
+        if (isLocalOpen(pn_connection_state(connection))) {
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_OPENED, *pe);
+            onConnectionOpened(mevent);
+        }
+        else if (isLocalUnititialised(pn_connection_state(connection))) {
+            MessagingEvent mevent(PN_MESSAGING_CONNECTION_OPENING, *pe);
+            onConnectionOpening(mevent);
+            pn_connection_open(connection);
+        }
+    }
+}
+
+void MessagingAdapter::onSessionLocalOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_session_t *session = pn_event_session(pe->getPnEvent());
+        if (isRemoteOpen(pn_session_state(session))) {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_OPENED, *pe);
+            onSessionOpened(mevent);
+        }
+    }
+}
+
+void MessagingAdapter::onSessionRemoteOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_session_t *session = pn_event_session(pe->getPnEvent());
+        if (isLocalOpen(pn_session_state(session))) {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_OPENED, *pe);
+            onSessionOpened(mevent);
+        }
+        else if (isLocalUnititialised(pn_session_state(session))) {
+            MessagingEvent mevent(PN_MESSAGING_SESSION_OPENING, *pe);
+            onSessionOpening(mevent);
+            pn_session_open(session);
         }
-        pn_connection_close(conn);
     }
 }
 
+void MessagingAdapter::onLinkLocalOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_link_t *link = pn_event_link(pe->getPnEvent());
+        if (isRemoteOpen(pn_link_state(link))) {
+            MessagingEvent mevent(PN_MESSAGING_LINK_OPENED, *pe);
+            onLinkOpened(mevent);
+        }
+    }
+}
 
 void MessagingAdapter::onLinkRemoteOpen(Event &e) {
     ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
     if (pe) {
-        pn_event_t *cevent = pe->getPnEvent();
-        pn_link_t *link = pn_event_link(cevent);
-        // TODO: remote condition -> error
+        pn_link_t *link = pn_event_link(pe->getPnEvent());
         if (isLocalOpen(pn_link_state(link))) {
-            MessagingEvent(PN_MESSAGING_LINK_OPENED, pe, pe->getContainer()).dispatch(delegate);
+            MessagingEvent mevent(PN_MESSAGING_LINK_OPENED, *pe);
+            onLinkOpened(mevent);
         }
         else if (isLocalUnititialised(pn_link_state(link))) {
-            MessagingEvent(PN_MESSAGING_LINK_OPENING, pe, pe->getContainer()).dispatch(delegate);
+            MessagingEvent mevent(PN_MESSAGING_LINK_OPENING, *pe);
+            onLinkOpening(mevent);
             pn_link_open(link);
         }
     }
 }
 
+void MessagingAdapter::onTransportTailClosed(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_connection_t *conn = pn_event_connection(pe->getPnEvent());
+        if (conn && isLocalOpen(pn_connection_state(conn))) {
+            MessagingEvent mevent(PN_MESSAGING_DISCONNECTED, *pe);
+            delegate.onDisconnected(mevent);
+        }
+    }
+}
+
 
-void MessagingAdapter::onUnhandled(Event &e) {
-    // Until this code fleshes out closer to python's, cheat a bit with a pn_handshaker
+void MessagingAdapter::onConnectionOpened(Event &e) {
+    delegate.onConnectionOpened(e);
+}
 
+void MessagingAdapter::onSessionOpened(Event &e) {
+    delegate.onSessionOpened(e);
+}
+
+void MessagingAdapter::onLinkOpened(Event &e) {
+    delegate.onLinkOpened(e);
+}
+
+void MessagingAdapter::onConnectionOpening(Event &e) {
+    delegate.onConnectionOpening(e);
+}
+
+void MessagingAdapter::onSessionOpening(Event &e) {
+    delegate.onSessionOpening(e);
+}
+
+void MessagingAdapter::onLinkOpening(Event &e) {
+    delegate.onLinkOpening(e);
+}
+
+void MessagingAdapter::onConnectionError(Event &e) {
+    delegate.onConnectionError(e);
     ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
     if (pe) {
-        pn_event_type_t type = (pn_event_type_t) pe->getType();
-        if (type != PN_EVENT_NONE) {
-            pn_handler_dispatch(handshaker, pe->getPnEvent(), type);
-        }
+        pn_connection_t *connection = pn_event_connection(pe->getPnEvent());
+        pn_connection_close(connection);
+    }
+}
+
+void MessagingAdapter::onSessionError(Event &e) {
+    delegate.onSessionError(e);
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_session_t *session = pn_event_session(pe->getPnEvent());
+        pn_session_close(session);
     }
 }
 
+void MessagingAdapter::onLinkError(Event &e) {
+    delegate.onLinkError(e);
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_link_t *link = pn_event_link(pe->getPnEvent());
+        pn_link_close(link);
+    }
+}
+
+void MessagingAdapter::onConnectionClosed(Event &e) {
+    delegate.onConnectionClosed(e);
+}
 
+void MessagingAdapter::onSessionClosed(Event &e) {
+    delegate.onSessionClosed(e);
+}
+
+void MessagingAdapter::onLinkClosed(Event &e) {
+    delegate.onLinkClosed(e);
+}
+
+void MessagingAdapter::onConnectionClosing(Event &e) {
+    delegate.onConnectionClosing(e);
+    if (peerCloseIsError)
+        onConnectionError(e);
+}
+
+void MessagingAdapter::onSessionClosing(Event &e) {
+    delegate.onSessionClosing(e);
+    if (peerCloseIsError)
+        onSessionError(e);
+}
+
+void MessagingAdapter::onLinkClosing(Event &e) {
+    delegate.onLinkClosing(e);
+    if (peerCloseIsError)
+        onLinkError(e);
+}
+
+void MessagingAdapter::onUnhandled(Event &e) {
+}
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/MessagingEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingEvent.cpp b/proton-c/bindings/cpp/src/MessagingEvent.cpp
index bcfb721..b8a2f8a 100644
--- a/proton-c/bindings/cpp/src/MessagingEvent.cpp
+++ b/proton-c/bindings/cpp/src/MessagingEvent.cpp
@@ -24,6 +24,7 @@
 #include "proton/link.h"
 
 #include "proton/cpp/MessagingEvent.h"
+#include "proton/cpp/Message.h"
 #include "proton/cpp/ProtonHandler.h"
 #include "proton/cpp/MessagingHandler.h"
 #include "proton/cpp/exceptions.h"
@@ -37,8 +38,8 @@ MessagingEvent::MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c)
     ProtonEvent(ce, t, c), messagingType(PN_MESSAGING_PROTON), parentEvent(0), message(0)
 {}
 
-MessagingEvent::MessagingEvent(MessagingEventType_t t, ProtonEvent *p, Container &c) :
-    ProtonEvent(NULL, PN_EVENT_NONE, c), messagingType(t), parentEvent(p), message(0) {
+MessagingEvent::MessagingEvent(MessagingEventType_t t, ProtonEvent &p) :
+    ProtonEvent(NULL, PN_EVENT_NONE, p.getContainer()), messagingType(t), parentEvent(&p), message(0) {
     if (messagingType == PN_MESSAGING_PROTON)
         throw ProtonException(MSG("invalid messaging event type"));
 }
@@ -80,16 +81,18 @@ Link MessagingEvent::getLink() {
 }
 
 Message MessagingEvent::getMessage() {
-    if (message)
-        return *message;
+    if (parentEvent) {
+        pn_message_t *m = getEventContext(parentEvent->getPnEvent());
+        if (m)
+            return Message(m);
+    }
     throw ProtonException(MSG("No message context for event"));
 }
 
 void MessagingEvent::setMessage(Message &m) {
-    if (messagingType != PN_MESSAGING_MESSAGE)
+    if (messagingType != PN_MESSAGING_MESSAGE || !parentEvent)
         throw ProtonException(MSG("Event type does not provide message"));
-    delete message;
-    message = new Message(m);
+    setEventContext(parentEvent->getPnEvent(), m.getPnMessage());
 }
 
 void MessagingEvent::dispatch(Handler &h) {
@@ -112,9 +115,23 @@ void MessagingEvent::dispatch(Handler &h) {
 
         case PN_MESSAGING_CONNECTION_CLOSING:     handler->onConnectionClosing(*this); break;
         case PN_MESSAGING_CONNECTION_CLOSED:      handler->onConnectionClosed(*this); break;
+        case PN_MESSAGING_CONNECTION_ERROR:       handler->onConnectionError(*this); break;
+        case PN_MESSAGING_CONNECTION_OPENING:     handler->onConnectionOpening(*this); break;
+        case PN_MESSAGING_CONNECTION_OPENED:      handler->onConnectionOpened(*this); break;
+
+        case PN_MESSAGING_LINK_CLOSED:            handler->onLinkClosed(*this); break;
+        case PN_MESSAGING_LINK_CLOSING:           handler->onLinkClosing(*this); break;
+        case PN_MESSAGING_LINK_ERROR:             handler->onLinkError(*this); break;
         case PN_MESSAGING_LINK_OPENING:           handler->onLinkOpening(*this); break;
         case PN_MESSAGING_LINK_OPENED:            handler->onLinkOpened(*this); break;
 
+        case PN_MESSAGING_SESSION_CLOSED:         handler->onSessionClosed(*this); break;
+        case PN_MESSAGING_SESSION_CLOSING:        handler->onSessionClosing(*this); break;
+        case PN_MESSAGING_SESSION_ERROR:          handler->onSessionError(*this); break;
+        case PN_MESSAGING_SESSION_OPENING:        handler->onSessionOpening(*this); break;
+        case PN_MESSAGING_SESSION_OPENED:         handler->onSessionOpened(*this); break;
+
+        case PN_MESSAGING_TRANSPORT_CLOSED:       handler->onTransportClosed(*this); break;
         default:
             throw ProtonException(MSG("Unkown messaging event type " << messagingType));
             break;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
index 7cb48f6..6066b07 100644
--- a/proton-c/bindings/cpp/src/MessagingHandler.cpp
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -30,15 +30,17 @@ MessagingHandler::~MessagingHandler(){};
 void MessagingHandler::onAbort(Event &e) { onUnhandled(e); }
 void MessagingHandler::onAccepted(Event &e) { onUnhandled(e); }
 void MessagingHandler::onCommit(Event &e) { onUnhandled(e); }
-void MessagingHandler::onConnectionClose(Event &e) { onUnhandled(e); }
 void MessagingHandler::onConnectionClosed(Event &e) { onUnhandled(e); }
 void MessagingHandler::onConnectionClosing(Event &e) { onUnhandled(e); }
-void MessagingHandler::onConnectionOpen(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionError(Event &e) { onUnhandled(e); }
 void MessagingHandler::onConnectionOpened(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionOpening(Event &e) { onUnhandled(e); }
 void MessagingHandler::onDisconnected(Event &e) { onUnhandled(e); }
 void MessagingHandler::onFetch(Event &e) { onUnhandled(e); }
 void MessagingHandler::onIdLoaded(Event &e) { onUnhandled(e); }
+void MessagingHandler::onLinkClosed(Event &e) { onUnhandled(e); }
 void MessagingHandler::onLinkClosing(Event &e) { onUnhandled(e); }
+void MessagingHandler::onLinkError(Event &e) { onUnhandled(e); }
 void MessagingHandler::onLinkOpened(Event &e) { onUnhandled(e); }
 void MessagingHandler::onLinkOpening(Event &e) { onUnhandled(e); }
 void MessagingHandler::onMessage(Event &e) { onUnhandled(e); }
@@ -50,11 +52,17 @@ void MessagingHandler::onReleased(Event &e) { onUnhandled(e); }
 void MessagingHandler::onRequest(Event &e) { onUnhandled(e); }
 void MessagingHandler::onResponse(Event &e) { onUnhandled(e); }
 void MessagingHandler::onSendable(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSessionClosed(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSessionClosing(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSessionError(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSessionOpened(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSessionOpening(Event &e) { onUnhandled(e); }
 void MessagingHandler::onSettled(Event &e) { onUnhandled(e); }
 void MessagingHandler::onStart(Event &e) { onUnhandled(e); }
 void MessagingHandler::onTimer(Event &e) { onUnhandled(e); }
 void MessagingHandler::onTransactionAborted(Event &e) { onUnhandled(e); }
 void MessagingHandler::onTransactionCommitted(Event &e) { onUnhandled(e); }
 void MessagingHandler::onTransactionDeclared(Event &e) { onUnhandled(e); }
+void MessagingHandler::onTransportClosed(Event &e) { onUnhandled(e); }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/Session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Session.cpp b/proton-c/bindings/cpp/src/Session.cpp
index d2b01dd..4333dcf 100644
--- a/proton-c/bindings/cpp/src/Session.cpp
+++ b/proton-c/bindings/cpp/src/Session.cpp
@@ -30,34 +30,43 @@
 namespace proton {
 namespace reactor {
 
+template class ProtonHandle<pn_session_t>;
+typedef ProtonImplRef<Session> PI;
 
-Session::Session(pn_session_t *s) : pnSession(s)
-{
-    pn_incref(pnSession);
+Session::Session(pn_session_t *p) {
+    PI::ctor(*this, p);
+}
+Session::Session() {
+    PI::ctor(*this, 0);
+}
+Session::Session(const Session& c) : ProtonHandle<pn_session_t>() {
+    PI::copy(*this, c);
+}
+Session& Session::operator=(const Session& c) {
+    return PI::assign(*this, c);
 }
-
 Session::~Session() {
-    pn_decref(pnSession);
+    PI::dtor(*this);
 }
 
-pn_session_t *Session::getPnSession() { return pnSession; }
+pn_session_t *Session::getPnSession() { return impl; }
 
 void Session::open() {
-    pn_session_open(pnSession);
+    pn_session_open(impl);
 }
 
 Connection &Session::getConnection() {
-    pn_connection_t *c = pn_session_connection(pnSession);
+    pn_connection_t *c = pn_session_connection(impl);
     return ConnectionImpl::getReactorReference(c);
 }
 
 Receiver Session::createReceiver(std::string name) {
-    pn_link_t *link = pn_receiver(pnSession, name.c_str());
+    pn_link_t *link = pn_receiver(impl, name.c_str());
     return Receiver(link);
 }
 
 Sender Session::createSender(std::string name) {
-    pn_link_t *link = pn_sender(pnSession, name.c_str());
+    pn_link_t *link = pn_sender(impl, name.c_str());
     return Sender(link);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
index b1dec49..56483ff 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -23,13 +23,13 @@
 #include "proton/cpp/exceptions.h"
 #include "Msg.h"
 #include "proton/object.h"
+#include "proton/message.h"
 #include "proton/session.h"
 #include "proton/link.h"
 
 PN_HANDLE(PNI_CPP_CONNECTION_CONTEXT)
-PN_HANDLE(PNI_CPP_SESSION_CONTEXT)
-PN_HANDLE(PNI_CPP_LINK_CONTEXT)
 PN_HANDLE(PNI_CPP_CONTAINER_CONTEXT)
+PN_HANDLE(PNI_CPP_EVENT_CONTEXT)
 
 namespace proton {
 namespace reactor {
@@ -39,7 +39,6 @@ void setConnectionContext(pn_connection_t *pnConnection, ConnectionImpl *connect
     pn_record_def(record, PNI_CPP_CONNECTION_CONTEXT, PN_VOID);
     pn_record_set(record, PNI_CPP_CONNECTION_CONTEXT, connection);
 }
-
 ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection) {
     if (!pnConnection) return NULL;
     pn_record_t *record = pn_connection_attachments(pnConnection);
@@ -48,40 +47,11 @@ ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection) {
 }
 
 
-void setSessionContext(pn_session_t *pnSession, Session *session) {
-    pn_record_t *record = pn_session_attachments(pnSession);
-    pn_record_def(record, PNI_CPP_SESSION_CONTEXT, PN_VOID);
-    pn_record_set(record, PNI_CPP_SESSION_CONTEXT, session);
-}
-
-Session *getSessionContext(pn_session_t *pnSession) {
-    if (!pnSession) return NULL;
-    pn_record_t *record = pn_session_attachments(pnSession);
-    Session *p = (Session *) pn_record_get(record, PNI_CPP_SESSION_CONTEXT);
-    return p;
-}
-
-
-void setLinkContext(pn_link_t *pnLink, Link *link) {
-    pn_record_t *record = pn_link_attachments(pnLink);
-    pn_record_def(record, PNI_CPP_LINK_CONTEXT, PN_VOID);
-    pn_record_set(record, PNI_CPP_LINK_CONTEXT, link);
-}
-
-Link *getLinkContext(pn_link_t *pnLink) {
-    if (!pnLink) return NULL;
-    pn_record_t *record = pn_link_attachments(pnLink);
-    Link *p = (Link *) pn_record_get(record, PNI_CPP_LINK_CONTEXT);
-    return p;
-}
-
-
 void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container) {
     pn_record_t *record = pn_reactor_attachments(pnReactor);
     pn_record_def(record, PNI_CPP_CONTAINER_CONTEXT, PN_VOID);
     pn_record_set(record, PNI_CPP_CONTAINER_CONTEXT, container);
 }
-
 ContainerImpl *getContainerContext(pn_reactor_t *pnReactor) {
     pn_record_t *record = pn_reactor_attachments(pnReactor);
     ContainerImpl *p = (ContainerImpl *) pn_record_get(record, PNI_CPP_CONTAINER_CONTEXT);
@@ -89,4 +59,17 @@ ContainerImpl *getContainerContext(pn_reactor_t *pnReactor) {
     return p;
 }
 
+void setEventContext(pn_event_t *pnEvent, pn_message_t *m) {
+    pn_record_t *record = pn_event_attachments(pnEvent);
+    pn_record_def(record, PNI_CPP_EVENT_CONTEXT, PN_OBJECT); // refcount it for life of the event
+    pn_record_set(record, PNI_CPP_EVENT_CONTEXT, m);
+}
+pn_message_t *getEventContext(pn_event_t *pnEvent) {
+    if (!pnEvent) return NULL;
+    pn_record_t *record = pn_event_attachments(pnEvent);
+    pn_message_t *p = (pn_message_t *) pn_record_get(record, PNI_CPP_EVENT_CONTEXT);
+    return p;
+}
+
+
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/40b63a13/proton-c/bindings/cpp/src/contexts.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.h b/proton-c/bindings/cpp/src/contexts.h
index c04a77a..e1b5f24 100644
--- a/proton-c/bindings/cpp/src/contexts.h
+++ b/proton-c/bindings/cpp/src/contexts.h
@@ -23,6 +23,7 @@
  */
 #include "proton/reactor.h"
 #include "proton/connection.h"
+#include "proton/message.h"
 
 namespace proton {
 namespace reactor {
@@ -43,6 +44,9 @@ class ContainerImpl;
 void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container);
 ContainerImpl *getContainerContext(pn_reactor_t *pnReactor);
 
+void setEventContext(pn_event_t *pnEvent, pn_message_t *m);
+pn_message_t *getEventContext(pn_event_t *pnEvent);
+
 }} // namespace proton::reactor
 
 #endif  /*!PROTON_CPP_CONTEXTS_H*/


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


[24/50] [abbrv] qpid-proton git commit: PROTON-781: Added support for reactors to the Ruby Endpoint class.

Posted by ac...@apache.org.
PROTON-781: Added support for reactors to the Ruby Endpoint class.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 1ea856124ef91ce8cc643aca099c0a1809bec9f5
Parents: b7ee18c
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Apr 16 10:41:08 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/endpoint.rb | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1ea85612/proton-c/bindings/ruby/lib/core/endpoint.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/endpoint.rb b/proton-c/bindings/ruby/lib/core/endpoint.rb
index cbf1015..f3ddbcb 100644
--- a/proton-c/bindings/ruby/lib/core/endpoint.rb
+++ b/proton-c/bindings/ruby/lib/core/endpoint.rb
@@ -110,6 +110,31 @@ module Qpid::Proton
       !(self.state & state_mask).zero?
     end
 
+    def handler
+      reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
+      if reactor.nil?
+        on_error = nil
+      else
+        on_error = reactor.method(:on_error)
+      end
+      record = self.attachments
+      puts "record=#{record}"
+      WrappedHandler.wrap(Cproton.pn_record_get_handler(record), on_error)
+    end
+
+    def handler=(handler)
+      reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
+      if reactor.nil?
+        on_error = nil
+      else
+        on_error = reactor.method(:on_error)
+      end
+      impl = chandler(handler, on_error)
+      record = self.attachments
+      Cproton.pn_record_set_handler(record, impl)
+      Cproton.pn_decref(impl)
+    end
+
   end
 
 end


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


[27/50] [abbrv] qpid-proton git commit: PROTON-781: Added Acceptor to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added Acceptor to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 979b09872e40d02e204c27521a3a29e2b2c1de9d
Parents: 6f56718
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Fri Feb 27 10:14:57 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb      |  1 +
 proton-c/bindings/ruby/lib/reactor/acceptor.rb | 41 +++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/979b0987/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index f3da844..bffd4d1 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -94,6 +94,7 @@ require "handler/messaging_handler"
 
 # Reactor classes
 require "reactor/task"
+require "reactor/acceptor"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/979b0987/proton-c/bindings/ruby/lib/reactor/acceptor.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/acceptor.rb b/proton-c/bindings/ruby/lib/reactor/acceptor.rb
new file mode 100644
index 0000000..83e0596
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/acceptor.rb
@@ -0,0 +1,41 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class Acceptor
+
+    include Qpid::Proton::Util::Wrapper
+
+    def initialize(impl)
+      @impl = impl
+      self.class.store_instance(self)
+    end
+
+    def set_ssl_domain(ssl_domain)
+      Cproton.pn_acceptor_set_ssl_domain(@impl, ssl_domain.impl)
+    end
+
+    def close
+      Cproton.pn_acceptor_close(@impl)
+    end
+
+  end
+
+end


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


[50/50] [abbrv] qpid-proton git commit: PROTON-865: Fix extern declarations and other windows portability issues.

Posted by ac...@apache.org.
PROTON-865: Fix extern declarations and other windows portability issues.

Added type_traits to manage the complicated variations of distinct/identical
integer types of various sizes on different C++ compilers.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 9f7e3462006e03a421097ce3157eb68451e23070
Parents: 327f358
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Jun 17 17:11:47 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:55:28 2015 -0400

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt                     |   4 +-
 examples/cpp/encode_decode.cpp                  |   2 +-
 examples/cpp/example_test.py                    |  35 +-
 proton-c/bindings/cpp/CMakeCache.txt            | 334 +++++++++++++++++++
 proton-c/bindings/cpp/CMakeLists.txt            |  38 ++-
 .../bindings/cpp/include/proton/Acceptor.hpp    |   5 +-
 proton-c/bindings/cpp/include/proton/Acking.hpp |   2 +-
 .../cpp/include/proton/BlockingConnection.hpp   |   2 +-
 .../cpp/include/proton/BlockingLink.hpp         |   6 +-
 .../cpp/include/proton/BlockingSender.hpp       |   2 +-
 .../bindings/cpp/include/proton/Connection.hpp  |   2 +-
 .../bindings/cpp/include/proton/Container.hpp   |   2 +-
 proton-c/bindings/cpp/include/proton/Data.hpp   |  33 +-
 .../bindings/cpp/include/proton/Decoder.hpp     |  22 +-
 .../bindings/cpp/include/proton/Delivery.hpp    |   2 +-
 .../bindings/cpp/include/proton/Duration.hpp    |  18 +-
 .../bindings/cpp/include/proton/Encoder.hpp     |  85 ++---
 .../bindings/cpp/include/proton/Endpoint.hpp    |   6 +-
 proton-c/bindings/cpp/include/proton/Error.hpp  |   8 +-
 proton-c/bindings/cpp/include/proton/Event.hpp  |   8 +-
 proton-c/bindings/cpp/include/proton/Handle.hpp |  16 +-
 .../bindings/cpp/include/proton/Handler.hpp     |   4 +-
 .../cpp/include/proton/ImportExport.hpp         |  50 ---
 proton-c/bindings/cpp/include/proton/Link.hpp   |   4 +-
 .../bindings/cpp/include/proton/Message.hpp     |  78 ++---
 .../cpp/include/proton/MessagingHandler.hpp     |  88 ++---
 .../cpp/include/proton/ProtonHandle.hpp         |  12 +-
 .../cpp/include/proton/ProtonHandler.hpp        |  82 ++---
 .../bindings/cpp/include/proton/Receiver.hpp    |   4 +-
 proton-c/bindings/cpp/include/proton/Sender.hpp |   8 +-
 .../bindings/cpp/include/proton/Session.hpp     |   9 +-
 .../bindings/cpp/include/proton/Terminus.hpp    |   2 +-
 .../bindings/cpp/include/proton/Transport.hpp   |   2 +-
 proton-c/bindings/cpp/include/proton/Value.hpp  |  26 +-
 proton-c/bindings/cpp/include/proton/Values.hpp |  15 +-
 .../cpp/include/proton/WaitCondition.hpp        |   2 +-
 proton-c/bindings/cpp/include/proton/export.hpp |  46 +++
 .../bindings/cpp/include/proton/type_traits.hpp | 116 +++++++
 proton-c/bindings/cpp/include/proton/types.hpp  | 147 ++++----
 .../bindings/cpp/src/BlockingConnection.cpp     |  62 ++++
 .../bindings/cpp/src/BlockingConnectionImpl.cpp | 124 +++++++
 .../bindings/cpp/src/BlockingConnectionImpl.hpp |  63 ++++
 proton-c/bindings/cpp/src/BlockingLink.cpp      |  86 +++++
 proton-c/bindings/cpp/src/BlockingSender.cpp    |  66 ++++
 proton-c/bindings/cpp/src/ConnectionImpl.hpp    |   2 +-
 proton-c/bindings/cpp/src/ContainerImpl.hpp     |   2 +-
 proton-c/bindings/cpp/src/Decoder.cpp           |   3 +-
 proton-c/bindings/cpp/src/Duration.cpp          |   2 +-
 proton-c/bindings/cpp/src/Encoder.cpp           |   3 +-
 proton-c/bindings/cpp/src/Error.cpp             |   4 +-
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |   2 +-
 proton-c/bindings/cpp/src/PrivateImplRef.hpp    |   2 +-
 proton-c/bindings/cpp/src/ProtonImplRef.hpp     |   2 +-
 proton-c/bindings/cpp/src/Sender.cpp            |   9 +-
 proton-c/bindings/cpp/src/Session.cpp           |   1 +
 proton-c/bindings/cpp/src/Url.hpp               |   2 +-
 .../cpp/src/blocking/BlockingConnection.cpp     |  62 ----
 .../cpp/src/blocking/BlockingConnectionImpl.cpp | 124 -------
 .../cpp/src/blocking/BlockingConnectionImpl.hpp |  63 ----
 .../bindings/cpp/src/blocking/BlockingLink.cpp  |  86 -----
 .../cpp/src/blocking/BlockingSender.cpp         |  66 ----
 proton-c/bindings/cpp/src/interop_test.cpp      |  36 +-
 proton-c/bindings/cpp/src/proton_bits.hpp       |   1 +
 proton-c/bindings/cpp/src/types.cpp             |  43 ++-
 proton-c/include/proton/codec.h                 |   2 +-
 65 files changed, 1391 insertions(+), 854 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index bafcd38..7a9f911 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,7 +17,9 @@
 # under the License.
 #
 
-include_directories("${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
+include_directories(
+  "${CMAKE_SOURCE_DIR}/proton-c/include"
+  "${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
 
 foreach(example
     broker

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/examples/cpp/encode_decode.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp
index cad4c0e..fd65ebd 100644
--- a/examples/cpp/encode_decode.cpp
+++ b/examples/cpp/encode_decode.cpp
@@ -68,7 +68,7 @@ void simple_insert_extract_exact_type() {
     // Check that we encoded the correct types, but note that decoding will
     // still convert to standard C++ types, in particular any AMQP integer type
     // can be converted to a long-enough C++ integer type..
-    int64_t i1, i2;
+    std::int64_t i1, i2;
     std::string s;
     values >> i1 >> i2 >> s;
     cout << "Extracted (with conversion) " << i1 << ", " << i2 << ", " << s << endl;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 2e2d91c..8507be8 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -22,7 +22,18 @@
 import unittest
 import os, sys, socket, time
 from  random import randrange
-from subprocess import Popen, check_output, PIPE, STDOUT
+from subprocess import Popen, PIPE, STDOUT
+
+def call(*args, **kwargs):
+    p = Popen(*args, stdout=PIPE, stderr=STDOUT, **kwargs)
+    out, err = p.communicate()
+    if p.returncode:
+        raise CalledProcessError("""%s exit code %s
+vvvvvvvvvvvvvvvv output of %s exit code %s vvvvvvvvvvvvvvvv
+%s
+^^^^^^^^^^^^^^^^ output of %s exit code %s ^^^^^^^^^^^^^^^^""" % (
+    p.cmd, p.returncode, p.cmd, p.returncode, out, p.cmd, p.returncode))
+    return out
 
 NULL = open(os.devnull, 'w')
 
@@ -68,25 +79,25 @@ class ExampleTest(unittest.TestCase):
 
     def test_helloworld(self):
         b = Broker.get()
-        hw = check_output(["./helloworld", b.addr])
+        hw = call(["./helloworld", b.addr])
         self.assertEqual("Hello World!\n", hw)
 
     def test_helloworld_blocking(self):
         b = Broker.get()
-        hw = check_output(["./helloworld_blocking", b.addr])
+        hw = call(["./helloworld_blocking", b.addr])
         self.assertEqual("Hello World!\n", hw)
 
     def test_helloworld_direct(self):
         url = ":%s/examples" % randrange(10000, 20000)
-        hw = check_output(["./helloworld_direct", url])
+        hw = call(["./helloworld_direct", url])
         self.assertEqual("Hello World!\n", hw)
 
     def test_simple_send_recv(self):
         b = Broker.get()
         n = 5
-        send = check_output(["./simple_send", "-a", b.addr, "-m", str(n)])
+        send = call(["./simple_send", "-a", b.addr, "-m", str(n)])
         self.assertEqual("all messages confirmed\n", send)
-        recv = check_output(["./simple_recv", "-a", b.addr, "-m", str(n)])
+        recv = call(["./simple_recv", "-a", b.addr, "-m", str(n)])
         recv_expect = "simple_recv listening on %s\n" % (b.addr)
         recv_expect += "".join(['{"sequence"=%s}\n' % (i+1) for i in range(n)])
         self.assertEqual(recv_expect, recv)
@@ -99,20 +110,12 @@ class ExampleTest(unittest.TestCase):
         n = 5
         recv = Popen(["./simple_recv", "-a", b.addr, "-m", str(n)], stdout=PIPE)
         self.assertEqual("simple_recv listening on %s\n" % (b.addr), recv.stdout.readline())
-        send = check_output(["./simple_send", "-a", b.addr, "-m", str(n)])
+        send = call(["./simple_send", "-a", b.addr, "-m", str(n)])
         self.assertEqual("all messages confirmed\n", send)
         recv_expect = "".join(['[%d]: b"some arbitrary binary data"\n' % (i+1) for i in range(n)])
         out, err = recv.communicate()
         self.assertEqual(recv_expect, out)
 
-    def call(self, *cmd):
-        p = Popen(cmd, stdout=PIPE, stderr=STDOUT)
-        out, err = p.communicate()
-        self.assertEqual(0, p.returncode,
-                         "%s exit code %s, output:\n%s\n---- end of %s exit code %s" % (
-                             cmd, p.returncode, out, cmd, p.returncode))
-        return out
-
     def test_encode_decode(self):
         expect="""
 == Simple values: int, string, bool
@@ -140,6 +143,6 @@ Values: list[int(42), bool(false), symbol(:x)]
 Values: map{string("k1"):int(42), symbol(:"k2"):bool(false)}
 """
         self.maxDiff = None
-        self.assertMultiLineEqual(expect, self.call("./encode_decode"))
+        self.assertMultiLineEqual(expect, call("./encode_decode"))
 if __name__ == "__main__":
     unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/CMakeCache.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeCache.txt b/proton-c/bindings/cpp/CMakeCache.txt
new file mode 100644
index 0000000..9e6eaeb
--- /dev/null
+++ b/proton-c/bindings/cpp/CMakeCache.txt
@@ -0,0 +1,334 @@
+# This is the CMakeCache file.
+# For build in directory: /home/aconway/proton/proton-c/bindings/cpp
+# It was generated by CMake: /usr/bin/cmake
+# You can edit this file to change values found and used by cmake.
+# If you do not want to change any of the values, simply exit the editor.
+# If you do want to change a value, simply edit, save, and exit the editor.
+# The syntax for the file is as follows:
+# KEY:TYPE=VALUE
+# KEY is the name of a variable in the cache.
+# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
+# VALUE is the current value for the KEY.
+
+########################
+# EXTERNAL cache entries
+########################
+
+//Build cpp language binding
+BUILD_CPP:BOOL=ON
+
+//Build javascript language binding
+BUILD_JAVASCRIPT:BOOL=OFF
+
+//Path to a program.
+CMAKE_AR:FILEPATH=/usr/bin/ar
+
+//For backwards compatibility, what version of CMake commands and
+// syntax should this version of CMake try to support.
+CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
+
+//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
+// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
+CMAKE_BUILD_TYPE:STRING=
+
+//Enable/Disable color output during build.
+CMAKE_COLOR_MAKEFILE:BOOL=ON
+
+//CXX compiler
+CMAKE_CXX_COMPILER:FILEPATH=/usr/lib64/ccache/c++
+
+//Flags used by the compiler during all build types.
+CMAKE_CXX_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_CXX_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release builds for minimum
+// size.
+CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds.
+CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during release builds with debug info.
+CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
+
+//C compiler
+CMAKE_C_COMPILER:FILEPATH=/usr/lib64/ccache/cc
+
+//Flags used by the compiler during all build types.
+CMAKE_C_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_C_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release builds for minimum
+// size.
+CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds.
+CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during release builds with debug info.
+CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
+
+//Flags used by the linker.
+CMAKE_EXE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Enable/Disable output of compile commands during generation.
+CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
+
+//Install path prefix, prepended onto install directories.
+CMAKE_INSTALL_PREFIX:PATH=/usr/local
+
+//Path to a program.
+CMAKE_LINKER:FILEPATH=/usr/bin/ld
+
+//Path to a program.
+CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
+
+//Flags used by the linker during the creation of modules.
+CMAKE_MODULE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_NM:FILEPATH=/usr/bin/nm
+
+//Path to a program.
+CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
+
+//Path to a program.
+CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
+
+//Value Computed by CMake
+CMAKE_PROJECT_NAME:STATIC=Project
+
+//Path to a program.
+CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
+
+//Flags used by the linker during the creation of dll's.
+CMAKE_SHARED_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//If set, runtime paths are not added when installing shared libraries,
+// but are added when building.
+CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
+
+//If set, runtime paths are not added when using shared libraries.
+CMAKE_SKIP_RPATH:BOOL=NO
+
+//Flags used by the linker during the creation of static libraries.
+CMAKE_STATIC_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_STRIP:FILEPATH=/usr/bin/strip
+
+//If true, cmake will use relative paths in makefiles and projects.
+CMAKE_USE_RELATIVE_PATHS:BOOL=OFF
+
+//If this value is on, makefiles will be generated without the
+// .SILENT directive, and all commands will be echoed to the console
+// during the make.  This is useful for debugging only. With Visual
+// Studio IDE projects all commands are done without /nologo.
+CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
+
+//Single output directory for building all executables.
+EXECUTABLE_OUTPUT_PATH:PATH=
+
+//The directory containing a CMake configuration file for Emscripten.
+Emscripten_DIR:PATH=Emscripten_DIR-NOTFOUND
+
+//Single output directory for building all libraries.
+LIBRARY_OUTPUT_PATH:PATH=
+
+//Value Computed by CMake
+Project_BINARY_DIR:STATIC=/home/aconway/proton/proton-c/bindings/cpp
+
+//Value Computed by CMake
+Project_SOURCE_DIR:STATIC=/home/aconway/proton/proton-c/bindings
+
+//Dependencies for the target
+qpid-proton-cpp_LIB_DEPENDS:STATIC=general;qpid-proton;
+
+
+########################
+# INTERNAL cache entries
+########################
+
+//ADVANCED property for variable: CMAKE_AR
+CMAKE_AR-ADVANCED:INTERNAL=1
+//This is the directory where this CMakeCache.txt was created
+CMAKE_CACHEFILE_DIR:INTERNAL=/home/aconway/proton/proton-c/bindings/cpp
+//Major version of cmake used to create the current loaded cache
+CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
+//Minor version of cmake used to create the current loaded cache
+CMAKE_CACHE_MINOR_VERSION:INTERNAL=2
+//Patch version of cmake used to create the current loaded cache
+CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
+//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
+CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
+//Path to CMake executable.
+CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
+//Path to cpack program executable.
+CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
+//Path to ctest program executable.
+CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
+//ADVANCED property for variable: CMAKE_CXX_COMPILER
+CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
+CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
+CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER
+CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS
+CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
+CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//Path to cache edit program executable.
+CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake
+//Executable file format
+CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
+CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
+CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
+CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
+CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
+//Name of external makefile project generator.
+CMAKE_EXTRA_GENERATOR:INTERNAL=
+//Name of generator.
+CMAKE_GENERATOR:INTERNAL=Unix Makefiles
+//Name of generator platform.
+CMAKE_GENERATOR_PLATFORM:INTERNAL=
+//Name of generator toolset.
+CMAKE_GENERATOR_TOOLSET:INTERNAL=
+//Start directory with the top level CMakeLists.txt file for this
+// project
+CMAKE_HOME_DIRECTORY:INTERNAL=/home/aconway/proton/proton-c/bindings
+//Install .so files without execute permission.
+CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0
+//ADVANCED property for variable: CMAKE_LINKER
+CMAKE_LINKER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
+CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
+CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
+CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
+CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_NM
+CMAKE_NM-ADVANCED:INTERNAL=1
+//number of local generators
+CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=2
+//ADVANCED property for variable: CMAKE_OBJCOPY
+CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJDUMP
+CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_RANLIB
+CMAKE_RANLIB-ADVANCED:INTERNAL=1
+//Path to CMake installation.
+CMAKE_ROOT:INTERNAL=/usr/share/cmake
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
+CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
+CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
+CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
+CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_RPATH
+CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
+CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
+CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
+CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STRIP
+CMAKE_STRIP-ADVANCED:INTERNAL=1
+//uname command
+CMAKE_UNAME:INTERNAL=/usr/bin/uname
+//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS
+CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
+CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
+//Result of TRY_COMPILE
+RESULT:INTERNAL=TRUE

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index f3fbb44..462e2bf 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -17,10 +17,26 @@
 # under the License.
 #
 
-## Build
+set(CPP_FLAGS ${CXX_WARNING_FLAGS})
 
-include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
-include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
+## Check compiler capabilities.
+macro(compiler_test RESULT_VAR NAME CODE)
+  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${NAME} "${CODE}")
+  try_compile(${RESULT_VAR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${NAME})
+endmacro()
+
+compiler_test(RESULT has_long_long.cpp "long long ll; int main(int, char**) { return 0; }")
+if (RESULT)
+  message("C++ compiler has long long")
+  set(CPP_FLAGS "${CPP_FLAGS} -DHAS_LONG_LONG")
+else()
+  message("C++ compiler does not have long long")
+endif()
+
+include_directories(
+  "${CMAKE_SOURCE_DIR}/proton-c/include"
+  "${CMAKE_CURRENT_SOURCE_DIR}/include"
+  "${CMAKE_CURRENT_SOURCE_DIR}/src")
 
 set(qpid-proton-cpp-source
   src/Acceptor.cpp
@@ -55,15 +71,19 @@ set(qpid-proton-cpp-source
   src/Value.cpp
   src/Values.cpp
   src/proton_bits.cpp
-  src/blocking/BlockingConnection.cpp
-  src/blocking/BlockingConnectionImpl.cpp
-  src/blocking/BlockingLink.cpp
-  src/blocking/BlockingSender.cpp
+  src/BlockingConnection.cpp
+  src/BlockingConnectionImpl.cpp
+  src/BlockingLink.cpp
+  src/BlockingSender.cpp
   src/contexts.cpp
   src/types.cpp
   )
 
-set_source_files_properties(${qpid-proton-cpp-source} PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}")
+set_source_files_properties (
+  ${qpid-proton-cpp-source}
+  PROPERTIES
+  COMPILE_FLAGS "${CPP_FLAGS}"
+  )
 
 add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
 
@@ -100,7 +120,7 @@ add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
 
 ## Install
 
-install (TARGETS qpid-proton-cpp
+install(TARGETS qpid-proton-cpp
   EXPORT  proton
   ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
   LIBRARY DESTINATION ${LIB_INSTALL_DIR})

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acceptor.hpp b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
index 591af2c..5702c10 100644
--- a/proton-c/bindings/cpp/include/proton/Acceptor.hpp
+++ b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
@@ -21,9 +21,10 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
-#include "proton/ProtonHandle.hpp"
+
 #include "proton/reactor.h"
+#include "proton/export.hpp"
+#include "proton/ProtonHandle.hpp"
 
 struct pn_connection_t;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Acking.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acking.hpp b/proton-c/bindings/cpp/include/proton/Acking.hpp
index 67da0b1..327f1a1 100644
--- a/proton-c/bindings/cpp/include/proton/Acking.hpp
+++ b/proton-c/bindings/cpp/include/proton/Acking.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Delivery.hpp"
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
index 77345c4..5b01136 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Handle.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Container.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
index 80df739..b1a5915 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Handle.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Container.hpp"
@@ -40,14 +40,14 @@ class BlockingLink
 {
   public:
     PN_CPP_EXTERN void close();
-    ~BlockingLink();
+    PN_CPP_EXTERN ~BlockingLink();
   protected:
     PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
     PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
   private:
     BlockingConnection connection;
     Link link;
-    void checkClosed();
+    PN_CPP_EXTERN void checkClosed();
     friend class BlockingConnection;
     friend class BlockingSender;
     friend class BlockingReceiver;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
index 25f09bb..5d95df5 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Handle.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Container.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Connection.hpp b/proton-c/bindings/cpp/include/proton/Connection.hpp
index 5656889..c16556b 100644
--- a/proton-c/bindings/cpp/include/proton/Connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/Connection.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Handle.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Container.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Container.hpp b/proton-c/bindings/cpp/include/proton/Container.hpp
index 7333566..c1ecb65 100644
--- a/proton-c/bindings/cpp/include/proton/Container.hpp
+++ b/proton-c/bindings/cpp/include/proton/Container.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Handle.hpp"
 #include "proton/Acceptor.hpp"
 #include "proton/Duration.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Data.hpp b/proton-c/bindings/cpp/include/proton/Data.hpp
index 30f85b7..77df52f 100644
--- a/proton-c/bindings/cpp/include/proton/Data.hpp
+++ b/proton-c/bindings/cpp/include/proton/Data.hpp
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include <iosfwd>
 
 /**@file
@@ -31,37 +31,36 @@ struct pn_data_t;
 namespace proton {
 
 /** Base for classes that hold AMQP data. */
-PN_CPP_EXTERN class Data {
+class Data {
   public:
-    explicit Data();
-    virtual ~Data();
-    Data(const Data&);
-
-    Data& operator=(const Data&);
+    PN_CPP_EXTERN explicit Data();
+    PN_CPP_EXTERN Data(const Data&);
+    PN_CPP_EXTERN virtual ~Data();
+    PN_CPP_EXTERN Data& operator=(const Data&);
 
     /** Clear the data. */
-    void clear();
+    PN_CPP_EXTERN void clear();
 
     /** True if there are no values. */
-    bool empty() const;
-
-    /** Human readable representation of data. */
-    friend std::ostream& operator<<(std::ostream&, const Data&);
+    PN_CPP_EXTERN bool empty() const;
 
     /** The underlying pn_data_t */
-    pn_data_t* pnData() { return data; }
+    PN_CPP_EXTERN pn_data_t* pnData() { return data; }
 
     /** True if this Data object owns it's own pn_data_t, false if it is acting as a "view" */
-    bool own() const { return own_; }
+    PN_CPP_EXTERN bool own() const { return own_; }
 
-    void swap(Data&);
+    PN_CPP_EXTERN void swap(Data&);
+
+    /** Human readable representation of data. */
+    friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Data&);
 
   protected:
     /** Does not take ownership, just a view on the data */
-    explicit Data(pn_data_t*);
+    PN_CPP_EXTERN explicit Data(pn_data_t*);
 
     /** Does not take ownership, just a view on the data */
-    void view(pn_data_t*);
+    PN_CPP_EXTERN  void view(pn_data_t*);
 
     mutable pn_data_t* data;
     bool own_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Decoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Decoder.hpp b/proton-c/bindings/cpp/include/proton/Decoder.hpp
index c3da9dc..11cd5fb 100644
--- a/proton-c/bindings/cpp/include/proton/Decoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/Decoder.hpp
@@ -20,8 +20,9 @@
  */
 
 #include "proton/Data.hpp"
-#include "proton/types.hpp"
 #include "proton/Error.hpp"
+#include "proton/type_traits.hpp"
+#include "proton/types.hpp"
 #include <iosfwd>
 
 namespace proton {
@@ -29,7 +30,7 @@ namespace proton {
 class Value;
 
 /** Raised by Decoder operations on error */
-struct DecodeError : public Error { explicit DecodeError(const std::string&) throw(); };
+struct DecodeError : public Error { PN_CPP_EXTERN explicit DecodeError(const std::string&) throw(); };
 
 /**@file
  * Stream-like decoder from AMQP bytes to C++ values.
@@ -64,7 +65,7 @@ extracting AMQP maps.
 
 You can also extract container values element-by-element, see the Start class.
 */
-PN_CPP_EXTERN class Decoder : public virtual Data {
+class Decoder : public virtual Data {
   public:
 
     PN_CPP_EXTERN Decoder();
@@ -171,16 +172,21 @@ PN_CPP_EXTERN class Decoder : public virtual Data {
 
   private:
     template <class T> Decoder& extract(T& value);
-    void checkType(TypeId);
-
-    // Not implemented
-    Decoder(const Decoder&);
-    Decoder& operator=(const Decoder&);
+    PN_CPP_EXTERN void checkType(TypeId);
 
   friend class Value;
   friend class Encoder;
 };
 
+// operator >> for integer types that are not covered by the standard overrides.
+template <class T>
+typename std::enable_if<IsUnknownInteger<T>::value, Decoder&>::type operator>>(Decoder& d, T& i)  {
+    typename IntegerType<sizeof(T), std::is_signed<T>::value>::type v;
+    d >> v;                     // Extract as a known integer type
+    i = v;
+    return d;
+}
+
 template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref)  {
     Decoder::Scope s(d);
     if (s.isDescribed) d >> skip();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Delivery.hpp b/proton-c/bindings/cpp/include/proton/Delivery.hpp
index b90f7fa..110b1ce 100644
--- a/proton-c/bindings/cpp/include/proton/Delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/Delivery.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/ProtonHandle.hpp"
 
 #include "proton/delivery.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Duration.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Duration.hpp b/proton-c/bindings/cpp/include/proton/Duration.hpp
index 288ef9d..596b4d0 100644
--- a/proton-c/bindings/cpp/include/proton/Duration.hpp
+++ b/proton-c/bindings/cpp/include/proton/Duration.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/types.hpp"
 
 namespace proton {
@@ -33,20 +33,20 @@ namespace proton {
 class Duration : public Comparable<Duration>
 {
   public:
-    uint64_t milliseconds;
-    explicit Duration(uint64_t ms) : milliseconds(ms) {}
+    std::uint64_t milliseconds;
+    explicit Duration(std::uint64_t ms) : milliseconds(ms) {}
 
     bool operator<(Duration d) { return milliseconds < d.milliseconds; }
     bool operator==(Duration d) { return milliseconds == d.milliseconds; }
 
-    static const Duration FOREVER;
-    static const Duration IMMEDIATE;
-    static const Duration SECOND;
-    static const Duration MINUTE;
+    PN_CPP_EXTERN static const Duration FOREVER;
+    PN_CPP_EXTERN static const Duration IMMEDIATE;
+    PN_CPP_EXTERN static const Duration SECOND;
+    PN_CPP_EXTERN static const Duration MINUTE;
 };
 
-inline Duration operator*(Duration d, uint64_t n) { return Duration(d.milliseconds*n); }
-inline Duration operator*(uint64_t n, Duration d) { return d * n; }
+inline Duration operator*(Duration d, std::uint64_t n) { return Duration(d.milliseconds*n); }
+inline Duration operator*(std::uint64_t n, Duration d) { return d * n; }
 
 inline Timestamp operator+(Timestamp ts, Duration d) { return Timestamp(ts.milliseconds+d.milliseconds); }
 inline Timestamp operator+(Duration d, Timestamp ts) { return ts + d; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Encoder.hpp b/proton-c/bindings/cpp/include/proton/Encoder.hpp
index aaa8d93..8b2f77c 100644
--- a/proton-c/bindings/cpp/include/proton/Encoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/Encoder.hpp
@@ -20,15 +20,17 @@
  */
 
 #include "proton/Data.hpp"
-#include "proton/types.hpp"
 #include "proton/Error.hpp"
+#include "proton/types.hpp"
+#include "proton/type_traits.hpp"
 #include <iosfwd>
 
+#include <iostream>             // FIXME aconway 2015-06-18:
+
 struct pn_data_t;
 
 namespace proton {
 
-
 class Value;
 
 /**@file
@@ -37,7 +39,7 @@ class Value;
 */
 
 /** Raised by Encoder operations on error */
-struct EncodeError : public Error { explicit EncodeError(const std::string&) throw(); };
+struct EncodeError : public Error { PN_CPP_EXTERN explicit EncodeError(const std::string&) throw(); };
 
 /**
 @ingroup cpp
@@ -84,41 +86,41 @@ class Encoder : public virtual Data {
     /** @name Insert simple types.
      *@{
      */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Null);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Bool);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ubyte);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Byte);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ushort);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Short);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Uint);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Int);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Char);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Ulong);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Long);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Timestamp);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Float);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Double);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal32);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal64);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Decimal128);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Uuid);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, String);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Symbol);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, Binary);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, const Value&);
     ///@}
 
     /** Start a container type. See the Start class. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, const Start&);
 
     /** Finish a container type. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder& e, Finish);
 
 
     /**@name Insert values returned by the as<TypeId> helper.
      *@{
      */
-  template <class T, TypeId A> friend Encoder& operator<<(Encoder&, CRef<T, A>);
+  template <class T, TypeId A> friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, CRef<T, A>);
   template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>);
   template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>);
   template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>);
@@ -126,29 +128,24 @@ class Encoder : public virtual Data {
     ///@}
 
     /** Copy data from a raw pn_data_t */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, pn_data_t*);
+    friend PN_CPP_EXTERN Encoder& operator<<(Encoder&, pn_data_t*);
+
   private:
     PN_CPP_EXTERN Encoder(pn_data_t* pd);
 
-    // Not implemented
-    Encoder(const Encoder&);
-    Encoder& operator=(const Encoder&);
-
   friend class Value;
 };
 
-/** Encode const char* as string */
-inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
-
-/** Encode char* as string */
+// Need to disambiguate char* conversion to bool and std::string as String.
 inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); }
-
-/** Encode std::string as string */
+inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
 inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); }
 
-//@internal Convert a Ref to a CRef.
-template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
-    return e << CRef<T,A>(ref);
+// operator << for integer types that are not covered by the standard overrides.
+template <class T>
+typename std::enable_if<IsUnknownInteger<T>::value, Encoder&>::type operator<<(Encoder& e, T i)  {
+    typename IntegerType<sizeof(T), std::is_signed<T>::value>::type v = i;
+    return e << v;              // Insert as a known integer type
 }
 
 // TODO aconway 2015-06-16: described array insertion.
@@ -178,6 +175,10 @@ template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
     e << finish();
     return e;
 }
+//@internal Convert a Ref to a CRef.
+template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
+    return e << CRef<T,A>(ref);
+}
 
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Endpoint.hpp b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
index 2736047..645ca0f 100644
--- a/proton-c/bindings/cpp/include/proton/Endpoint.hpp
+++ b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/connection.h"
 
 namespace proton {
@@ -48,8 +48,8 @@ class Endpoint
     virtual PN_CPP_EXTERN Connection &getConnection() = 0;
     Transport PN_CPP_EXTERN &getTransport();
   protected:
-    Endpoint();
-    ~Endpoint();
+    PN_CPP_EXTERN Endpoint();
+    PN_CPP_EXTERN ~Endpoint();
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Error.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Error.hpp b/proton-c/bindings/cpp/include/proton/Error.hpp
index a3d3242..578c3d6 100644
--- a/proton-c/bindings/cpp/include/proton/Error.hpp
+++ b/proton-c/bindings/cpp/include/proton/Error.hpp
@@ -22,19 +22,21 @@
  *
  */
 #include <stdexcept>
+#include <string>
+#include "proton/export.hpp"
 
 namespace proton {
 
 /** @ingroup cpp
  * Functions in the proton namespace throw a subclass of proton::Error on error.
  */
-struct Error : public std::runtime_error { explicit Error(const std::string&) throw(); };
+struct Error : public std::runtime_error { PN_CPP_EXTERN explicit Error(const std::string&) throw(); };
 
 /** Raised if a message is rejected */
-struct MessageReject : public Error { explicit MessageReject(const std::string&) throw(); };
+struct MessageReject : public Error { PN_CPP_EXTERN explicit MessageReject(const std::string&) throw(); };
 
 /** Raised if a message is released */
-struct MessageRelease : public Error { explicit MessageRelease(const std::string&) throw(); };
+struct MessageRelease : public Error { PN_CPP_EXTERN explicit MessageRelease(const std::string&) throw(); };
 
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Event.hpp b/proton-c/bindings/cpp/include/proton/Event.hpp
index db85c9c..3fbb6a7 100644
--- a/proton-c/bindings/cpp/include/proton/Event.hpp
+++ b/proton-c/bindings/cpp/include/proton/Event.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Link.hpp"
 #include "proton/Connection.hpp"
 #include "proton/Message.hpp"
@@ -48,10 +48,10 @@ class Event
     virtual PN_CPP_EXTERN void setMessage(Message &);
     virtual PN_CPP_EXTERN ~Event();
   protected:
-    PN_CPP_EXTERN PN_CPP_EXTERN Event();
+    PN_CPP_EXTERN Event();
   private:
-    PN_CPP_EXTERN Event(const Event&);
-    PN_CPP_EXTERN Event& operator=(const Event&);
+    Event(const Event&);
+    Event& operator=(const Event&);
 };
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Handle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handle.hpp b/proton-c/bindings/cpp/include/proton/Handle.hpp
index 648658b..916fd80 100644
--- a/proton-c/bindings/cpp/include/proton/Handle.hpp
+++ b/proton-c/bindings/cpp/include/proton/Handle.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 
 namespace proton {
 namespace reactor {
@@ -43,20 +43,20 @@ template <class T> class Handle {
   public:
 
     /**@return true if handle is valid,  i.e. not null. */
-    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+    bool isValid() const { return impl; }
 
     /**@return true if handle is null. It is an error to call any function on a null handle. */
-    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+    bool isNull() const { return !impl; }
 
     /** Conversion to bool supports idiom if (handle) { handle->... } */
-    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+    operator bool() const { return impl; }
 
     /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
-    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+    bool operator !() const { return !impl; }
 
     /** Operator ==  equal if they point to same non-null object*/
-    PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
-    PROTON_CPP_INLINE_EXTERN bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
+    bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
+    bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
 
     void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
 
@@ -67,7 +67,7 @@ template <class T> class Handle {
 
   protected:
     typedef T Impl;
-    PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
+    Handle() : impl() {}
 
     mutable Impl* impl;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handler.hpp b/proton-c/bindings/cpp/include/proton/Handler.hpp
index c66eecb..f7bb23b 100644
--- a/proton-c/bindings/cpp/include/proton/Handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/Handler.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Event.hpp"
 #include "proton/event.h"
 #include <vector>
@@ -29,7 +29,7 @@
 namespace proton {
 namespace reactor {
 
-class PN_CPP_EXTERN Handler
+class Handler
 {
   public:
     PN_CPP_EXTERN Handler();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/ImportExport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ImportExport.hpp b/proton-c/bindings/cpp/include/proton/ImportExport.hpp
deleted file mode 100644
index cbc0626..0000000
--- a/proton-c/bindings/cpp/include/proton/ImportExport.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_IMPORTEXPORT_H
-#define PROTON_CPP_IMPORTEXPORT_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.
- *
- */
-#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC)
-  //
-  // Import and Export definitions for Windows:
-  //
-#  define PROTON_CPP_EXPORT __declspec(dllexport)
-#  define PROTON_CPP_IMPORT __declspec(dllimport)
-#else
-  //
-  // Non-Windows (Linux, etc.) definitions:
-  //
-#  define PROTON_CPP_EXPORT
-#  define PROTON_CPP_IMPORT
-#endif
-
-
-// For c++ library symbols
-
-#ifdef protoncpp_EXPORTS
-#  define PN_CPP_EXTERN PROTON_CPP_EXPORT
-#else
-#  define PN_CPP_EXTERN PROTON_CPP_IMPORT
-#endif
-
-// TODO:
-#define PROTON_CPP_INLINE_EXTERN
-
-#endif  /*!PROTON_CPP_IMPORTEXPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Link.hpp b/proton-c/bindings/cpp/include/proton/Link.hpp
index 5500041..ac0e471 100644
--- a/proton-c/bindings/cpp/include/proton/Link.hpp
+++ b/proton-c/bindings/cpp/include/proton/Link.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/ProtonHandle.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Terminus.hpp"
@@ -55,7 +55,7 @@ class Link : public Endpoint, public ProtonHandle<pn_link_t>
     virtual PN_CPP_EXTERN Connection &getConnection();
     PN_CPP_EXTERN Link getNext(Endpoint::State mask);
   protected:
-    virtual void verifyType(pn_link_t *l);
+    PN_CPP_EXTERN virtual void verifyType(pn_link_t *l);
   private:
     friend class ProtonImplRef<Link>;
     bool senderLink;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Message.hpp b/proton-c/bindings/cpp/include/proton/Message.hpp
index b35eb18..c98dc31 100644
--- a/proton-c/bindings/cpp/include/proton/Message.hpp
+++ b/proton-c/bindings/cpp/include/proton/Message.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/ProtonHandle.hpp"
 #include "proton/Value.hpp"
 #include "proton/Message.hpp"
@@ -33,74 +33,74 @@ struct pn_data_t;
 namespace proton {
 
 // FIXME aconway 2015-06-17: documentation of properties.
-PN_CPP_EXTERN class Message : public reactor::ProtonHandle<pn_message_t>
+class Message : public reactor::ProtonHandle<pn_message_t>
 {
   public:
-    Message();
-    Message(pn_message_t *);
-    Message(const Message&);
-    Message& operator=(const Message&);
-    ~Message();
+    PN_CPP_EXTERN Message();
+    PN_CPP_EXTERN Message(pn_message_t *);
+    PN_CPP_EXTERN Message(const Message&);
+    PN_CPP_EXTERN Message& operator=(const Message&);
+    PN_CPP_EXTERN ~Message();
 
-    pn_message_t *pnMessage() const;
+    PN_CPP_EXTERN pn_message_t *pnMessage() const;
 
-    void id(const Value& id);
-    Value id() const;
+    PN_CPP_EXTERN void id(const Value& id);
+    PN_CPP_EXTERN Value id() const;
 
-    void user(const std::string &user);
-    std::string user() const;
+    PN_CPP_EXTERN void user(const std::string &user);
+    PN_CPP_EXTERN std::string user() const;
 
-    void address(const std::string &addr);
-    std::string address() const;
+    PN_CPP_EXTERN void address(const std::string &addr);
+    PN_CPP_EXTERN std::string address() const;
 
-    void subject(const std::string &s);
-    std::string subject() const;
+    PN_CPP_EXTERN void subject(const std::string &s);
+    PN_CPP_EXTERN std::string subject() const;
 
-    void replyTo(const std::string &s);
-    std::string replyTo() const;
+    PN_CPP_EXTERN void replyTo(const std::string &s);
+    PN_CPP_EXTERN std::string replyTo() const;
 
-    void correlationId(const Value&);
-    Value correlationId() const;
+    PN_CPP_EXTERN void correlationId(const Value&);
+    PN_CPP_EXTERN Value correlationId() const;
 
-    void contentType(const std::string &s);
-    std::string contentType() const;
+    PN_CPP_EXTERN void contentType(const std::string &s);
+    PN_CPP_EXTERN std::string contentType() const;
 
-    void contentEncoding(const std::string &s);
-    std::string contentEncoding() const;
+    PN_CPP_EXTERN void contentEncoding(const std::string &s);
+    PN_CPP_EXTERN std::string contentEncoding() const;
 
-    void expiry(Timestamp t);
-    Timestamp expiry() const;
+    PN_CPP_EXTERN void expiry(Timestamp t);
+    PN_CPP_EXTERN Timestamp expiry() const;
 
-    void creationTime(Timestamp t);
-    Timestamp creationTime() const;
+    PN_CPP_EXTERN void creationTime(Timestamp t);
+    PN_CPP_EXTERN Timestamp creationTime() const;
 
-    void groupId(const std::string &s);
-    std::string groupId() const;
+    PN_CPP_EXTERN void groupId(const std::string &s);
+    PN_CPP_EXTERN std::string groupId() const;
 
-    void replyToGroupId(const std::string &s);
-    std::string replyToGroupId() const;
+    PN_CPP_EXTERN void replyToGroupId(const std::string &s);
+    PN_CPP_EXTERN std::string replyToGroupId() const;
 
     /** Set the body to an AMQP value. */
-    void body(const Value&);
+    PN_CPP_EXTERN void body(const Value&);
 
     /** Template to convert any type to a Value and set as the body */
     template <class T> void body(const T& v) { body(Value(v)); }
 
     /** Set the body to a sequence of sections containing AMQP values. */
-    void body(const Values&);
+    PN_CPP_EXTERN void body(const Values&);
 
-    const Values& body() const;
+    PN_CPP_EXTERN const Values& body() const;
 
-    Values& body(); ///< Allows in-place modification of body sections.
+    PN_CPP_EXTERN Values& body(); ///< Allows in-place modification of body sections.
 
     // FIXME aconway 2015-06-17: consistent and flexible treatment of buffers.
     // Allow convenient std::string encoding/decoding (with re-use of existing
     // string capacity) but also need to allow encoding/decoding of non-string
     // buffers. Introduce a buffer type with begin/end pointers?
 
-    void encode(std::string &data);
-    std::string encode();
-    void decode(const std::string &data);
+    PN_CPP_EXTERN void encode(std::string &data);
+    PN_CPP_EXTERN std::string encode();
+    PN_CPP_EXTERN void decode(const std::string &data);
 
   private:
     mutable Values body_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
index 06858e3..ddc8165 100644
--- a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
+++ b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
@@ -32,63 +32,65 @@ namespace reactor {
 class Event;
 class MessagingAdapter;
 
-class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
+class MessagingHandler : public ProtonHandler , public Acking
 {
   public:
     PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
                                        bool peerCloseIsError=false);
-    virtual ~MessagingHandler();
+    PN_CPP_EXTERN virtual ~MessagingHandler();
 
-    virtual void onAbort(Event &e);
-    virtual void onAccepted(Event &e);
-    virtual void onCommit(Event &e);
-    virtual void onConnectionClosed(Event &e);
-    virtual void onConnectionClosing(Event &e);
-    virtual void onConnectionError(Event &e);
-    virtual void onConnectionOpening(Event &e);
-    virtual void onConnectionOpened(Event &e);
-    virtual void onDisconnected(Event &e);
-    virtual void onFetch(Event &e);
-    virtual void onIdLoaded(Event &e);
-    virtual void onLinkClosed(Event &e);
-    virtual void onLinkClosing(Event &e);
-    virtual void onLinkError(Event &e);
-    virtual void onLinkOpened(Event &e);
-    virtual void onLinkOpening(Event &e);
-    virtual void onMessage(Event &e);
-    virtual void onQuit(Event &e);
-    virtual void onRecordInserted(Event &e);
-    virtual void onRecordsLoaded(Event &e);
-    virtual void onRejected(Event &e);
-    virtual void onReleased(Event &e);
-    virtual void onRequest(Event &e);
-    virtual void onResponse(Event &e);
-    virtual void onSendable(Event &e);
-    virtual void onSessionClosed(Event &e);
-    virtual void onSessionClosing(Event &e);
-    virtual void onSessionError(Event &e);
-    virtual void onSessionOpened(Event &e);
-    virtual void onSessionOpening(Event &e);
-    virtual void onSettled(Event &e);
-    virtual void onStart(Event &e);
-    virtual void onTimer(Event &e);
-    virtual void onTransactionAborted(Event &e);
-    virtual void onTransactionCommitted(Event &e);
-    virtual void onTransactionDeclared(Event &e);
-    virtual void onTransportClosed(Event &e);
-  protected:
+    PN_CPP_EXTERN virtual void onAbort(Event &e);
+    PN_CPP_EXTERN virtual void onAccepted(Event &e);
+    PN_CPP_EXTERN virtual void onCommit(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionError(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onDisconnected(Event &e);
+    PN_CPP_EXTERN virtual void onFetch(Event &e);
+    PN_CPP_EXTERN virtual void onIdLoaded(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
+    PN_CPP_EXTERN virtual void onLinkError(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
+    PN_CPP_EXTERN virtual void onMessage(Event &e);
+    PN_CPP_EXTERN virtual void onQuit(Event &e);
+    PN_CPP_EXTERN virtual void onRecordInserted(Event &e);
+    PN_CPP_EXTERN virtual void onRecordsLoaded(Event &e);
+    PN_CPP_EXTERN virtual void onRejected(Event &e);
+    PN_CPP_EXTERN virtual void onReleased(Event &e);
+    PN_CPP_EXTERN virtual void onRequest(Event &e);
+    PN_CPP_EXTERN virtual void onResponse(Event &e);
+    PN_CPP_EXTERN virtual void onSendable(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onSessionError(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onSettled(Event &e);
+    PN_CPP_EXTERN virtual void onStart(Event &e);
+    PN_CPP_EXTERN virtual void onTimer(Event &e);
+    PN_CPP_EXTERN virtual void onTransactionAborted(Event &e);
+    PN_CPP_EXTERN virtual void onTransactionCommitted(Event &e);
+    PN_CPP_EXTERN virtual void onTransactionDeclared(Event &e);
+    PN_CPP_EXTERN virtual void onTransportClosed(Event &e);
+
+ protected:
     int prefetch;
     bool autoAccept;
     bool autoSettle;
     bool peerCloseIsError;
     MessagingAdapter *messagingAdapter;
     Handler *flowController;
-    PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
-                                       bool peerCloseIsError=false);
+    PN_CPP_EXTERN MessagingHandler(
+        bool rawHandler, int prefetch=10, bool autoAccept=true,
+        bool autoSettle=true, bool peerCloseIsError=false);
   private:
     friend class ContainerImpl;
     friend class MessagingAdapter;
-    void createHelpers();
+    PN_CPP_EXTERN void createHelpers();
 };
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
index 213bc14..da12c09 100644
--- a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 
 namespace proton {
 namespace reactor {
@@ -36,16 +36,16 @@ template <class T> class ProtonHandle {
   public:
 
     /**@return true if handle is valid,  i.e. not null. */
-    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+    bool isValid() const { return impl; }
 
     /**@return true if handle is null. It is an error to call any function on a null handle. */
-    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+    bool isNull() const { return !impl; }
 
     /** Conversion to bool supports idiom if (handle) { handle->... } */
-    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+    operator bool() const { return impl; }
 
     /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
-    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+    bool operator !() const { return !impl; }
 
     void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
 
@@ -56,7 +56,7 @@ template <class T> class ProtonHandle {
 
   protected:
     typedef T Impl;
-    PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
+    ProtonHandle() :impl() {}
 
     mutable Impl* impl;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
index 799ca89..3768f78 100644
--- a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
@@ -33,48 +33,48 @@ class ProtonHandler : public Handler
 {
   public:
     PN_CPP_EXTERN ProtonHandler();
-    virtual void onReactorInit(Event &e);
-    virtual void onReactorQuiesced(Event &e);
-    virtual void onReactorFinal(Event &e);
-    virtual void onTimerTask(Event &e);
-    virtual void onConnectionInit(Event &e);
-    virtual void onConnectionBound(Event &e);
-    virtual void onConnectionUnbound(Event &e);
-    virtual void onConnectionLocalOpen(Event &e);
-    virtual void onConnectionLocalClose(Event &e);
-    virtual void onConnectionRemoteOpen(Event &e);
-    virtual void onConnectionRemoteClose(Event &e);
-    virtual void onConnectionFinal(Event &e);
-    virtual void onSessionInit(Event &e);
-    virtual void onSessionLocalOpen(Event &e);
-    virtual void onSessionLocalClose(Event &e);
-    virtual void onSessionRemoteOpen(Event &e);
-    virtual void onSessionRemoteClose(Event &e);
-    virtual void onSessionFinal(Event &e);
-    virtual void onLinkInit(Event &e);
-    virtual void onLinkLocalOpen(Event &e);
-    virtual void onLinkLocalClose(Event &e);
-    virtual void onLinkLocalDetach(Event &e);
-    virtual void onLinkRemoteOpen(Event &e);
-    virtual void onLinkRemoteClose(Event &e);
-    virtual void onLinkRemoteDetach(Event &e);
-    virtual void onLinkFlow(Event &e);
-    virtual void onLinkFinal(Event &e);
-    virtual void onDelivery(Event &e);
-    virtual void onTransport(Event &e);
-    virtual void onTransportError(Event &e);
-    virtual void onTransportHeadClosed(Event &e);
-    virtual void onTransportTailClosed(Event &e);
-    virtual void onTransportClosed(Event &e);
-    virtual void onSelectableInit(Event &e);
-    virtual void onSelectableUpdated(Event &e);
-    virtual void onSelectableReadable(Event &e);
-    virtual void onSelectableWritable(Event &e);
-    virtual void onSelectableExpired(Event &e);
-    virtual void onSelectableError(Event &e);
-    virtual void onSelectableFinal(Event &e);
+    PN_CPP_EXTERN virtual void onReactorInit(Event &e);
+    PN_CPP_EXTERN virtual void onReactorQuiesced(Event &e);
+    PN_CPP_EXTERN virtual void onReactorFinal(Event &e);
+    PN_CPP_EXTERN virtual void onTimerTask(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionInit(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionBound(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionUnbound(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionLocalClose(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionFinal(Event &e);
+    PN_CPP_EXTERN virtual void onSessionInit(Event &e);
+    PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionLocalClose(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onSessionFinal(Event &e);
+    PN_CPP_EXTERN virtual void onLinkInit(Event &e);
+    PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkLocalClose(Event &e);
+    PN_CPP_EXTERN virtual void onLinkLocalDetach(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteDetach(Event &e);
+    PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
+    PN_CPP_EXTERN virtual void onLinkFinal(Event &e);
+    PN_CPP_EXTERN virtual void onDelivery(Event &e);
+    PN_CPP_EXTERN virtual void onTransport(Event &e);
+    PN_CPP_EXTERN virtual void onTransportError(Event &e);
+    PN_CPP_EXTERN virtual void onTransportHeadClosed(Event &e);
+    PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
+    PN_CPP_EXTERN virtual void onTransportClosed(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableInit(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableUpdated(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableReadable(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableWritable(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableExpired(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableError(Event &e);
+    PN_CPP_EXTERN virtual void onSelectableFinal(Event &e);
 
-    virtual void onUnhandled(Event &e);
+    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
 };
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Receiver.hpp b/proton-c/bindings/cpp/include/proton/Receiver.hpp
index ad22302..4f2333e 100644
--- a/proton-c/bindings/cpp/include/proton/Receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/Receiver.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Link.hpp"
 #include "proton/types.h"
@@ -39,7 +39,7 @@ class Receiver : public Link
     PN_CPP_EXTERN Receiver();
     PN_CPP_EXTERN Receiver(const Link& c);
   protected:
-    virtual void verifyType(pn_link_t *l);
+    PN_CPP_EXTERN virtual void verifyType(pn_link_t *l);
 };
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Sender.hpp b/proton-c/bindings/cpp/include/proton/Sender.hpp
index 3a3ee41..33e02b7 100644
--- a/proton-c/bindings/cpp/include/proton/Sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/Sender.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Delivery.hpp"
 #include "proton/Link.hpp"
 #include "proton/Message.hpp"
@@ -38,12 +38,12 @@ namespace reactor {
 class Sender : public Link
 {
   public:
-    PN_CPP_EXTERN Sender(pn_link_t *lnk);
-    PN_CPP_EXTERN Sender();
+    PN_CPP_EXTERN Sender(pn_link_t *lnk=0);
     PN_CPP_EXTERN Sender(const Link& c);
     PN_CPP_EXTERN Delivery send(Message &m);
+
   protected:
-    virtual void verifyType(pn_link_t *l);
+    PN_CPP_EXTERN virtual void verifyType(pn_link_t *l);
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Session.hpp b/proton-c/bindings/cpp/include/proton/Session.hpp
index 1f19b32..eaae4ce 100644
--- a/proton-c/bindings/cpp/include/proton/Session.hpp
+++ b/proton-c/bindings/cpp/include/proton/Session.hpp
@@ -21,13 +21,12 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Link.hpp"
 
 #include "proton/types.h"
 #include "proton/link.h"
-#include "ProtonImplRef.hpp"
 #include <string>
 
 struct pn_connection_t;
@@ -50,9 +49,9 @@ class Transport;
     PN_CPP_EXTERN Session& operator=(const Session&);
     PN_CPP_EXTERN void close();
     PN_CPP_EXTERN pn_session_t *getPnSession();
-    virtual PN_CPP_EXTERN Connection &getConnection();
-    Receiver createReceiver(std::string name);
-    Sender createSender(std::string name);
+    PN_CPP_EXTERN virtual Connection &getConnection();
+    PN_CPP_EXTERN Receiver createReceiver(std::string name);
+    PN_CPP_EXTERN Sender createSender(std::string name);
   private:
     friend class ProtonImplRef<Session>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Terminus.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Terminus.hpp b/proton-c/bindings/cpp/include/proton/Terminus.hpp
index b13165e..91d4f6f 100644
--- a/proton-c/bindings/cpp/include/proton/Terminus.hpp
+++ b/proton-c/bindings/cpp/include/proton/Terminus.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Link.hpp"
 
 #include "proton/link.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Transport.hpp b/proton-c/bindings/cpp/include/proton/Transport.hpp
index f81e483..1a8d39c 100644
--- a/proton-c/bindings/cpp/include/proton/Transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/Transport.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/transport.h"
 #include <string>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/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 a5f2edf..43a5878 100644
--- a/proton-c/bindings/cpp/include/proton/Value.hpp
+++ b/proton-c/bindings/cpp/include/proton/Value.hpp
@@ -30,22 +30,22 @@ struct pn_data_t;
 namespace proton {
 
 /** Holds a single AMQP value. */
-PN_CPP_EXTERN class Value {
+class Value {
   public:
-    Value();
-    Value(const Value&);
+    PN_CPP_EXTERN Value();
+    PN_CPP_EXTERN Value(const Value&);
 
     /** Converting constructor from any settable value */
     template <class T> explicit Value(const T& v);
 
-    ~Value();
+    PN_CPP_EXTERN ~Value();
 
-    Value& operator=(const Value&);
+    PN_CPP_EXTERN Value& operator=(const Value&);
 
     /** Copy the first value from a raw pn_data_t. */
-    Value& operator=(pn_data_t*);
+    PN_CPP_EXTERN Value& operator=(pn_data_t*);
 
-    TypeId type() const;
+    PN_CPP_EXTERN TypeId type() const;
 
     /** Set the value. */
     template<class T> void set(const T& value);
@@ -61,19 +61,19 @@ PN_CPP_EXTERN class Value {
     template<class T> operator T() const;
 
     /** insert a value into an Encoder. */
-    friend Encoder& operator<<(Encoder&, const Value&);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
 
     /** Extract a value from a decoder. */
-    friend Decoder& operator>>(Decoder&, Value&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
 
     /** Human readable format */
-    friend std::ostream& operator<<(std::ostream&, const Value&);
+    PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&);
 
-    bool operator==(const Value&) const;
-    bool operator !=(const Value& v) const{ return !(*this == v); }
+    PN_CPP_EXTERN bool operator==(const Value&) const;
+    PN_CPP_EXTERN bool operator !=(const Value& v) const{ return !(*this == v); }
 
     /** operator < makes Value valid for use as a std::map key. */
-    bool operator<(const Value&) const;
+    PN_CPP_EXTERN bool operator<(const Value&) const;
     bool operator>(const Value& v) const { return v < *this; }
     bool operator<=(const Value& v) const { return !(*this > v); }
     bool operator>=(const Value& v) const { return !(*this < v); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/Values.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Values.hpp b/proton-c/bindings/cpp/include/proton/Values.hpp
index 604d2be..275f905 100644
--- a/proton-c/bindings/cpp/include/proton/Values.hpp
+++ b/proton-c/bindings/cpp/include/proton/Values.hpp
@@ -34,21 +34,20 @@ namespace proton {
  *
  * After inserting values, call rewind() to extract them.
  */
-PN_CPP_EXTERN class Values : public Encoder, public Decoder {
+class Values : public Encoder, public Decoder {
   public:
-    Values();
-    Values(const Values&);
+    PN_CPP_EXTERN Values();
+    PN_CPP_EXTERN Values(const Values&);
 
     /** Does not take ownership, just a view on the data */
-    Values(pn_data_t*);
+    PN_CPP_EXTERN Values(pn_data_t*);
 
-    ~Values();
+    PN_CPP_EXTERN ~Values();
 
     /** Copy data from another Values */
-    Values& operator=(const Values&);
-
-    Values& rewind();
+    PN_CPP_EXTERN Values& operator=(const Values&);
 
+    PN_CPP_EXTERN Values& rewind();
 
   friend class Value;
   friend class Message;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
index 12c7708..c175841 100644
--- a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
+++ b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/export.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/export.hpp b/proton-c/bindings/cpp/include/proton/export.hpp
new file mode 100644
index 0000000..0be5187
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/export.hpp
@@ -0,0 +1,46 @@
+#ifndef PN_CPP_IMPORTEXPORT_H
+#define PN_CPP_IMPORTEXPORT_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.
+ *
+ */
+
+#if defined(WIN32) && !defined(PN_CPP_DECLARE_STATIC)
+  //
+  // Import and Export definitions for Windows:
+  //
+#  define PN_CPP_EXPORT __declspec(dllexport)
+#  define PN_CPP_IMPORT __declspec(dllimport)
+#else
+  //
+  // Non-Windows (Linux, etc.) definitions:
+  //
+#  define PN_CPP_EXPORT
+#  define PN_CPP_IMPORT
+#endif
+
+// For qpid-proton-cpp library symbols
+#ifdef qpid_proton_cpp_EXPORTS
+#  define PN_CPP_EXTERN PN_CPP_EXPORT
+#else
+#  define PN_CPP_EXTERN PN_CPP_IMPORT
+#endif
+
+#endif  /*!PN_CPP_IMPORTEXPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/type_traits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/type_traits.hpp b/proton-c/bindings/cpp/include/proton/type_traits.hpp
new file mode 100644
index 0000000..f635128
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/type_traits.hpp
@@ -0,0 +1,116 @@
+#ifndef ENABLE_IF_HPP
+#define ENABLE_IF_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/types.hpp"
+
+/**@file
+ * Type traits used for type conversions.
+ * @internal
+ */
+#if  defined(__cplusplus) && __cplusplus >= 201100
+#include <type_traits>
+#else
+namespace std {
+
+// Workaround for older C++ compilers. NOTE this is NOT a full implementation of the
+// corresponding c++11 types, it is the bare minimum needed by this library.
+
+template <bool, class T=void> struct enable_if;
+template <class T> struct enable_if<true, T> { typedef T type; };
+
+struct true_type { static const bool value = true; };
+struct false_type { static const bool value = false; };
+
+template <class T> struct is_integral : public false_type {};
+
+template <> struct is_integral<unsigned char> : public true_type {};
+template <> struct is_integral<unsigned short> : public true_type {};
+template <> struct is_integral<unsigned int> : public true_type {};
+template <> struct is_integral<unsigned long> : public true_type {};
+
+template <> struct is_integral<signed char> : public true_type {};
+template <> struct is_integral<signed short> : public true_type {};
+template <> struct is_integral<signed int> : public true_type {};
+template <> struct is_integral<signed long> : public true_type {};
+
+template <class T> struct is_signed : public false_type {};
+
+template <> struct is_signed<unsigned char> : public false_type {};
+template <> struct is_signed<unsigned short> : public false_type {};
+template <> struct is_signed<unsigned int> : public false_type {};
+template <> struct is_signed<unsigned long> : public false_type {};
+
+template <> struct is_signed<signed char> : public true_type {};
+template <> struct is_signed<signed short> : public true_type {};
+template <> struct is_signed<signed int> : public true_type {};
+template <> struct is_signed<signed long> : public true_type {};
+}
+#endif // Old C++ workarounds
+
+namespace proton {
+
+// Metafunction returning exact AMQP type associated with a C++ type
+template <class T> struct TypeIdOf;
+template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; };
+template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; };
+template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; };
+template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; };
+template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; };
+template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; };
+template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; };
+template<> struct TypeIdOf<Int> { static const TypeId value=INT; };
+template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; };
+template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; };
+template<> struct TypeIdOf<Long> { static const TypeId value=LONG; };
+template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; };
+template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; };
+template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; };
+template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; };
+template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; };
+template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; };
+template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; };
+template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; };
+template<> struct TypeIdOf<String> { static const TypeId value=STRING; };
+template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; };
+
+template <class T, class Enable=void> struct HasTypeId { static const bool value = false; };
+template <class T> struct HasTypeId<T, typename std::enable_if<TypeIdOf<T>::value>::type>  {
+    static const bool value = true;
+};
+
+// Map to known integer types by sizeof and signedness.
+template<size_t N, bool S> struct IntegerType;
+template<> struct IntegerType<1, true> { typedef Byte type; };
+template<> struct IntegerType<2, true> { typedef Short type; };
+template<> struct IntegerType<4, true> { typedef Int type; };
+template<> struct IntegerType<8, true> { typedef Long type; };
+template<> struct IntegerType<1, false> { typedef Ubyte type; };
+template<> struct IntegerType<2, false> { typedef Ushort type; };
+template<> struct IntegerType<4, false> { typedef Uint type; };
+template<> struct IntegerType<8, false> { typedef Ulong type; };
+
+// True if T is an integer type that does not have a TypeId mapping.
+template <class T> struct IsUnknownInteger {
+    static const bool value = !HasTypeId<T>::value && std::is_integral<T>::value;
+};
+
+}
+#endif // ENABLE_IF_HPP


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


[08/50] [abbrv] qpid-proton git commit: PROTON-781: Added GlobalOverrides to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added GlobalOverrides to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 2fea22a2bfddafe1f966dd72c2dedc816c580c4d
Parents: 6f30e8b
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 26 11:28:35 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 .../ruby/lib/reactor/global_overrides.rb        | 44 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2fea22a2/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index d8783bc..5b0d23f 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -97,6 +97,7 @@ require "reactor/task"
 require "reactor/acceptor"
 require "reactor/reactor"
 require "reactor/ssl_config"
+require "reactor/global_overrides"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2fea22a2/proton-c/bindings/ruby/lib/reactor/global_overrides.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/global_overrides.rb b/proton-c/bindings/ruby/lib/reactor/global_overrides.rb
new file mode 100644
index 0000000..11d05a5
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/global_overrides.rb
@@ -0,0 +1,44 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class GlobalOverrides
+
+    def initialize(base)
+      @base = base
+    end
+
+    def on_unhandled(name, event)
+      event.dispatch(@base) unless self.override?(event)
+    end
+
+    def override?(event)
+      conn = event.connection
+      if !conn.nil? && conn.overrides?
+        overrides = conn.overrides
+        result = event.dispatch(overrides)
+        return result
+      end
+      false
+    end
+
+  end
+
+end


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


[44/50] [abbrv] qpid-proton git commit: PROTON-865: Remove .go examples added in error.

Posted by ac...@apache.org.
PROTON-865: Remove .go examples added in error.


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

Branch: refs/heads/cjansen-cpp-client
Commit: f2e6df4e203ddc4cdf00372925317e781aa379b4
Parents: 6ecb052
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Jun 5 15:37:56 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 examples/go/CMakeLists.txt      |  29 ----
 examples/go/README.md           |  69 ---------
 examples/go/event/broker.go     | 255 -------------------------------
 examples/go/example_test.go     | 284 -----------------------------------
 examples/go/receive.go          | 176 ----------------------
 examples/go/send.go             | 158 -------------------
 proton-c/bindings/cpp/README.md |   3 +-
 7 files changed, 1 insertion(+), 973 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt
deleted file mode 100644
index 464ed7c..0000000
--- a/examples/go/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-
-# FIXME aconway 2015-05-20:
-# - use proton build for Go includes & libs.
-# - pre-build go libraries? Respect user GOPATH?
-
-if(BUILD_GO)
-  add_test(
-    NAME go_example_test
-    COMMAND ${GO_TEST} example_test.go -rpath ${CMAKE_BINARY_DIR}/proton-c
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/README.md
----------------------------------------------------------------------
diff --git a/examples/go/README.md b/examples/go/README.md
deleted file mode 100644
index 719a3d1..0000000
--- a/examples/go/README.md
+++ /dev/null
@@ -1,69 +0,0 @@
-# Go examples for proton
-
-The Go support for proton consists of 3 packages:
-
-- proton: converts AMQP messages and data types to and from Go data types.
-- proton/messaging: easy-to-use, concurrent API for messaging clients and servers.
-- proton/event: full low-level access to the proton engine.
-
-Most applications should use the proton/messaging API. proton/event is for
-applications that need low-level access to the proton engine. proton/messaging
-itself is implemented using proton/event.
-
-## proton/messaging examples
-
-- [receive.go](receive.go) receive from many connections concurrently.
-- [send.go](send.go) send to many connections concurrently.
-
-## proton/event examples
-
-- [broker.go](event/broker.go) simple mini-broker, queues are created automatically.
-
-## Running the examples
-
-Proton needs to be installed in a standard place such as `/usr` or `/usr/local`.
-(in future the examples will be able to use the local proton build)
-
-Set your environment:
-
-    export GOPATH=<path-to-proton-checkout>/proton-c/bindings/go
-
-You can run the examples directly from source with
-
-    go run <program>.go
-
-This is a little slow (a couple of seconds) as it compiles the program and runs it in one step.
-You can compile the program first and then run the executable to avoid the delay:
-
-    go build <program>.go
-    ./<program>
-
-All the examples take a `-h` flag to show usage information, see comments in the example
-source for more details.
-
-## Example of running the examples.
-
-First start the broker:
-
-    go run event/broker.go
-
-Send messages concurrently to queues "foo" and "bar", 10 messages to each queue:
-
-    go run go/send.go -count 10 localhost:/foo localhost:/bar
-
-Receive messages concurrently from "foo" and "bar". Note -count 20 for 10 messages each on 2 queues:
-
-    go run go/receive.go -count 20 localhost:/foo localhost:/bar
-
-The broker and clients use the amqp port on the local host by default, to use a
-different address use the `-addr host:port` flag.
-
-You can mix it up by running the Go clients with the python broker:
-
-    python ../python/broker.py
-
-Or use the Go broker and the python clients:
-
-    python ../python/simple_send.py
-    python ../python/simple_recv.py`.
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/event/broker.go
----------------------------------------------------------------------
diff --git a/examples/go/event/broker.go b/examples/go/event/broker.go
deleted file mode 100644
index 9720843..0000000
--- a/examples/go/event/broker.go
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-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.
-*/
-
-//
-// This is a simple AMQP broker implemented using the event-handler interface.
-//
-// It maintains a set of named in-memory queues of messages. Clients can send
-// messages to queues or subscribe to receive messages from them.
-//
-//
-
-package main
-
-import (
-	"container/list"
-	"flag"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"log"
-	"net"
-	"os"
-	"path"
-	"qpid.apache.org/proton"
-	"qpid.apache.org/proton/event"
-	"sync"
-)
-
-// Command-line flags
-var addr = flag.String("addr", ":amqp", "Listening address")
-var verbose = flag.Int("verbose", 1, "Output level, 0 means none, higher means more")
-var full = flag.Bool("full", false, "Print full message not just body.")
-
-func main() {
-	flag.Usage = func() {
-		fmt.Fprintf(os.Stderr, `
-Usage: %s
-A simple broker-like demo. Queues are created automatically for sender or receiver addrsses.
-`, os.Args[0])
-		flag.PrintDefaults()
-	}
-	flag.Parse()
-	b := newBroker()
-	err := b.listen(*addr)
-	fatalIf(err)
-}
-
-// queue is a structure representing a queue.
-type queue struct {
-	name      string              // Name of queue
-	messages  *list.List          // List of event.Message
-	consumers map[event.Link]bool // Set of consumer links
-}
-
-type logLink event.Link // Wrapper to print links in format for logging
-
-func (ll logLink) String() string {
-	l := event.Link(ll)
-	return fmt.Sprintf("%s[%p]", l.Name(), l.Session().Connection().Pump())
-}
-
-func (q *queue) subscribe(link event.Link) {
-	debug.Printf("link %s subscribed to queue %s", logLink(link), q.name)
-	q.consumers[link] = true
-}
-
-func (q *queue) unsubscribe(link event.Link) {
-	debug.Printf("link %s unsubscribed from queue %s", logLink(link), q.name)
-	delete(q.consumers, link)
-}
-
-func (q *queue) empty() bool {
-	return len(q.consumers) == 0 && q.messages.Len() == 0
-}
-
-func (q *queue) push(context *event.Pump, message proton.Message) {
-	q.messages.PushBack(message)
-	q.pop(context)
-}
-
-func (q *queue) popTo(context *event.Pump, link event.Link) bool {
-	if q.messages.Len() != 0 && link.Credit() > 0 {
-		message := q.messages.Remove(q.messages.Front()).(proton.Message)
-		debug.Printf("link %s <- queue %s: %s", logLink(link), q.name, formatMessage{message})
-		// The first return parameter is an event.Delivery.
-		// The Deliver can be used to track message status, e.g. so we can re-delver on failure.
-		// This demo broker doesn't do that.
-		linkPump := link.Session().Connection().Pump()
-		if context == linkPump {
-			if context == nil {
-				log.Fatal("pop in nil context")
-			}
-			link.Send(message) // link is in the current pump, safe to call Send() direct
-		} else {
-			linkPump.Inject <- func() { // Inject to link's pump
-				link.Send(message) // FIXME aconway 2015-05-04: error handlig
-			}
-		}
-		return true
-	}
-	return false
-}
-
-func (q *queue) pop(context *event.Pump) (popped bool) {
-	for c, _ := range q.consumers {
-		popped = popped || q.popTo(context, c)
-	}
-	return
-}
-
-// broker implements event.MessagingHandler and reacts to events by moving messages on or off queues.
-type broker struct {
-	queues map[string]*queue
-	lock   sync.Mutex // FIXME aconway 2015-05-04: un-golike, better broker coming...
-}
-
-func newBroker() *broker {
-	return &broker{queues: make(map[string]*queue)}
-}
-
-func (b *broker) getQueue(name string) *queue {
-	q := b.queues[name]
-	if q == nil {
-		debug.Printf("Create queue %s", name)
-		q = &queue{name, list.New(), make(map[event.Link]bool)}
-		b.queues[name] = q
-	}
-	return q
-}
-
-func (b *broker) unsubscribe(l event.Link) {
-	if l.IsSender() {
-		q := b.queues[l.RemoteSource().Address()]
-		if q != nil {
-			q.unsubscribe(l)
-			if q.empty() {
-				debug.Printf("Delete queue %s", q.name)
-				delete(b.queues, q.name)
-			}
-		}
-	}
-}
-
-func (b *broker) HandleMessagingEvent(t event.MessagingEventType, e event.Event) error {
-	// FIXME aconway 2015-05-04: locking is un-golike, better example coming soon.
-	// Needed because the same handler is used for multiple connections concurrently
-	// and the queue data structures are not thread safe.
-	b.lock.Lock()
-	defer b.lock.Unlock()
-
-	switch t {
-
-	case event.MLinkOpening:
-		if e.Link().IsSender() {
-			q := b.getQueue(e.Link().RemoteSource().Address())
-			q.subscribe(e.Link())
-		}
-
-	case event.MLinkDisconnected, event.MLinkClosing:
-		b.unsubscribe(e.Link())
-
-	case event.MSendable:
-		q := b.getQueue(e.Link().RemoteSource().Address())
-		q.popTo(e.Connection().Pump(), e.Link())
-
-	case event.MMessage:
-		m, err := event.DecodeMessage(e)
-		fatalIf(err)
-		qname := e.Link().RemoteTarget().Address()
-		debug.Printf("link %s -> queue %s: %s", logLink(e.Link()), qname, formatMessage{m})
-		b.getQueue(qname).push(e.Connection().Pump(), m)
-	}
-	return nil
-}
-
-func (b *broker) listen(addr string) (err error) {
-	// Use the standard Go "net" package to listen for connections.
-	info.Printf("Listening on %s", addr)
-	listener, err := net.Listen("tcp", addr)
-	if err != nil {
-		return err
-	}
-	defer listener.Close()
-	for {
-		conn, err := listener.Accept()
-		if err != nil {
-			info.Printf("Accept error: %s", err)
-			continue
-		}
-		pump, err := event.NewPump(conn, event.NewMessagingDelegator(b))
-		fatalIf(err)
-		info.Printf("Accepted %s[%p]", pump, pump)
-		pump.Server()
-		go func() {
-			pump.Run()
-			if pump.Error == nil {
-				info.Printf("Closed %s", pump)
-			} else {
-				info.Printf("Closed %s: %s", pump, pump.Error)
-			}
-		}()
-	}
-}
-
-// Logging
-func logger(prefix string, level int, w io.Writer) *log.Logger {
-	if *verbose >= level {
-		return log.New(w, prefix, 0)
-	}
-	return log.New(ioutil.Discard, "", 0)
-}
-
-var info, debug *log.Logger
-
-func init() {
-	flag.Parse()
-	name := path.Base(os.Args[0])
-	log.SetFlags(0)
-	log.SetPrefix(fmt.Sprintf("%s: ", name))                      // Log errors on stderr.
-	info = logger(fmt.Sprintf("%s: ", name), 1, os.Stdout)        // Log info on stdout.
-	debug = logger(fmt.Sprintf("%s debug: ", name), 2, os.Stderr) // Log debug on stderr.
-}
-
-// Simple error handling for demo.
-func fatalIf(err error) {
-	if err != nil {
-		log.Fatal(err)
-	}
-}
-
-type formatMessage struct{ m proton.Message }
-
-func (fm formatMessage) String() string {
-	if *full {
-		return fmt.Sprintf("%#v", fm.m)
-	} else {
-		return fmt.Sprintf("%#v", fm.m.Body())
-	}
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/example_test.go
----------------------------------------------------------------------
diff --git a/examples/go/example_test.go b/examples/go/example_test.go
deleted file mode 100644
index 8879c38..0000000
--- a/examples/go/example_test.go
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
-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.
-*/
-
-// Tests to verify that example code behaves as expected.
-// Run in this directory with `go test example_test.go`
-//
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"flag"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"math/rand"
-	"net"
-	"os"
-	"os/exec"
-	"path"
-	"path/filepath"
-	"reflect"
-	"testing"
-	"time"
-)
-
-func panicIf(err error) {
-	if err != nil {
-		panic(err)
-	}
-}
-
-// A demo broker process
-type broker struct {
-	cmd    *exec.Cmd
-	addr   string
-	runerr chan error
-	err    error
-}
-
-// Try to connect to the broker to verify it is ready, give up after a timeout
-func (b *broker) check() error {
-	dialer := net.Dialer{Deadline: time.Now().Add(time.Second * 10)}
-	for {
-		c, err := dialer.Dial("tcp", b.addr)
-		if err == nil { // Success
-			c.Close()
-			return nil
-		}
-		select {
-		case runerr := <-b.runerr: // Broker exited.
-			return runerr
-		default:
-		}
-		if neterr, ok := err.(net.Error); ok && neterr.Timeout() { // Running but timed out
-			b.stop()
-			return fmt.Errorf("timed out waiting for broker")
-		}
-		time.Sleep(time.Second / 10)
-	}
-}
-
-// Start the demo broker, wait till it is listening on *addr. No-op if already started.
-func (b *broker) start() error {
-	if b.cmd == nil { // Not already started
-		// FIXME aconway 2015-04-30: better way to pick/configure a broker port.
-		b.addr = fmt.Sprintf("127.0.0.1:%d", rand.Intn(10000)+10000)
-		b.cmd = exampleCommand("event_broker", "-addr", b.addr)
-		b.runerr = make(chan error)
-		b.cmd.Stderr, b.cmd.Stdout = os.Stderr, os.Stdout
-		go func() {
-			b.runerr <- b.cmd.Run()
-		}()
-		b.err = b.check()
-	}
-	return b.err
-}
-
-func (b *broker) stop() {
-	if b != nil && b.cmd != nil {
-		b.cmd.Process.Kill()
-		b.cmd.Wait()
-	}
-}
-
-func checkEqual(want interface{}, got interface{}) error {
-	if reflect.DeepEqual(want, got) {
-		return nil
-	}
-	return fmt.Errorf("%#v != %#v", want, got)
-}
-
-// runCommand returns an exec.Cmd to run an example.
-func exampleCommand(prog string, arg ...string) *exec.Cmd {
-	build(prog + ".go")
-	args := []string{}
-	if *debug {
-		args = append(args, "-debug=true")
-	}
-	args = append(args, arg...)
-	cmd := exec.Command(exepath(prog), args...)
-	cmd.Stderr = os.Stderr
-	return cmd
-}
-
-// Run an example Go program, return the combined output as a string.
-func runExample(prog string, arg ...string) (string, error) {
-	cmd := exampleCommand(prog, arg...)
-	out, err := cmd.Output()
-	return string(out), err
-}
-
-func prefix(prefix string, err error) error {
-	if err != nil {
-		return fmt.Errorf("%s: %s", prefix, err)
-	}
-	return nil
-}
-
-func runExampleWant(want string, prog string, args ...string) error {
-	out, err := runExample(prog, args...)
-	if err != nil {
-		return fmt.Errorf("%s failed: %s: %s", prog, err, out)
-	}
-	return prefix(prog, checkEqual(want, out))
-}
-
-func exampleArgs(args ...string) []string {
-	return append(args, testBroker.addr+"/foo", testBroker.addr+"/bar", testBroker.addr+"/baz")
-}
-
-// Send then receive
-func TestExampleSendReceive(t *testing.T) {
-	if testing.Short() {
-		t.Skip("Skip demo tests in short mode")
-	}
-	testBroker.start()
-	err := runExampleWant(
-		"Received all 15 acknowledgements\n",
-		"send",
-		exampleArgs("-count", "5")...)
-	if err != nil {
-		t.Fatal(err)
-	}
-	err = runExampleWant(
-		"Listening on 3 connections\nReceived 15 messages\n",
-		"receive",
-		exampleArgs("-count", "15")...)
-	if err != nil {
-		t.Fatal(err)
-	}
-}
-
-var ready error
-
-func init() { ready = fmt.Errorf("Ready") }
-
-// Run receive in a goroutine.
-// Send ready on errchan when it is listening.
-// Send final error when it is done.
-// Returns the Cmd, caller must Wait()
-func goReceiveWant(errchan chan<- error, want string, arg ...string) *exec.Cmd {
-	cmd := exampleCommand("receive", arg...)
-	go func() {
-		pipe, err := cmd.StdoutPipe()
-		if err != nil {
-			errchan <- err
-			return
-		}
-		out := bufio.NewReader(pipe)
-		cmd.Start()
-		line, err := out.ReadString('\n')
-		if err != nil && err != io.EOF {
-			errchan <- err
-			return
-		}
-		listening := "Listening on 3 connections\n"
-		if line != listening {
-			errchan <- checkEqual(listening, line)
-			return
-		}
-		errchan <- ready
-		buf := bytes.Buffer{}
-		io.Copy(&buf, out) // Collect the rest of the output
-		errchan <- checkEqual(want, buf.String())
-		close(errchan)
-	}()
-	return cmd
-}
-
-// Start receiver first, wait till it is running, then send.
-func TestExampleReceiveSend(t *testing.T) {
-	if testing.Short() {
-		t.Skip("Skip demo tests in short mode")
-	}
-	testBroker.start()
-	recvErr := make(chan error)
-	recvCmd := goReceiveWant(recvErr,
-		"Received 15 messages\n",
-		exampleArgs("-count", "15")...)
-	defer func() {
-		recvCmd.Process.Kill()
-		recvCmd.Wait()
-	}()
-	if err := <-recvErr; err != ready { // Wait for receiver ready
-		t.Fatal(err)
-	}
-	err := runExampleWant(
-		"Received all 15 acknowledgements\n",
-		"send",
-		exampleArgs("-count", "5")...)
-	if err != nil {
-		t.Fatal(err)
-	}
-	if err := <-recvErr; err != nil {
-		t.Fatal(err)
-	}
-}
-
-func exepath(relative string) string {
-	if binDir == "" {
-		panic("bindir not set, cannot run example binaries")
-	}
-	return path.Join(binDir, relative)
-}
-
-var testBroker *broker
-var binDir, exampleDir string
-var built map[string]bool
-
-func init() {
-	built = make(map[string]bool)
-}
-
-func build(prog string) {
-	if !built[prog] {
-		args := []string{"build"}
-		if *rpath != "" {
-			args = append(args, "-ldflags", "-r "+*rpath)
-		}
-		args = append(args, path.Join(exampleDir, prog))
-		build := exec.Command("go", args...)
-		build.Dir = binDir
-		out, err := build.CombinedOutput()
-		if err != nil {
-			panic(fmt.Errorf("%v: %s", err, out))
-		}
-		built[prog] = true
-	}
-}
-
-var rpath = flag.String("rpath", "", "Runtime path for test executables")
-var debug = flag.Bool("debug", false, "Debugging output from examples")
-
-func TestMain(m *testing.M) {
-	rand.Seed(time.Now().UTC().UnixNano())
-	var err error
-	exampleDir, err = filepath.Abs(".")
-	panicIf(err)
-	binDir, err = ioutil.TempDir("", "example_test.go")
-	panicIf(err)
-	defer os.Remove(binDir) // Clean up binaries
-	testBroker = &broker{}  // Broker is started on-demand by tests.
-	testBroker.stop()
-	status := m.Run()
-	testBroker.stop()
-	os.Exit(status)
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/receive.go
----------------------------------------------------------------------
diff --git a/examples/go/receive.go b/examples/go/receive.go
deleted file mode 100644
index fc1c85a..0000000
--- a/examples/go/receive.go
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
-	"flag"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"log"
-	"math"
-	"net"
-	"os"
-	"path"
-	"qpid.apache.org/proton"
-	"qpid.apache.org/proton/messaging"
-	"sync"
-	"time"
-)
-
-// Command-line flags
-var verbose = flag.Int("verbose", 1, "Output level, 0 means none, higher means more")
-var count = flag.Int64("count", 0, "Stop after receiving this many messages. 0 means unlimited.")
-var timeout = flag.Int64("time", 0, "Stop after this many seconds. 0 means unlimited.")
-var full = flag.Bool("full", false, "Print full message not just body.")
-
-func main() {
-	// Parse flags and arguments, print usage message on error.
-	flag.Usage = func() {
-		fmt.Fprintf(os.Stderr, `
-Usage: %s url [url ...]
-Receive messages from all the listed URLs concurrently and print them.
-`, os.Args[0])
-		flag.PrintDefaults()
-	}
-	flag.Parse()
-	urls := flag.Args() // Non-flag arguments are URLs to receive from
-	if len(urls) == 0 {
-		flag.Usage()
-		fmt.Fprintf(os.Stderr, "No URL provided")
-		os.Exit(1)
-	}
-	duration := time.Duration(*timeout) * time.Second
-	if duration == 0 {
-		duration = time.Duration(math.MaxInt64) // Not forever, but 290 years is close enough.
-	}
-	if *count == 0 {
-		*count = math.MaxInt64
-	}
-
-	// Create a goroutine for each URL that receives messages and sends them to
-	// the messages channel. main() receives and prints them.
-
-	messages := make(chan proton.Message) // Channel for messages from goroutines to main()
-	stop := make(chan struct{})           // Closing this channel means the program is stopping.
-
-	var wait sync.WaitGroup // Used by main() to wait for all goroutines to end.
-
-	wait.Add(len(urls)) // Wait for one goroutine per URL.
-
-	// Arrange to close all connections on exit
-	connections := make([]*messaging.Connection, len(urls))
-	defer func() {
-		for _, c := range connections {
-			if c != nil {
-				c.Close()
-			}
-		}
-	}()
-
-	for i, urlStr := range urls {
-		debug.Printf("Connecting to %s", urlStr)
-		go func(urlStr string) {
-			defer wait.Done()                   // Notify main() that this goroutine is done.
-			url, err := proton.ParseURL(urlStr) // Like net/url.Parse() but with AMQP defaults.
-			fatalIf(err)
-
-			// Open a standard Go net.Conn for the AMQP connection
-			conn, err := net.Dial("tcp", url.Host) // Note net.URL.Host is actually "host:port"
-			fatalIf(err)
-
-			pc, err := messaging.Connect(conn) // This is our AMQP connection.
-			fatalIf(err)
-			connections[i] = pc
-
-			// For convenience a proton.Connection provides a DefaultSession()
-			// pc.Receiver() is equivalent to pc.DefaultSession().Receiver()
-			r, err := pc.Receiver(url.Path)
-			fatalIf(err)
-
-			for {
-				var m proton.Message
-				select { // Receive a message or stop.
-				case m = <-r.Receive:
-				case <-stop: // The program is stopping.
-					return
-				}
-				select { // Send m to main() or stop
-				case messages <- m: // Send m to main()
-				case <-stop: // The program is stopping.
-					return
-				}
-			}
-		}(urlStr)
-	}
-	info.Printf("Listening")
-
-	// time.After() returns a channel that will close when the timeout is up.
-	timer := time.After(duration)
-
-	// main() prints each message and checks for count or timeout being exceeded.
-	for i := int64(0); i < *count; i++ {
-		select {
-		case m := <-messages:
-			debug.Print(formatMessage{m})
-		case <-timer: // Timeout has expired
-			i = 0
-		}
-	}
-	info.Printf("Received %d messages", *count)
-	close(stop) // Signal all goroutines to stop.
-	wait.Wait() // Wait for all goroutines to finish.
-}
-
-// Logging
-func logger(prefix string, level int, w io.Writer) *log.Logger {
-	if *verbose >= level {
-		return log.New(w, prefix, 0)
-	}
-	return log.New(ioutil.Discard, "", 0)
-}
-
-var info, debug *log.Logger
-
-func init() {
-	flag.Parse()
-	name := path.Base(os.Args[0])
-	log.SetFlags(0)                                               // Use default logger for errors.
-	log.SetPrefix(fmt.Sprintf("%s: ", name))                      // Log errors on stderr.
-	info = logger(fmt.Sprintf("%s: ", name), 1, os.Stdout)        // Log info on stdout.
-	debug = logger(fmt.Sprintf("%s debug: ", name), 2, os.Stderr) // Log debug on stderr.
-}
-
-// Simple error handling for demo.
-func fatalIf(err error) {
-	if err != nil {
-		log.Fatal(err)
-	}
-}
-
-type formatMessage struct{ m proton.Message }
-
-func (fm formatMessage) String() string {
-	if *full {
-		return fmt.Sprintf("%#v", fm.m)
-	} else {
-		return fmt.Sprintf("%#v", fm.m.Body())
-	}
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/examples/go/send.go
----------------------------------------------------------------------
diff --git a/examples/go/send.go b/examples/go/send.go
deleted file mode 100644
index 46603bf..0000000
--- a/examples/go/send.go
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
-	"flag"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"log"
-	"math"
-	"net"
-	"os"
-	"path"
-	"qpid.apache.org/proton"
-	"qpid.apache.org/proton/messaging"
-	"sync"
-)
-
-// Command-line flags
-var verbose = flag.Int("verbose", 1, "Output level, 0 means none, higher means more")
-var count = flag.Int64("count", 1, "Send this may messages per address. 0 means unlimited.")
-
-// Ack associates an info string with an acknowledgement
-type Ack struct {
-	ack  messaging.Acknowledgement
-	info string
-}
-
-func main() {
-	// Parse flags and arguments, print usage message on error.
-	flag.Usage = func() {
-		fmt.Fprintf(os.Stderr, `
-Usage: %s url [url ...]
-Send messages to all the listed URLs concurrently.
-To each URL, send the string "path-n" where n is the message number.
-`, os.Args[0])
-		flag.PrintDefaults()
-	}
-	flag.Parse()
-	urls := flag.Args() // Non-flag arguments are URLs to receive from
-	if len(urls) == 0 {
-		flag.Usage()
-		fmt.Fprintf(os.Stderr, "No URL provided\n")
-		os.Exit(1)
-	}
-	if *count == 0 {
-		*count = math.MaxInt64
-	}
-
-	// Create a channel to receive all the acknowledgements
-	acks := make(chan Ack)
-
-	// Create a goroutine for each URL that sends messages.
-	var wait sync.WaitGroup // Used by main() to wait for all goroutines to end.
-	wait.Add(len(urls))     // Wait for one goroutine per URL.
-
-	// Arrange to close all connections on exit
-	connections := make([]*messaging.Connection, len(urls))
-	defer func() {
-		for _, c := range connections {
-			c.Close()
-		}
-	}()
-
-	for i, urlStr := range urls {
-		url, err := proton.ParseURL(urlStr) // Like net/url.Parse() but with AMQP defaults.
-		fatalIf(err)
-		debug.Printf("Connecting to %v", url)
-
-		// Open a standard Go net.Conn for the AMQP connection
-		conn, err := net.Dial("tcp", url.Host) // Note net.URL.Host is actually "host:port"
-		fatalIf(err)
-
-		pc, err := messaging.Connect(conn) // This is our AMQP connection using conn.
-		fatalIf(err)
-		connections[i] = pc
-
-		// Start a goroutine to send to urlStr
-		go func(urlStr string) {
-			defer wait.Done() // Notify main() that this goroutine is done.
-
-			// FIXME aconway 2015-04-29: sessions, default sessions, senders...
-			// Create a sender using the path of the URL as the AMQP target address
-			s, err := pc.Sender(url.Path)
-			fatalIf(err)
-
-			for i := int64(0); i < *count; i++ {
-				m := proton.NewMessage()
-				body := fmt.Sprintf("%v-%v", url.Path, i)
-				m.SetBody(body)
-				ack, err := s.Send(m)
-				fatalIf(err)
-				acks <- Ack{ack, body}
-			}
-		}(urlStr)
-	}
-
-	// Wait for all the acknowledgements
-	expect := int(*count) * len(urls)
-	debug.Printf("Started senders, expect %v acknowledgements", expect)
-	for i := 0; i < expect; i++ {
-		ack, ok := <-acks
-		if !ok {
-			info.Fatalf("acks channel closed after only %d acks\n", i)
-		}
-		d := <-ack.ack
-		debug.Printf("acknowledgement[%v] %v", i, ack.info)
-		if d != messaging.Accepted {
-			info.Printf("Unexpected disposition %v", d)
-		}
-	}
-	info.Printf("Received all %v acknowledgements", expect)
-	wait.Wait() // Wait for all goroutines to finish.
-}
-
-// Logging
-func logger(prefix string, level int, w io.Writer) *log.Logger {
-	if *verbose >= level {
-		return log.New(w, prefix, 0)
-	}
-	return log.New(ioutil.Discard, "", 0)
-}
-
-var info, debug *log.Logger
-
-func init() {
-	flag.Parse()
-	name := path.Base(os.Args[0])
-	log.SetFlags(0)                                               // Use default logger for errors.
-	log.SetPrefix(fmt.Sprintf("%s: ", name))                      // Log errors on stderr.
-	info = logger(fmt.Sprintf("%s: ", name), 1, os.Stdout)        // Log info on stdout.
-	debug = logger(fmt.Sprintf("%s debug: ", name), 2, os.Stderr) // Log debug on stderr.
-}
-
-// Simple error handling for demo.
-func fatalIf(err error) {
-	if err != nil {
-		log.Fatal(err)
-	}
-}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f2e6df4e/proton-c/bindings/cpp/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/README.md b/proton-c/bindings/cpp/README.md
index 8872211..5e35874 100644
--- a/proton-c/bindings/cpp/README.md
+++ b/proton-c/bindings/cpp/README.md
@@ -1,7 +1,6 @@
 # C++ binding for proton.
 
-This is a C++ wrapper for the proton reactor API.
-It is very similar to the python wrapper for the same API.
+This is a C++ binding for the proton API.
 
 There are [examples](../../../examples/cpp/README.md) and the header files have
 API documentation in doxygen format.


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


[43/50] [abbrv] qpid-proton git commit: NO-JIRA: Fix bug in pn_data_point, saving point when parent = current = 0.

Posted by ac...@apache.org.
NO-JIRA: Fix bug in pn_data_point, saving point when parent = current = 0.


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

Branch: refs/heads/cjansen-cpp-client
Commit: f6d6dc724b324eac07ba69c365d904803a6e69ea
Parents: f2e6df4
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Jun 10 17:43:25 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/src/codec/codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f6d6dc72/proton-c/src/codec/codec.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c
index c00e79a..573887e 100644
--- a/proton-c/src/codec/codec.c
+++ b/proton-c/src/codec/codec.c
@@ -1156,7 +1156,7 @@ pn_handle_t pn_data_point(pn_data_t *data)
 bool pn_data_restore(pn_data_t *data, pn_handle_t point)
 {
   pn_shandle_t spoint = (pn_shandle_t) point;
-  if (spoint < 0 && ((size_t) (-spoint)) <= data->size) {
+  if (spoint <= 0 && ((size_t) (-spoint)) <= data->size) {
     data->parent = -((pn_shandle_t) point);
     data->current = 0;
     return true;


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


[35/50] [abbrv] qpid-proton git commit: PROTON-865: new cjansen-cpp-client branch for fledgling C++ client code using the event reactor

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
new file mode 100644
index 0000000..7ff9c1d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -0,0 +1,301 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingEvent.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Session.h"
+#include "proton/cpp/MessagingAdapter.h"
+#include "proton/cpp/Acceptor.h"
+#include "proton/cpp/exceptions.h"
+#include "LogInternal.h"
+
+#include "ContainerImpl.h"
+#include "ConnectionImpl.h"
+#include "Connector.h"
+#include "contexts.h"
+#include "Url.h"
+#include "platform.h"
+#include "PrivateImplRef.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+
+namespace proton {
+namespace reactor {
+
+namespace {
+
+ConnectionImpl *getImpl(const Connection &c) {
+    return PrivateImplRef<Connection>::get(c);
+}
+
+ContainerImpl *getImpl(const Container &c) {
+    return PrivateImplRef<Container>::get(c);
+}
+
+} // namespace
+
+
+class CHandler : public Handler
+{
+  public:
+    CHandler(pn_handler_t *h) : pnHandler(h) {
+        pn_incref(pnHandler);
+    }
+    ~CHandler() {
+        pn_decref(pnHandler);
+    }
+    pn_handler_t *getPnHandler() { return pnHandler; }
+  private:
+    pn_handler_t *pnHandler;
+};
+
+
+void dispatch(Handler &h, MessagingEvent &e) {
+    // TODO: also dispatch to add()'ed Handlers
+    CHandler *chandler;
+    int type = e.getType();
+    if (type &&  (chandler = dynamic_cast<CHandler*>(&h))) {
+        // event and handler are both native Proton C
+        pn_handler_dispatch(chandler->getPnHandler(), e.getPnEvent(), (pn_event_type_t) type);
+    }
+    else
+        e.dispatch(h);
+}
+
+// Used to sniff for Connector events before the reactor's global handler sees them.
+class OverrideHandler : public Handler
+{
+  public:
+    pn_handler_t *baseHandler;
+
+    OverrideHandler(pn_handler_t *h) : baseHandler(h) {
+        pn_incref(baseHandler);
+    }
+    ~OverrideHandler() {
+        pn_decref(baseHandler);
+    }
+
+
+    virtual void onUnhandled(Event &e) {
+        ProtonEvent *pne = dynamic_cast<ProtonEvent *>(&e);
+        // If not a Proton reactor event, nothing to override, nothing to pass along.
+        if (!pne) return;
+        int type = pne->getType();
+        if (!type) return;  // Also not from the reactor
+
+        pn_event_t *cevent = pne->getPnEvent();
+        pn_connection_t *conn = pn_event_connection(cevent);
+        if (conn && type != PN_CONNECTION_INIT) {
+            // send to override handler first
+            ConnectionImpl *connection = getConnectionContext(conn);
+            if (connection) {
+                Handler *override = connection->getOverride();
+                if (override)
+                    e.dispatch(*override);
+            }
+        }
+
+        pn_handler_dispatch(baseHandler, cevent, (pn_event_type_t) type);
+
+        if (conn && type == PN_CONNECTION_FINAL) {
+            //  TODO:  this must be the last acation of the last handler looking at
+            //  connection events. Better: generate a custom FINAL event (or task).  Or move to
+            //  separate event streams per connection as part of multi threading support.
+            ConnectionImpl *cimpl = getConnectionContext(conn);
+            if (cimpl)
+                cimpl->reactorDetach();
+        }
+    }
+};
+
+namespace {
+
+// TODO: configurable policy.  SessionPerConnection for now.
+Session getDefaultSession(pn_connection_t *conn, pn_session_t **ses) {
+    if (!*ses) {
+        *ses = pn_session(conn);
+        pn_session_open(*ses);
+    }
+    return Session(*ses);
+}
+
+
+struct InboundContext {
+    ContainerImpl *containerImpl;
+    Container containerRef;  // create only once for all inbound events
+    Handler *cppHandler;
+};
+
+ContainerImpl *getContainerImpl(pn_handler_t *c_handler) {
+    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
+    return ctxt->containerImpl;
+}
+
+Container &getContainerRef(pn_handler_t *c_handler) {
+    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
+    return ctxt->containerRef;
+}
+
+Handler &getCppHandler(pn_handler_t *c_handler) {
+    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
+    return *ctxt->cppHandler;
+}
+
+void cpp_handler_dispatch(pn_handler_t *c_handler, pn_event_t *cevent, pn_event_type_t type)
+{
+    MessagingEvent ev(cevent, type, getContainerRef(c_handler));
+    dispatch(getCppHandler(c_handler), ev);
+}
+
+void cpp_handler_cleanup(pn_handler_t *c_handler)
+{
+    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(c_handler);
+    ctxt->containerRef.~Container();
+}
+
+pn_handler_t *cpp_handler(ContainerImpl *c, Handler *h)
+{
+    pn_handler_t *handler = pn_handler_new(cpp_handler_dispatch, sizeof(struct InboundContext), cpp_handler_cleanup);
+    struct InboundContext *ctxt = (struct InboundContext *) pn_handler_mem(handler);
+    ctxt->containerRef = Container(c);
+    ctxt->containerImpl = c;
+    ctxt->cppHandler = h;
+    return handler;
+}
+
+
+} // namespace
+
+
+void ContainerImpl::incref(ContainerImpl *impl) {
+    impl->refCount++;
+}
+
+void ContainerImpl::decref(ContainerImpl *impl) {
+    impl->refCount--;
+    if (impl->refCount == 0)
+        delete impl;
+}
+
+ContainerImpl::ContainerImpl(MessagingHandler &mhandler) :
+    reactor(0), globalHandler(0), messagingHandler(mhandler), containerId(generateUuid()),
+    refCount(0)
+{
+}
+
+ContainerImpl::~ContainerImpl() {}
+
+Connection ContainerImpl::connect(std::string &host) {
+    if (!reactor) throw ProtonException(MSG("Container not initialized"));
+    Container cntnr(this);
+    Connection connection(cntnr);
+    Connector *connector = new Connector(connection);
+    // Connector self-deletes depending on reconnect logic
+    connector->setAddress(host);  // TODO: url vector
+    connection.setOverride(connector);
+    connection.open();
+    return connection;
+}
+
+pn_reactor_t *ContainerImpl::getReactor() { return reactor; }
+
+pn_handler_t *ContainerImpl::getGlobalHandler() { return globalHandler; }
+
+std::string ContainerImpl::getContainerId() { return containerId; }
+
+
+Sender ContainerImpl::createSender(Connection &connection, std::string &addr) {
+    Session session = getDefaultSession(connection.getPnConnection(), &getImpl(connection)->defaultSession);
+    Sender snd = session.createSender(containerId  + '-' + addr);
+    pn_terminus_set_address(pn_link_target(snd.getPnLink()), addr.c_str());
+    snd.open();
+
+    ConnectionImpl *connImpl = getImpl(connection);
+    return snd;
+}
+
+Sender ContainerImpl::createSender(std::string &urlString) {
+    Connection conn = connect(urlString);
+    Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
+    std::string path = Url(urlString).getPath();
+    Sender snd = session.createSender(containerId + '-' + path);
+    pn_terminus_set_address(pn_link_target(snd.getPnLink()), path.c_str());
+    snd.open();
+
+    ConnectionImpl *connImpl = getImpl(conn);
+    return snd;
+}
+
+Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr) {
+    ConnectionImpl *connImpl = getImpl(connection);
+    Session session = getDefaultSession(connImpl->pnConnection, &connImpl->defaultSession);
+    Receiver rcv = session.createReceiver(containerId + '-' + addr);
+    pn_terminus_set_address(pn_link_source(rcv.getPnLink()), addr.c_str());
+    rcv.open();
+    return rcv;
+}
+
+Acceptor ContainerImpl::acceptor(const std::string &host, const std::string &port) {
+    pn_acceptor_t *acptr = pn_reactor_acceptor(reactor, host.c_str(), port.c_str(), NULL);
+    if (acptr)
+        return Acceptor(acptr);
+    else
+        throw ProtonException(MSG("accept fail: " << pn_error_text(pn_io_error(pn_reactor_io(reactor))) << "(" << host << ":" << port << ")"));
+}
+
+Acceptor ContainerImpl::listen(const std::string &urlString) {
+    Url url(urlString);
+    // TODO: SSL
+    return acceptor(url.getHost(), url.getPort());
+}
+
+
+void ContainerImpl::run() {
+    reactor = pn_reactor();
+    // Set our context on the reactor
+    setContainerContext(reactor, this);
+
+    // Set the reactor's main/default handler (see note below)
+    MessagingAdapter messagingAdapter(messagingHandler);
+    messagingHandler.addChildHandler(messagingAdapter);
+    pn_handler_t *cppHandler = cpp_handler(this, &messagingHandler);
+    pn_reactor_set_handler(reactor, cppHandler);
+
+    // Set our own global handler that "subclasses" the existing one
+    pn_handler_t *cGlobalHandler = pn_reactor_get_global_handler(reactor);
+    pn_incref(cGlobalHandler);
+    OverrideHandler overrideHandler(cGlobalHandler);
+    pn_handler_t *cppGlobalHandler = cpp_handler(this, &overrideHandler);
+    pn_reactor_set_global_handler(reactor, cppGlobalHandler);
+
+    // Note: we have just set up the following 4 handlers that see events in this order:
+    // messagingHandler, messagingAdapter, connector override, the reactor's default global
+    // handler (pn_iohandler)
+    // TODO: remove fifth pn_handshaker once messagingAdapter matures
+
+    pn_reactor_run(reactor);
+    pn_decref(cGlobalHandler);
+    pn_reactor_free(reactor);
+    reactor = 0;
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
new file mode 100644
index 0000000..a14bf52
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ContainerImpl.h
@@ -0,0 +1,69 @@
+#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/cpp/ImportExport.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Link.h"
+
+#include "proton/reactor.h"
+
+#include <string>
+namespace proton {
+namespace reactor {
+
+class DispatchHelper;
+class Connection;
+class Connector;
+class Acceptor;
+
+class ContainerImpl
+{
+  public:
+    PROTON_CPP_EXTERN ContainerImpl(MessagingHandler &mhandler);
+    PROTON_CPP_EXTERN ~ContainerImpl();
+    PROTON_CPP_EXTERN Connection connect(std::string &host);
+    PROTON_CPP_EXTERN void run();
+    PROTON_CPP_EXTERN pn_reactor_t *getReactor();
+    PROTON_CPP_EXTERN pn_handler_t *getGlobalHandler();
+    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Sender createSender(std::string &url);
+    PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
+    PROTON_CPP_EXTERN std::string getContainerId();
+    static void incref(ContainerImpl *);
+    static void decref(ContainerImpl *);
+  private:
+    void dispatch(pn_event_t *event, pn_event_type_t type);
+    Acceptor acceptor(const std::string &host, const std::string &port);
+    pn_reactor_t *reactor;
+    pn_handler_t *globalHandler;
+    MessagingHandler &messagingHandler;
+    std::string containerId;
+    int refCount;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Endpoint.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Endpoint.cpp b/proton-c/bindings/cpp/src/Endpoint.cpp
new file mode 100644
index 0000000..868f361
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Endpoint.cpp
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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/cpp/Endpoint.h"
+#include "proton/cpp/Connection.h"
+#include "proton/cpp/Transport.h"
+
+namespace proton {
+namespace reactor {
+
+Endpoint::Endpoint() {}
+
+Endpoint::~Endpoint() {}
+
+Transport &Endpoint::getTransport() {
+    return getConnection().getTransport();
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Event.cpp b/proton-c/bindings/cpp/src/Event.cpp
new file mode 100644
index 0000000..531c764
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Event.cpp
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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/reactor.h"
+#include "proton/event.h"
+
+#include "proton/cpp/Event.h"
+#include "proton/cpp/Handler.h"
+#include "proton/cpp/exceptions.h"
+
+#include "Msg.h"
+#include "contexts.h"
+
+namespace proton {
+namespace reactor {
+
+Event::Event() {}
+
+Event::~Event() {}
+
+
+Container &Event::getContainer() {
+    // Subclasses to override as appropriate
+    throw ProtonException(MSG("No container context for event"));
+}
+
+Connection &Event::getConnection() {
+    throw ProtonException(MSG("No connection context for Event"));
+}
+
+Sender Event::getSender() {
+    throw ProtonException(MSG("No Sender context for event"));
+}
+
+Receiver Event::getReceiver() {
+    throw ProtonException(MSG("No Receiver context for event"));
+}
+
+Link Event::getLink() {
+    throw ProtonException(MSG("No Link context for event"));
+}
+
+Message Event::getMessage() {
+    throw ProtonException(MSG("No message associated with event"));
+}
+
+void Event::setMessage(Message &) {
+    throw ProtonException(MSG("Operation not supported for this type of event"));
+}
+
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Handler.cpp b/proton-c/bindings/cpp/src/Handler.cpp
new file mode 100644
index 0000000..4d1b581
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Handler.cpp
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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/cpp/Handler.h"
+#include "proton/cpp/Event.h"
+
+namespace proton {
+namespace reactor {
+
+Handler::Handler(){};
+Handler::~Handler(){};
+
+void Handler::onUnhandled(Event &e){};
+
+void Handler::addChildHandler(Handler &e) {
+    childHandlers.push_back(&e);
+}
+
+std::vector<Handler *>::iterator Handler::childHandlersBegin() {
+    return childHandlers.begin();
+}
+
+std::vector<Handler *>::iterator Handler::childHandlersEnd() {
+    return childHandlers.end();
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp
new file mode 100644
index 0000000..3356b38
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Link.cpp
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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/cpp/Link.h"
+#include "proton/cpp/exceptions.h"
+#include "proton/cpp/Connection.h"
+#include "ConnectionImpl.h"
+#include "Msg.h"
+#include "contexts.h"
+#include "ProtonImplRef.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/link.h"
+
+namespace proton {
+namespace reactor {
+
+namespace {
+
+static inline void throwIfNull(pn_link_t *l) { if (!l) throw ProtonException(MSG("Disassociated link")); }
+
+}
+
+template class ProtonHandle<pn_link_t>;
+typedef ProtonImplRef<Link> PI;
+
+Link::Link(pn_link_t* p) {
+    verifyType(p);
+    PI::ctor(*this, p);
+    if (p) senderLink = pn_link_is_sender(p);
+}
+Link::Link() {
+    PI::ctor(*this, 0);
+}
+Link::Link(const Link& c) : ProtonHandle<pn_link_t>() {
+    verifyType(impl);
+    PI::copy(*this, c);
+    senderLink = c.senderLink;
+}
+Link& Link::operator=(const Link& c) {
+    verifyType(impl);
+    senderLink = c.senderLink;
+    return PI::assign(*this, c);
+}
+Link::~Link() { PI::dtor(*this); }
+
+void Link::verifyType(pn_link_t *l) {} // Generic link can be sender or receiver
+
+pn_link_t *Link::getPnLink() const { return impl; }
+
+void Link::open() {
+    throwIfNull(impl);
+    pn_link_open(impl);
+}
+
+void Link::close() {
+    throwIfNull(impl);
+    pn_link_close(impl);
+}
+
+bool Link::isSender() {
+    return impl && senderLink;
+}
+
+bool Link::isReceiver() {
+    return impl && !senderLink;
+}
+
+int Link::getCredit() {
+    throwIfNull(impl);
+    return pn_link_credit(impl);
+}
+
+Connection &Link::getConnection() {
+    throwIfNull(impl);
+    pn_session_t *s = pn_link_session(impl);
+    pn_connection_t *c = pn_session_connection(s);
+    return ConnectionImpl::getReactorReference(c);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/LogInternal.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/LogInternal.h b/proton-c/bindings/cpp/src/LogInternal.h
new file mode 100644
index 0000000..427f90b
--- /dev/null
+++ b/proton-c/bindings/cpp/src/LogInternal.h
@@ -0,0 +1,51 @@
+#ifndef PROTON_CPP_LOG_INTERNAL_H
+#define PROTON_CPP_LOG_INTERNAL_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 "Msg.h"
+
+namespace proton {
+namespace reactor {
+
+enum Level { trace, debug, info, notice, warning, error, critical };
+
+class Logger
+{
+public:
+    // TODO: build out to be ultra configurable as for corresponding QPID class + Statement
+    static void log(Level level, const char* file, int line, const char* function, const std::string& message);
+private:
+    //This class has only one instance so no need to copy
+    Logger();
+    ~Logger();
+
+    Logger(const Logger&);
+    Logger operator=(const Logger&);
+};
+
+// Just do simple logging for now
+#define PN_CPP_LOG(LEVEL, MESSAGE) Logger::log(LEVEL, 0, 0, 0, ::proton::reactor::Msg() << MESSAGE)
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_LOG_INTERNAL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Logger.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Logger.cpp b/proton-c/bindings/cpp/src/Logger.cpp
new file mode 100644
index 0000000..2671b2e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Logger.cpp
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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 "LogInternal.h"
+#include <cstdlib>
+
+namespace proton {
+namespace reactor {
+
+namespace {
+bool levelSet = false;
+Level logLevel = error;
+Level getLogLevel() {
+    if (!levelSet) {
+        levelSet = true;
+        const char *l = getenv("PROTON_CPP_LOG_LEVEL");
+        if (l && l[0] != 0 && l[1] == 0) {
+            char low = '0' + trace;
+            char high = '0' + critical;
+            if (*l >= low && *l <= high)
+                logLevel = (Level) (*l - '0');
+        }
+    }
+    return logLevel;
+}
+
+} // namespace
+
+
+void Logger::log(Level level, const char* file, int line, const char* function, const std::string& message)
+{
+    if (level >= getLogLevel()) {
+        std::cout << message << std::endl;
+        std::cout.flush();
+    }
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/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
new file mode 100644
index 0000000..840a10b
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Message.cpp
@@ -0,0 +1,92 @@
+/*
+ *
+ * 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/cpp/Message.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+
+namespace proton {
+namespace reactor {
+
+Message::Message() : pnMessage(pn_message()){}
+
+Message::~Message() {
+    pn_decref(pnMessage);
+}
+
+Message::Message(const Message& m) : pnMessage(m.pnMessage) {
+    pn_incref(pnMessage);
+}
+
+Message& Message::operator=(const Message& m) {
+    pnMessage = m.pnMessage;
+    pn_incref(pnMessage);
+    return *this;
+}
+
+void Message::setBody(const std::string &buf) {
+    pn_data_t *body = pn_message_body(pnMessage);
+    pn_data_put_string(body, pn_bytes(buf.size(), buf.data()));
+}
+
+std::string Message::getBody() {
+    pn_data_t *body = pn_message_body(pnMessage);
+    if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
+        pn_bytes_t bytes= pn_data_get_string(body);
+        if (!pn_data_next(body)) {
+            // String data and nothing else
+            return std::string(bytes.start, bytes.size);
+        }
+    }
+
+    pn_data_rewind(body);
+    std::string str;
+    size_t sz = 1024;
+    str.resize(sz);
+    int err = pn_data_format(body, (char *) str.data(), &sz);
+    if (err == PN_OVERFLOW)
+        throw ProtonException(MSG("TODO: sizing loop missing"));
+    if (err) throw ProtonException(MSG("Unexpected data error"));
+    str.resize(sz);
+    return str;
+}
+
+void Message::encode(std::string &s) {
+    size_t sz = 1024;
+    if (s.capacity() > sz)
+        sz = s.capacity();
+    else
+        s.reserve(sz);
+    s.resize(sz);
+    int err = pn_message_encode(pnMessage, (char *) s.data(), &sz);
+    if (err == PN_OVERFLOW)
+        throw ProtonException(MSG("TODO: fix overflow with dynamic buffer resizing"));
+    if (err) throw ProtonException(MSG("unexpected error"));
+    s.resize(sz);
+}
+
+void Message::decode(const std::string &s) {
+    int err = pn_message_decode(pnMessage, s.data(), s.size());
+    if (err) throw ProtonException(MSG("unexpected error"));
+}
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
new file mode 100644
index 0000000..9cab2b3
--- /dev/null
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -0,0 +1,191 @@
+/*
+ *
+ * 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/cpp/MessagingAdapter.h"
+#include "proton/cpp/MessagingEvent.h"
+#include "proton/cpp/Sender.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+
+#include "proton/link.h"
+#include "proton/handlers.h"
+#include "proton/delivery.h"
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+MessagingAdapter::MessagingAdapter(MessagingHandler &d) : delegate(d), handshaker(pn_handshaker()) {
+    pn_handler_t *flowcontroller = pn_flowcontroller(10);
+    pn_handler_add(handshaker, flowcontroller);
+    pn_decref(flowcontroller);
+};
+MessagingAdapter::~MessagingAdapter(){
+    pn_decref(handshaker);
+};
+
+void MessagingAdapter::onReactorInit(Event &e) {
+    // create onStart extended event
+    MessagingEvent mevent(PN_MESSAGING_START, NULL, e.getContainer());
+    mevent.dispatch(delegate);
+}
+
+void MessagingAdapter::onLinkFlow(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *pne = pe->getPnEvent();
+        pn_link_t *lnk = pn_event_link(pne);
+        if (lnk && pn_link_is_sender(lnk) && pn_link_credit(lnk) > 0) {
+            // create onMessage extended event
+            MessagingEvent mevent(PN_MESSAGING_SENDABLE, pe, e.getContainer());
+            mevent.dispatch(delegate);
+        }
+   }
+}
+
+namespace {
+Message receiveMessage(pn_link_t *lnk, pn_delivery_t *dlv) {
+    std::string buf;
+    size_t sz = pn_delivery_pending(dlv);
+    buf.resize(sz);
+    ssize_t n = pn_link_recv(lnk, (char *) buf.data(), sz);
+    if (n != (ssize_t) sz)
+        throw ProtonException(MSG("link read failure"));
+    Message m;
+    m. decode(buf);
+    pn_link_advance(lnk);
+    return m;
+}
+} // namespace
+
+void MessagingAdapter::onDelivery(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *cevent = pe->getPnEvent();
+        pn_link_t *lnk = pn_event_link(cevent);
+        pn_delivery_t *dlv = pn_event_delivery(cevent);
+
+        if (pn_link_is_receiver(lnk)) {
+            if (!pn_delivery_partial(dlv) && pn_delivery_readable(dlv)) {
+                // generate onMessage
+                MessagingEvent mevent(PN_MESSAGING_MESSAGE, pe, pe->getContainer());
+                Message m(receiveMessage(lnk, dlv));
+                mevent.setMessage(m);
+                // TODO: check if endpoint closed...
+                mevent.dispatch(delegate);
+                // only do auto accept for now
+                pn_delivery_update(dlv, PN_ACCEPTED);
+                pn_delivery_settle(dlv);
+                // TODO: generate onSettled
+            }
+        } else {
+            // Sender
+            if (pn_delivery_updated(dlv)) {
+                uint64_t rstate = pn_delivery_remote_state(dlv);
+                if (rstate == PN_ACCEPTED)
+                    // generate onAccepted
+                    MessagingEvent(PN_MESSAGING_ACCEPTED, pe, pe->getContainer()).dispatch(delegate);
+                else if (rstate = PN_REJECTED)
+                    MessagingEvent(PN_MESSAGING_REJECTED, pe, pe->getContainer()).dispatch(delegate);
+                else if (rstate == PN_RELEASED || rstate == PN_MODIFIED)
+                    MessagingEvent(PN_MESSAGING_RELEASED, pe, pe->getContainer()).dispatch(delegate);
+
+                if (pn_delivery_settled(dlv))
+                    MessagingEvent(PN_MESSAGING_SETTLED, pe, pe->getContainer()).dispatch(delegate);
+
+                pn_delivery_settle(dlv); // TODO: only if auto settled
+            }
+        }
+    }
+}
+
+namespace {
+
+bool isLocalOpen(pn_state_t state) {
+    return state & PN_LOCAL_ACTIVE;
+}
+
+bool isLocalUnititialised(pn_state_t state) {
+    return state & PN_LOCAL_UNINIT;
+}
+
+bool isLocalClosed(pn_state_t state) {
+    return state & PN_LOCAL_CLOSED;
+}
+
+bool isRemoteOpen(pn_state_t state) {
+    return state & PN_REMOTE_ACTIVE;
+}
+
+bool isRemoteClosed(pn_state_t state) {
+    return state & PN_REMOTE_CLOSED;
+}
+
+} // namespace
+
+void MessagingAdapter::onConnectionRemoteClose(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *cevent = pe->getPnEvent();
+        pn_connection_t *conn = pn_event_connection(cevent);
+        // TODO: remote condition -> error
+        if (isLocalClosed(pn_connection_state(conn))) {
+            MessagingEvent(PN_MESSAGING_CONNECTION_CLOSED, pe, pe->getContainer()).dispatch(delegate);
+        }
+        else {
+            MessagingEvent(PN_MESSAGING_CONNECTION_CLOSING, pe, pe->getContainer()).dispatch(delegate);
+        }
+        pn_connection_close(conn);
+    }
+}
+
+
+void MessagingAdapter::onLinkRemoteOpen(Event &e) {
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_t *cevent = pe->getPnEvent();
+        pn_link_t *link = pn_event_link(cevent);
+        // TODO: remote condition -> error
+        if (isLocalOpen(pn_link_state(link))) {
+            MessagingEvent(PN_MESSAGING_LINK_OPENED, pe, pe->getContainer()).dispatch(delegate);
+        }
+        else if (isLocalUnititialised(pn_link_state(link))) {
+            MessagingEvent(PN_MESSAGING_LINK_OPENING, pe, pe->getContainer()).dispatch(delegate);
+            pn_link_open(link);
+        }
+    }
+}
+
+
+void MessagingAdapter::onUnhandled(Event &e) {
+    // Until this code fleshes out closer to python's, cheat a bit with a pn_handshaker
+
+    ProtonEvent *pe = dynamic_cast<ProtonEvent*>(&e);
+    if (pe) {
+        pn_event_type_t type = (pn_event_type_t) pe->getType();
+        if (type != PN_EVENT_NONE) {
+            pn_handler_dispatch(handshaker, pe->getPnEvent(), type);
+        }
+    }
+}
+
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/MessagingEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingEvent.cpp b/proton-c/bindings/cpp/src/MessagingEvent.cpp
new file mode 100644
index 0000000..bcfb721
--- /dev/null
+++ b/proton-c/bindings/cpp/src/MessagingEvent.cpp
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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/reactor.h"
+#include "proton/event.h"
+#include "proton/link.h"
+
+#include "proton/cpp/MessagingEvent.h"
+#include "proton/cpp/ProtonHandler.h"
+#include "proton/cpp/MessagingHandler.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+#include "contexts.h"
+
+namespace proton {
+namespace reactor {
+
+MessagingEvent::MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c) :
+    ProtonEvent(ce, t, c), messagingType(PN_MESSAGING_PROTON), parentEvent(0), message(0)
+{}
+
+MessagingEvent::MessagingEvent(MessagingEventType_t t, ProtonEvent *p, Container &c) :
+    ProtonEvent(NULL, PN_EVENT_NONE, c), messagingType(t), parentEvent(p), message(0) {
+    if (messagingType == PN_MESSAGING_PROTON)
+        throw ProtonException(MSG("invalid messaging event type"));
+}
+
+MessagingEvent::~MessagingEvent() {
+    delete message;
+}
+
+Connection &MessagingEvent::getConnection() {
+    if (messagingType == PN_MESSAGING_PROTON)
+        return ProtonEvent::getConnection();
+    if (parentEvent)
+        return parentEvent->getConnection();
+    throw ProtonException(MSG("No connection context for event"));
+}
+
+Sender MessagingEvent::getSender() {
+    if (messagingType == PN_MESSAGING_PROTON)
+        return ProtonEvent::getSender();
+    if (parentEvent)
+        return parentEvent->getSender();
+    throw ProtonException(MSG("No sender context for event"));
+}
+
+Receiver MessagingEvent::getReceiver() {
+    if (messagingType == PN_MESSAGING_PROTON)
+        return ProtonEvent::getReceiver();
+    if (parentEvent)
+        return parentEvent->getReceiver();
+    throw ProtonException(MSG("No receiver context for event"));
+}
+
+Link MessagingEvent::getLink() {
+    if (messagingType == PN_MESSAGING_PROTON)
+        return ProtonEvent::getLink();
+    if (parentEvent)
+        return parentEvent->getLink();
+    throw ProtonException(MSG("No link context for event"));
+}
+
+Message MessagingEvent::getMessage() {
+    if (message)
+        return *message;
+    throw ProtonException(MSG("No message context for event"));
+}
+
+void MessagingEvent::setMessage(Message &m) {
+    if (messagingType != PN_MESSAGING_MESSAGE)
+        throw ProtonException(MSG("Event type does not provide message"));
+    delete message;
+    message = new Message(m);
+}
+
+void MessagingEvent::dispatch(Handler &h) {
+    if (messagingType == PN_MESSAGING_PROTON) {
+        ProtonEvent::dispatch(h);
+        return;
+    }
+
+    MessagingHandler *handler = dynamic_cast<MessagingHandler*>(&h);
+    if (handler) {
+        switch(messagingType) {
+
+        case PN_MESSAGING_START:       handler->onStart(*this); break;
+        case PN_MESSAGING_SENDABLE:    handler->onSendable(*this); break;
+        case PN_MESSAGING_MESSAGE:     handler->onMessage(*this); break;
+        case PN_MESSAGING_ACCEPTED:    handler->onAccepted(*this); break;
+        case PN_MESSAGING_REJECTED:    handler->onRejected(*this); break;
+        case PN_MESSAGING_RELEASED:    handler->onReleased(*this); break;
+        case PN_MESSAGING_SETTLED:     handler->onSettled(*this); break;
+
+        case PN_MESSAGING_CONNECTION_CLOSING:     handler->onConnectionClosing(*this); break;
+        case PN_MESSAGING_CONNECTION_CLOSED:      handler->onConnectionClosed(*this); break;
+        case PN_MESSAGING_LINK_OPENING:           handler->onLinkOpening(*this); break;
+        case PN_MESSAGING_LINK_OPENED:            handler->onLinkOpened(*this); break;
+
+        default:
+            throw ProtonException(MSG("Unkown messaging event type " << messagingType));
+            break;
+        }
+    } else {
+        h.onUnhandled(*this);
+    }
+
+    // recurse through children
+    for (std::vector<Handler *>::iterator child = h.childHandlersBegin();
+         child != h.childHandlersEnd(); ++child) {
+        dispatch(**child);
+    }
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
new file mode 100644
index 0000000..7cb48f6
--- /dev/null
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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/cpp/MessagingHandler.h"
+#include "proton/cpp/Event.h"
+
+namespace proton {
+namespace reactor {
+
+MessagingHandler::MessagingHandler(){};
+MessagingHandler::~MessagingHandler(){};
+
+void MessagingHandler::onAbort(Event &e) { onUnhandled(e); }
+void MessagingHandler::onAccepted(Event &e) { onUnhandled(e); }
+void MessagingHandler::onCommit(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionClose(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionClosed(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionClosing(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionOpen(Event &e) { onUnhandled(e); }
+void MessagingHandler::onConnectionOpened(Event &e) { onUnhandled(e); }
+void MessagingHandler::onDisconnected(Event &e) { onUnhandled(e); }
+void MessagingHandler::onFetch(Event &e) { onUnhandled(e); }
+void MessagingHandler::onIdLoaded(Event &e) { onUnhandled(e); }
+void MessagingHandler::onLinkClosing(Event &e) { onUnhandled(e); }
+void MessagingHandler::onLinkOpened(Event &e) { onUnhandled(e); }
+void MessagingHandler::onLinkOpening(Event &e) { onUnhandled(e); }
+void MessagingHandler::onMessage(Event &e) { onUnhandled(e); }
+void MessagingHandler::onQuit(Event &e) { onUnhandled(e); }
+void MessagingHandler::onRecordInserted(Event &e) { onUnhandled(e); }
+void MessagingHandler::onRecordsLoaded(Event &e) { onUnhandled(e); }
+void MessagingHandler::onRejected(Event &e) { onUnhandled(e); }
+void MessagingHandler::onReleased(Event &e) { onUnhandled(e); }
+void MessagingHandler::onRequest(Event &e) { onUnhandled(e); }
+void MessagingHandler::onResponse(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSendable(Event &e) { onUnhandled(e); }
+void MessagingHandler::onSettled(Event &e) { onUnhandled(e); }
+void MessagingHandler::onStart(Event &e) { onUnhandled(e); }
+void MessagingHandler::onTimer(Event &e) { onUnhandled(e); }
+void MessagingHandler::onTransactionAborted(Event &e) { onUnhandled(e); }
+void MessagingHandler::onTransactionCommitted(Event &e) { onUnhandled(e); }
+void MessagingHandler::onTransactionDeclared(Event &e) { onUnhandled(e); }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Msg.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Msg.h b/proton-c/bindings/cpp/src/Msg.h
new file mode 100644
index 0000000..1168d35
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Msg.h
@@ -0,0 +1,79 @@
+#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 {
+namespace reactor {
+
+/** A simple wrapper 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(); }
+
+    Msg& operator<<(long n) { os << n; return *this; }
+    Msg& operator<<(unsigned long n) { os << n; return *this; }
+    Msg& operator<<(bool n) { os << n; return *this; }
+    Msg& operator<<(short n) { os << n; return *this; }
+    Msg& operator<<(unsigned short n) { os << n; return *this; }
+    Msg& operator<<(int n) { os << n; return *this; }
+    Msg& operator<<(unsigned int n) { os << n; return *this; }
+#ifdef _GLIBCXX_USE_LONG_LONG
+    Msg& operator<<(long long n) { os << n; return *this; }
+    Msg& operator<<(unsigned long long n) { os << n; return *this; }
+#endif
+    Msg& operator<<(double n) { os << n; return *this; }
+    Msg& operator<<(float n) { os << n; return *this; }
+    Msg& operator<<(long double n) { os << n; return *this; }
+
+    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::reactor::Msg() << message << " (" __FILE__ ":" QUOTE(__LINE__) ")")
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/PrivateImplRef.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/PrivateImplRef.h b/proton-c/bindings/cpp/src/PrivateImplRef.h
new file mode 100644
index 0000000..a2dccc2
--- /dev/null
+++ b/proton-c/bindings/cpp/src/PrivateImplRef.h
@@ -0,0 +1,97 @@
+#ifndef PROTON_CPP_PRIVATEIMPL_H
+#define PROTON_CPP_PRIVATEIMPL_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/cpp/ImportExport.h"
+
+namespace proton {
+namespace reactor {
+
+// Modified from qpid::messaging version to work without
+// boost::intrusive_ptr but integrate with Proton's pn_class_t
+// reference counting.  Thread safety currently absent but fluid in
+// intention...
+
+
+/**
+ * Helper class to implement a class with a private, reference counted
+ * implementation and reference semantics.
+ *
+ * Such classes are used in the public API to hide implementation, they
+ * should. Example of use:
+ *
+ * === Foo.h
+ *
+ * template <class T> PrivateImplRef;
+ * class FooImpl;
+ *
+ * Foo : public Handle<FooImpl> {
+ *  public:
+ *   Foo(FooImpl* = 0);
+ *   Foo(const Foo&);
+ *   ~Foo();
+ *   Foo& operator=(const Foo&);
+ *
+ *   int fooDo();              //  and other Foo functions...
+ *
+ *  private:
+ *   typedef FooImpl Impl;
+ *   Impl* impl;
+ *   friend class PrivateImplRef<Foo>;
+ *
+ * === Foo.cpp
+ *
+ * typedef PrivateImplRef<Foo> PI;
+ * Foo::Foo(FooImpl* p) { PI::ctor(*this, p); }
+ * Foo::Foo(const Foo& c) : Handle<FooImpl>() { PI::copy(*this, c); }
+ * Foo::~Foo() { PI::dtor(*this); }
+ * Foo& Foo::operator=(const Foo& c) { return PI::assign(*this, c); }
+ *
+ * int foo::fooDo() { return impl->fooDo(); }
+ *
+ */
+template <class T> class PrivateImplRef {
+  public:
+    typedef typename T::Impl Impl;
+
+    /** Get the implementation pointer from a handle */
+    static Impl* get(const T& t) { return t.impl; }
+
+    /** Set the implementation pointer in a handle */
+    static void set(T& t, const Impl* p) {
+        if (t.impl == p) return;
+        if (t.impl) Impl::decref(t.impl);
+        t.impl = const_cast<Impl *>(p);
+        if (t.impl) Impl::incref(t.impl);
+    }
+
+    // Helper functions to implement the ctor, dtor, copy, assign
+    static void ctor(T& t, Impl* p) { t.impl = p; if (p) Impl::incref(p); }
+    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+    static void dtor(T& t) { if(t.impl) Impl::decref(t.impl); }
+    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PRIVATEIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ProtonEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonEvent.cpp b/proton-c/bindings/cpp/src/ProtonEvent.cpp
new file mode 100644
index 0000000..16b92b6
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ProtonEvent.cpp
@@ -0,0 +1,152 @@
+/*
+ *
+ * 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/reactor.h"
+#include "proton/event.h"
+#include "proton/link.h"
+
+#include "proton/cpp/ProtonEvent.h"
+#include "proton/cpp/ProtonHandler.h"
+#include "proton/cpp/exceptions.h"
+#include "proton/cpp/Container.h"
+
+#include "ConnectionImpl.h"
+#include "Msg.h"
+#include "contexts.h"
+
+namespace proton {
+namespace reactor {
+
+ProtonEvent::ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c) :
+        pnEvent(ce),
+        type((int) t),
+        container(c)
+{}
+
+int ProtonEvent::getType() { return type; }
+
+pn_event_t *ProtonEvent::getPnEvent() { return pnEvent; }
+
+Container &ProtonEvent::getContainer() { return container; }
+
+Connection &ProtonEvent::getConnection() {
+    pn_connection_t *conn = pn_event_connection(getPnEvent());
+    if (!conn)
+        throw ProtonException(MSG("No connection context for this event"));
+    return ConnectionImpl::getReactorReference(conn);
+}
+
+Sender ProtonEvent::getSender() {
+    pn_link_t *lnk = pn_event_link(getPnEvent());
+    if (lnk && pn_link_is_sender(lnk))
+        return Sender(lnk);
+    throw ProtonException(MSG("No sender context for this event"));
+}
+
+Receiver ProtonEvent::getReceiver() {
+    pn_link_t *lnk = pn_event_link(getPnEvent());
+    if (lnk && pn_link_is_receiver(lnk))
+        return Receiver(lnk);
+    throw ProtonException(MSG("No receiver context for this event"));
+}
+
+Link ProtonEvent::getLink() {
+    pn_link_t *lnk = pn_event_link(getPnEvent());
+    if (lnk)
+        if (pn_link_is_sender(lnk))
+            return Sender(lnk);
+        else
+            return Receiver(lnk);
+    throw ProtonException(MSG("No link context for this event"));
+}
+
+
+
+
+void ProtonEvent::dispatch(Handler &h) {
+    ProtonHandler *handler = dynamic_cast<ProtonHandler*>(&h);
+
+    if (handler) {
+        switch(type) {
+
+        case PN_REACTOR_INIT: handler->onReactorInit(*this); break;
+        case PN_REACTOR_QUIESCED: handler->onReactorQuiesced(*this); break;
+        case PN_REACTOR_FINAL: handler->onReactorFinal(*this); break;
+
+        case PN_TIMER_TASK: handler->onTimerTask(*this); break;
+
+        case PN_CONNECTION_INIT: handler->onConnectionInit(*this); break;
+        case PN_CONNECTION_BOUND: handler->onConnectionBound(*this); break;
+        case PN_CONNECTION_UNBOUND: handler->onConnectionUnbound(*this); break;
+        case PN_CONNECTION_LOCAL_OPEN: handler->onConnectionLocalOpen(*this); break;
+        case PN_CONNECTION_LOCAL_CLOSE: handler->onConnectionLocalClose(*this); break;
+        case PN_CONNECTION_REMOTE_OPEN: handler->onConnectionRemoteOpen(*this); break;
+        case PN_CONNECTION_REMOTE_CLOSE: handler->onConnectionRemoteClose(*this); break;
+        case PN_CONNECTION_FINAL: handler->onConnectionFinal(*this); break;
+
+        case PN_SESSION_INIT: handler->onSessionInit(*this); break;
+        case PN_SESSION_LOCAL_OPEN: handler->onSessionLocalOpen(*this); break;
+        case PN_SESSION_LOCAL_CLOSE: handler->onSessionLocalClose(*this); break;
+        case PN_SESSION_REMOTE_OPEN: handler->onSessionRemoteOpen(*this); break;
+        case PN_SESSION_REMOTE_CLOSE: handler->onSessionRemoteClose(*this); break;
+        case PN_SESSION_FINAL: handler->onSessionFinal(*this); break;
+
+        case PN_LINK_INIT: handler->onLinkInit(*this); break;
+        case PN_LINK_LOCAL_OPEN: handler->onLinkLocalOpen(*this); break;
+        case PN_LINK_LOCAL_CLOSE: handler->onLinkLocalClose(*this); break;
+        case PN_LINK_LOCAL_DETACH: handler->onLinkLocalDetach(*this); break;
+        case PN_LINK_REMOTE_OPEN: handler->onLinkRemoteOpen(*this); break;
+        case PN_LINK_REMOTE_CLOSE: handler->onLinkRemoteClose(*this); break;
+        case PN_LINK_REMOTE_DETACH: handler->onLinkRemoteDetach(*this); break;
+        case PN_LINK_FLOW: handler->onLinkFlow(*this); break;
+        case PN_LINK_FINAL: handler->onLinkFinal(*this); break;
+
+        case PN_DELIVERY: handler->onDelivery(*this); break;
+
+        case PN_TRANSPORT: handler->onTransport(*this); break;
+        case PN_TRANSPORT_ERROR: handler->onTransportError(*this); break;
+        case PN_TRANSPORT_HEAD_CLOSED: handler->onTransportHeadClosed(*this); break;
+        case PN_TRANSPORT_TAIL_CLOSED: handler->onTransportTailClosed(*this); break;
+        case PN_TRANSPORT_CLOSED: handler->onTransportClosed(*this); break;
+
+        case PN_SELECTABLE_INIT: handler->onSelectableInit(*this); break;
+        case PN_SELECTABLE_UPDATED: handler->onSelectableUpdated(*this); break;
+        case PN_SELECTABLE_READABLE: handler->onSelectableReadable(*this); break;
+        case PN_SELECTABLE_WRITABLE: handler->onSelectableWritable(*this); break;
+        case PN_SELECTABLE_EXPIRED: handler->onSelectableExpired(*this); break;
+        case PN_SELECTABLE_ERROR: handler->onSelectableError(*this); break;
+        case PN_SELECTABLE_FINAL: handler->onSelectableFinal(*this); break;
+        default:
+            throw ProtonException(MSG("Invalid Proton event type " << type));
+            break;
+        }
+    } else {
+        h.onUnhandled(*this);
+    }
+
+    // recurse through children
+    for (std::vector<Handler *>::iterator child = h.childHandlersBegin();
+         child != h.childHandlersEnd(); ++child) {
+        dispatch(**child);
+    }
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ProtonHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonHandler.cpp b/proton-c/bindings/cpp/src/ProtonHandler.cpp
new file mode 100644
index 0000000..83d9087
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ProtonHandler.cpp
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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/cpp/ProtonHandler.h"
+#include "proton/cpp/ProtonEvent.h"
+
+namespace proton {
+namespace reactor {
+
+ProtonHandler::ProtonHandler(){};
+
+// Everything goes to onUnhandled() unless overriden by subclass
+
+void ProtonHandler::onReactorInit(Event &e) { onUnhandled(e); }
+void ProtonHandler::onReactorQuiesced(Event &e) { onUnhandled(e); }
+void ProtonHandler::onReactorFinal(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTimerTask(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionInit(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionBound(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionUnbound(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionLocalOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionLocalClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionRemoteOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionRemoteClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onConnectionFinal(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionInit(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionLocalOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionLocalClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionRemoteOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionRemoteClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSessionFinal(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkInit(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkLocalOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkLocalClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkLocalDetach(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkRemoteOpen(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkRemoteClose(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkRemoteDetach(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkFlow(Event &e) { onUnhandled(e); }
+void ProtonHandler::onLinkFinal(Event &e) { onUnhandled(e); }
+void ProtonHandler::onDelivery(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTransport(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTransportError(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTransportHeadClosed(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTransportTailClosed(Event &e) { onUnhandled(e); }
+void ProtonHandler::onTransportClosed(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableInit(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableUpdated(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableReadable(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableWritable(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableExpired(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableError(Event &e) { onUnhandled(e); }
+void ProtonHandler::onSelectableFinal(Event &e) { onUnhandled(e); }
+
+void ProtonHandler::onUnhandled(Event &e) {}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/ProtonImplRef.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonImplRef.h b/proton-c/bindings/cpp/src/ProtonImplRef.h
new file mode 100644
index 0000000..8f9f360
--- /dev/null
+++ b/proton-c/bindings/cpp/src/ProtonImplRef.h
@@ -0,0 +1,66 @@
+#ifndef PROTON_CPP_PROTONIMPL_H
+#define PROTON_CPP_PROTONIMPL_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/cpp/ImportExport.h"
+#include "proton/object.h"
+
+namespace proton {
+namespace reactor {
+
+// Modified from qpid::messaging version to work without
+// boost::intrusive_ptr but integrate with Proton's pn_class_t
+// reference counting.  Thread safety currently absent but fluid in
+// intention...
+
+
+/**
+ * See PrivateImplRef.h  This is for lightly wrapped Proton pn_object_t targets.
+ * class Foo : ProtonHandle<pn_foo_t> {...}
+ */
+
+template <class T> class ProtonImplRef {
+  public:
+    typedef typename T::Impl Impl;
+
+    /** Get the implementation pointer from a handle */
+    static Impl* get(const T& t) { return t.impl; }
+
+    /** Set the implementation pointer in a handle */
+    static void set(T& t, const Impl* p) {
+        if (t.impl == p) return;
+        if (t.impl) pn_decref(t.impl);
+        t.impl = const_cast<Impl *>(p);
+        if (t.impl) pn_incref(t.impl);
+    }
+
+    // Helper functions to implement the ctor, dtor, copy, assign
+    static void ctor(T& t, Impl* p) { t.impl = p; if (p) pn_incref(p); }
+    static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+    static void dtor(T& t) { if(t.impl) pn_decref(t.impl); }
+    static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Receiver.cpp b/proton-c/bindings/cpp/src/Receiver.cpp
new file mode 100644
index 0000000..557e736
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Receiver.cpp
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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/cpp/Link.h"
+#include "proton/cpp/Receiver.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/link.h"
+
+namespace proton {
+namespace reactor {
+
+
+Receiver::Receiver(pn_link_t *lnk) : Link(lnk) {}
+Receiver::Receiver() : Link(0) {}
+
+void Receiver::verifyType(pn_link_t *lnk) {
+    if (lnk && pn_link_is_sender(lnk))
+        throw ProtonException(MSG("Creating receiver with sender context"));
+}
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
new file mode 100644
index 0000000..74d4b0f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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/cpp/Link.h"
+#include "proton/cpp/Sender.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+#include "contexts.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/link.h"
+#include "proton/types.h"
+#include "proton/codec.h"
+#include "proton/message.h"
+#include "proton/delivery.h"
+#include <stdlib.h>
+#include <string.h>
+
+namespace proton {
+namespace reactor {
+
+
+Sender::Sender(pn_link_t *lnk = 0) : Link(lnk) {}
+Sender::Sender() : Link(0) {}
+
+void Sender::verifyType(pn_link_t *lnk) {
+    if (lnk && pn_link_is_receiver(lnk))
+        throw ProtonException(MSG("Creating sender with receiver context"));
+}
+
+namespace{
+// revisit if thread safety required
+uint64_t tagCounter = 0;
+}
+
+void Sender::send(Message &message) {
+    char tag[8];
+    void *ptr = &tag;
+    uint64_t id = ++tagCounter;
+    *((uint64_t *) ptr) = id;
+    pn_delivery_t *dlv = pn_delivery(getPnLink(), pn_dtag(tag, 8));
+    std::string buf;
+    message.encode(buf);
+    pn_link_t *link = getPnLink();
+    pn_link_send(link, buf.data(), buf.size());
+    pn_link_advance(link);
+    if (pn_link_snd_settle_mode(link) == PN_SND_SETTLED)
+        pn_delivery_settle(dlv);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Session.cpp b/proton-c/bindings/cpp/src/Session.cpp
new file mode 100644
index 0000000..d2b01dd
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Session.cpp
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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/cpp/Session.h"
+#include "contexts.h"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/cpp/Session.h"
+#include "proton/cpp/Connection.h"
+#include "ConnectionImpl.h"
+
+namespace proton {
+namespace reactor {
+
+
+Session::Session(pn_session_t *s) : pnSession(s)
+{
+    pn_incref(pnSession);
+}
+
+Session::~Session() {
+    pn_decref(pnSession);
+}
+
+pn_session_t *Session::getPnSession() { return pnSession; }
+
+void Session::open() {
+    pn_session_open(pnSession);
+}
+
+Connection &Session::getConnection() {
+    pn_connection_t *c = pn_session_connection(pnSession);
+    return ConnectionImpl::getReactorReference(c);
+}
+
+Receiver Session::createReceiver(std::string name) {
+    pn_link_t *link = pn_receiver(pnSession, name.c_str());
+    return Receiver(link);
+}
+
+Sender Session::createSender(std::string name) {
+    pn_link_t *link = pn_sender(pnSession, name.c_str());
+    return Sender(link);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Transport.cpp b/proton-c/bindings/cpp/src/Transport.cpp
new file mode 100644
index 0000000..7f22b84
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Transport.cpp
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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/cpp/Transport.h"
+#include "proton/cpp/Connection.h"
+
+#include "proton/transport.h"
+
+namespace proton {
+namespace reactor {
+
+
+Transport::Transport() : connection(0), pnTransport(pn_transport()) {} ;
+
+Transport::~Transport() { pn_decref(pnTransport); }
+
+void Transport::bind(Connection &c) {
+    connection = &c;
+    pn_transport_bind(pnTransport, c.getPnConnection());
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Url.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.cpp b/proton-c/bindings/cpp/src/Url.cpp
new file mode 100644
index 0000000..058bd2f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Url.cpp
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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/cpp/exceptions.h"
+#include "Url.h"
+#include "ProtonImplRef.h"
+#include "Msg.h"
+
+namespace proton {
+namespace reactor {
+
+template class ProtonHandle<pn_url_t>;
+typedef ProtonImplRef<Url> PI;
+
+
+Url::Url(const std::string &url) {
+    pn_url_t *up = pn_url_parse(url.c_str());
+    // refcount is 1, no need to incref
+    if (!up)
+        throw ProtonException(MSG("invalid URL: " << url));
+    impl = up;
+}
+
+Url::~Url() { PI::dtor(*this); }
+
+Url::Url(const Url& c) : ProtonHandle<pn_url_t>() {
+    PI::copy(*this, c);
+}
+
+Url& Url::operator=(const Url& c) {
+    return PI::assign(*this, c);
+}
+
+std::string Url::getPort() {
+    const char *p = pn_url_get_port(impl);
+    if (!p)
+        return std::string("5672");
+    else
+        return std::string(p);
+}
+
+std::string Url::getHost() {
+    const char *p = pn_url_get_host(impl);
+    if (!p)
+        return std::string("0.0.0.0");
+    else
+        return std::string(p);
+}
+
+std::string Url::getPath() {
+    const char *p = pn_url_get_path(impl);
+    if (!p)
+        return std::string("");
+    else
+        return std::string(p);
+}
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/Url.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.h b/proton-c/bindings/cpp/src/Url.h
new file mode 100644
index 0000000..042ab45
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Url.h
@@ -0,0 +1,49 @@
+#ifndef PROTON_CPP_URL_H
+#define PROTON_CPP_URL_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/cpp/ImportExport.h"
+#include "proton/cpp/ProtonHandle.h"
+#include "proton/url.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class Url : public ProtonHandle<pn_url_t>
+{
+  public:
+    PROTON_CPP_EXTERN Url(const std::string &url);
+    PROTON_CPP_EXTERN ~Url();
+    PROTON_CPP_EXTERN Url(const Url&);
+    PROTON_CPP_EXTERN Url& operator=(const Url&);
+    PROTON_CPP_EXTERN std::string getHost();
+    PROTON_CPP_EXTERN std::string getPort();
+    PROTON_CPP_EXTERN std::string getPath();
+  private:
+    friend class ProtonImplRef<Url>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_URL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
new file mode 100644
index 0000000..b1dec49
--- /dev/null
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -0,0 +1,92 @@
+/*
+ *
+ * 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 "contexts.h"
+#include "proton/cpp/exceptions.h"
+#include "Msg.h"
+#include "proton/object.h"
+#include "proton/session.h"
+#include "proton/link.h"
+
+PN_HANDLE(PNI_CPP_CONNECTION_CONTEXT)
+PN_HANDLE(PNI_CPP_SESSION_CONTEXT)
+PN_HANDLE(PNI_CPP_LINK_CONTEXT)
+PN_HANDLE(PNI_CPP_CONTAINER_CONTEXT)
+
+namespace proton {
+namespace reactor {
+
+void setConnectionContext(pn_connection_t *pnConnection, ConnectionImpl *connection) {
+    pn_record_t *record = pn_connection_attachments(pnConnection);
+    pn_record_def(record, PNI_CPP_CONNECTION_CONTEXT, PN_VOID);
+    pn_record_set(record, PNI_CPP_CONNECTION_CONTEXT, connection);
+}
+
+ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection) {
+    if (!pnConnection) return NULL;
+    pn_record_t *record = pn_connection_attachments(pnConnection);
+    ConnectionImpl *p = (ConnectionImpl *) pn_record_get(record, PNI_CPP_CONNECTION_CONTEXT);
+    return p;
+}
+
+
+void setSessionContext(pn_session_t *pnSession, Session *session) {
+    pn_record_t *record = pn_session_attachments(pnSession);
+    pn_record_def(record, PNI_CPP_SESSION_CONTEXT, PN_VOID);
+    pn_record_set(record, PNI_CPP_SESSION_CONTEXT, session);
+}
+
+Session *getSessionContext(pn_session_t *pnSession) {
+    if (!pnSession) return NULL;
+    pn_record_t *record = pn_session_attachments(pnSession);
+    Session *p = (Session *) pn_record_get(record, PNI_CPP_SESSION_CONTEXT);
+    return p;
+}
+
+
+void setLinkContext(pn_link_t *pnLink, Link *link) {
+    pn_record_t *record = pn_link_attachments(pnLink);
+    pn_record_def(record, PNI_CPP_LINK_CONTEXT, PN_VOID);
+    pn_record_set(record, PNI_CPP_LINK_CONTEXT, link);
+}
+
+Link *getLinkContext(pn_link_t *pnLink) {
+    if (!pnLink) return NULL;
+    pn_record_t *record = pn_link_attachments(pnLink);
+    Link *p = (Link *) pn_record_get(record, PNI_CPP_LINK_CONTEXT);
+    return p;
+}
+
+
+void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container) {
+    pn_record_t *record = pn_reactor_attachments(pnReactor);
+    pn_record_def(record, PNI_CPP_CONTAINER_CONTEXT, PN_VOID);
+    pn_record_set(record, PNI_CPP_CONTAINER_CONTEXT, container);
+}
+
+ContainerImpl *getContainerContext(pn_reactor_t *pnReactor) {
+    pn_record_t *record = pn_reactor_attachments(pnReactor);
+    ContainerImpl *p = (ContainerImpl *) pn_record_get(record, PNI_CPP_CONTAINER_CONTEXT);
+    if (!p) throw ProtonException(MSG("Reactor has no C++ container context"));
+    return p;
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/contexts.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.h b/proton-c/bindings/cpp/src/contexts.h
new file mode 100644
index 0000000..c04a77a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/contexts.h
@@ -0,0 +1,48 @@
+#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/reactor.h"
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+class ConnectionImpl;
+void setConnectionContext(pn_connection_t *pnConnection, ConnectionImpl *connection);
+ConnectionImpl *getConnectionContext(pn_connection_t *pnConnection);
+
+class Session;
+void setSessionContext(pn_session_t *pnSession, Session *session);
+Session *getSessionContext(pn_session_t *pnSession);
+
+class Link;
+void setLinkContext(pn_link_t *pnLink, Link *link);
+Link *getLinkContext(pn_link_t *pnLink);
+
+class ContainerImpl;
+void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container);
+ContainerImpl *getContainerContext(pn_reactor_t *pnReactor);
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/exceptions.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/exceptions.cpp b/proton-c/bindings/cpp/src/exceptions.cpp
new file mode 100644
index 0000000..c19e61d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/exceptions.cpp
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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/cpp/exceptions.h"
+
+namespace proton {
+namespace reactor {
+
+ProtonException::ProtonException(const std::string& msg) throw() : message(msg) {}
+ProtonException::~ProtonException() throw() {}
+const char* ProtonException::what() const throw() { return message.c_str(); }
+
+MessageReject::MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
+MessageRelease::MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/platform.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/platform.cpp b/proton-c/bindings/cpp/src/platform.cpp
new file mode 100644
index 0000000..4eac408
--- /dev/null
+++ b/proton-c/bindings/cpp/src/platform.cpp
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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 "platform.h"
+#include <string>
+
+// Copy neccesary platform neutral functionality from Proton-C
+// TODO: make this sensibly maintainable (even though it is mostly static)
+
+#ifdef USE_UUID_GENERATE
+#include <uuid/uuid.h>
+#include <stdlib.h>
+char* pn_i_genuuid(void) {
+    char *generated = (char *) malloc(37*sizeof(char));
+    uuid_t uuid;
+    uuid_generate(uuid);
+    uuid_unparse(uuid, generated);
+    return generated;
+}
+#elif USE_UUID_CREATE
+#include <uuid.h>
+char* pn_i_genuuid(void) {
+    char *generated;
+    uuid_t uuid;
+    uint32_t rc;
+    uuid_create(&uuid, &rc);
+    // Under FreeBSD the returned string is newly allocated from the heap
+    uuid_to_string(&uuid, &generated, &rc);
+    return generated;
+}
+#elif USE_WIN_UUID
+#include <rpc.h>
+char* pn_i_genuuid(void) {
+    unsigned char *generated;
+    UUID uuid;
+    UuidCreate(&uuid);
+    UuidToString(&uuid, &generated);
+    char* r = pn_strdup((const char*)generated);
+    RpcStringFree(&generated);
+    return r;
+}
+#else
+#error "Don't know how to generate uuid strings on this platform"
+#endif
+
+
+
+namespace proton {
+namespace reactor {
+
+// include Proton-c platform routines into a local namespace
+
+
+std::string generateUuid() {
+    char *s = pn_i_genuuid();
+    std::string url(s);
+    free(s);
+    return url;
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c067060/proton-c/bindings/cpp/src/platform.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/platform.h b/proton-c/bindings/cpp/src/platform.h
new file mode 100644
index 0000000..5e5b726
--- /dev/null
+++ b/proton-c/bindings/cpp/src/platform.h
@@ -0,0 +1,39 @@
+#ifndef PROTON_CPP_PLATFORM_H
+#define PROTON_CPP_PLATFORM_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/cpp/ProtonHandler.h"
+#include "proton/event.h"
+#include "proton/reactor.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+std::string generateUuid();
+// Todo: TimeNow();
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PLATFORM_H*/


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


[22/50] [abbrv] qpid-proton git commit: PROTON-781: Update CMake to install new Ruby packages.

Posted by ac...@apache.org.
PROTON-781: Update CMake to install new Ruby packages.


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

Branch: refs/heads/cjansen-cpp-client
Commit: bcfa8d44b8d71edd8c87568ebfd1141be175d054
Parents: 8118ea7
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Jun 18 10:02:42 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bcfa8d44/proton-c/bindings/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt
index c6b07d3..55c232a 100644
--- a/proton-c/bindings/ruby/CMakeLists.txt
+++ b/proton-c/bindings/ruby/CMakeLists.txt
@@ -77,13 +77,18 @@ install(DIRECTORY lib/core
 install(DIRECTORY lib/event
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
+install(DIRECTORY lib/handler
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
 install(DIRECTORY lib/messenger
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
+install(DIRECTORY lib/reactor
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
 install(DIRECTORY lib/types
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
 install(DIRECTORY lib/util
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
-


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


[03/50] [abbrv] qpid-proton git commit: PROTON-781: Added EndpointStateHandler to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added EndpointStateHandler to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 8316e61fa0cdd284b9a66a64660e91908dc3dbc1
Parents: 1798ffa
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Feb 25 13:28:38 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 .../ruby/lib/handler/endpoint_state_handler.rb  | 217 +++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |   1 +
 2 files changed, 218 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8316e61f/proton-c/bindings/ruby/lib/handler/endpoint_state_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/endpoint_state_handler.rb b/proton-c/bindings/ruby/lib/handler/endpoint_state_handler.rb
new file mode 100644
index 0000000..727a20b
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/endpoint_state_handler.rb
@@ -0,0 +1,217 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Handler
+
+  # A utility that exposes endpoint events; i.e., the open/close of a link,
+  # session or connection, in a more intuitive manner.
+  #
+  # A XXX_opened method will be called when both local and remote peers have
+  # opened the link, session or connection. This can be used to confirm a
+  # locally initiated action for example.
+  #
+  # A XXX_opening method will be called when the remote peer has requested
+  # an open that was not initiated locally. By default this will simply open
+  # locally, which then trigtgers the XXX_opened called.
+  #
+  # The same applies to close.
+  #
+  class EndpointStateHandler < Qpid::Proton::BaseHandler
+
+    def initialize(peer_close_is_error = false, delegate = nil)
+      @delegate = delegate
+      @peer_close_is_error = peer_close_is_error
+    end
+
+    def self.print_error(endpoint, endpoint_type)
+      if !endpoint.remote_condition.nil?
+      elsif self.local_endpoint?(endpoint) && endpoint.remote_closed?
+        logging.error("#{endpoint_type} closed by peer")
+      end
+    end
+
+    def on_link_remote_close(event)
+      if !event.link.remote_condition.nil?
+        self.on_link_error(event)
+      elsif event.link.local_closed?
+        self.on_link_closed(event)
+      else
+        self.on_link_closing(event)
+      end
+      event.link.close
+    end
+
+    def on_session_remote_close(event)
+      if !event.session.remote_condition.nil?
+        self.on_session_error(event)
+      elsif event.session.local_closed?
+        self.on_session_closed(event)
+      else
+        self.on_session_closing(event)
+      end
+      event.session.close
+    end
+
+    def on_connection_remote_close(event)
+      if !event.connection.remote_condition.nil?
+        self.on_connection_error(event)
+      elsif event.connection.local_closed?
+        self.on_connection_closed(event)
+      else
+        self.on_connection_closing(event)
+      end
+      event.connection.close
+    end
+
+    def on_connection_local_open(event)
+      self.on_connection_opened(event) if event.connection.remote_active?
+    end
+
+    def on_connection_remote_open(event)
+      if !(event.connection.state & Qpid::Proton::Endpoint::LOCAL_ACTIVE).zero?
+        self.on_connection_opened(event)
+      elsif event.connection.local_uninit?
+        self.on_connection_opening(event)
+        event.connection.open
+      end
+    end
+
+    def on_session_local_open(event)
+      self.on_session_opened(event) if event.session.remote_active?
+    end
+
+    def on_session_remote_open(event)
+      if !(event.session.state & Qpid::Proton::Endpoint::LOCAL_ACTIVE).zero?
+        self.on_session_opened(event)
+      elsif event.session.local_uninit?
+        self.on_session_opening(event)
+        event.session.open
+      end
+    end
+
+    def on_link_local_open(event)
+      self.on_link_opened(event) if event.link.remote_active?
+    end
+
+    def on_link_remote_open(event)
+      if !(event.link.state & Qpid::Proton::Endpoint::LOCAL_ACTIVE).zero?
+        self.on_link_opened(event)
+      elsif event.link.local_uninit?
+        self.on_link_opening(event)
+        event.link.open
+      end
+    end
+
+    def on_connection_opened(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_session_opened, event) if !@delegate.nil?
+    end
+
+    def on_session_opened(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_session_opened, event) if !@delegate.nil?
+    end
+
+    def on_link_opened(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_link_opened, event) if !@delegate.nil?
+    end
+
+    def on_connection_opening(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_connection_opening, event) if !@delegate.nil?
+    end
+
+    def on_session_opening(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_session_opening, event) if !@delegate.nil?
+    end
+
+    def on_link_opening(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_link_opening, event) if !@delegate.nil?
+    end
+
+    def on_connection_error(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_connection_error, event)
+      else
+        self.log_error(event.connection, "connection")
+      end
+    end
+
+    def on_session_error(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_session_error, event)
+      else
+        self.log_error(event.session, "session")
+        event.connection.close
+      end
+    end
+
+    def on_link_error(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_link_error, event)
+      else
+        self.log_error(event.link, "link")
+        event.conneciton.close
+      end
+    end
+
+    def on_connection_closed(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_connection_closed, event) if !@delegate.nil?
+    end
+
+    def on_session_closed(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_session_closed, event) if !@delegate.nil?
+    end
+
+    def on_link_closed(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_link_closed, event) if !@delegate.nil?
+    end
+
+    def on_connection_closing(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_connection_closing, event)
+      elsif @peer_close_is_error
+        self.on_connection_error(event)
+      end
+    end
+
+    def on_session_closing(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_session_closing, event)
+      elsif @peer_close_is_error
+        self.on_session_error(event)
+      end
+    end
+
+    def on_link_closing(event)
+      if !@delegate.nil?
+        Qpid::Proton::Event.dispatch(@delegate, :on_link_closing, event)
+      elsif @peer_close_is_error
+        self.on_link_error(event)
+      end
+    end
+
+    def on_transport_tail_closed(event)
+      self.on_transport_closed(event)
+    end
+
+    def on_transport_closed(event)
+      Qpid::Proton::Event.dispatch(@delegate, :on_disconnected, event) if !@delegate.nil?
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8316e61f/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 8db28f3..08e60b9 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -85,6 +85,7 @@ require "messenger/messenger"
 require "handler/c_adaptor"
 require "handler/wrapped_handler"
 require "handler/acking"
+require "handler/endpoint_state_handler"
 
 module Qpid::Proton
   # @private


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


[13/50] [abbrv] qpid-proton git commit: PROTON-781: Added Reactor and Task to the ClassWrapper

Posted by ac...@apache.org.
PROTON-781: Added Reactor and Task to the ClassWrapper


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

Branch: refs/heads/cjansen-cpp-client
Commit: 67743474dd1f441facf8ec2e282b7611f899a01a
Parents: 36380c9
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 10:54:54 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/util/class_wrapper.rb | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/67743474/proton-c/bindings/ruby/lib/util/class_wrapper.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/class_wrapper.rb b/proton-c/bindings/ruby/lib/util/class_wrapper.rb
index 134f655..dec16e9 100644
--- a/proton-c/bindings/ruby/lib/util/class_wrapper.rb
+++ b/proton-c/bindings/ruby/lib/util/class_wrapper.rb
@@ -36,6 +36,8 @@ module Qpid::Proton::Util
         "pn_delivery" => proc {|x| Qpid::Proton::Delivery.wrap(Cproton.pn_cast_pn_delivery(x))},
         "pn_transport" => proc {|x| Qpid::Proton::Transport.wrap(Cproton.pn_cast_pn_transport(x))},
         "pn_selectable" => proc {|x| Qpid::Proton::Selectable.wrap(Cproton.pn_cast_pn_selectable(x))},
+        "pn_reactor" => proc {|x| Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_cast_pn_reactor(x))},
+        "pn_task" => proc {|x| Qpid::Proton::Reactor::Task.wrap(Cproton.pn_cast_pn_task(x))},
       }
 
     def class_wrapper(clazz, c_impl, &block)


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


[06/50] [abbrv] qpid-proton git commit: PROTON-781: Added the BaseHandler class to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added the BaseHandler class to the Ruby reactive APIs.

This is the Ruby analog to the Handler class from Python. It needed to
be renamed, though, since it's in the Qpid::Proton namespace but would
collide with the Qpid::Proton::Handler namespace.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 2bab02c8fda367e9a3e3a5cb8c07dc0443732094
Parents: deec926
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Feb 25 13:30:30 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/base_handler.rb | 31 ++++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2bab02c8/proton-c/bindings/ruby/lib/core/base_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/base_handler.rb b/proton-c/bindings/ruby/lib/core/base_handler.rb
new file mode 100644
index 0000000..9a7ece4
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/core/base_handler.rb
@@ -0,0 +1,31 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton
+
+  class BaseHandler
+
+    # Override to process unhandled events.
+    #
+    def on_unhandled(method, *args)
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2bab02c8/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index e14ff9d..ef7f300 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -74,6 +74,7 @@ require "core/ssl_domain"
 require "core/ssl_details"
 require "core/ssl"
 require "core/transport"
+require "core/base_handler"
 
 # Messenger API classes
 require "messenger/subscription"


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


[47/50] [abbrv] qpid-proton git commit: PROTON-865: cpp encode/decode support for complex types.

Posted by ac...@apache.org.
PROTON-865: cpp encode/decode support for complex types.

Support for streaming complex AMQP types element by element and for
inserting/extracting C++ containers as AMQP containers.

See examples/cpp/encode_decode.cpp for examples of use.

Described types are not yet fully supported.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 693752d37c918aed97f4b5bde25716f00ff27a8d
Parents: c99be7a
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Jun 12 13:47:48 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt                     |  12 +-
 examples/cpp/encode_decode.cpp                  | 257 ++++++++++++++++
 examples/cpp/example_test.py                    |  41 ++-
 examples/cpp/simple_recv.cpp                    |   2 +-
 proton-c/CMakeLists.txt                         |   5 +-
 proton-c/bindings/cpp/CMakeLists.txt            |   8 +-
 proton-c/bindings/cpp/include/proton/cpp/Data.h |   4 +
 .../bindings/cpp/include/proton/cpp/Decoder.h   | 172 +++++++----
 .../bindings/cpp/include/proton/cpp/Duration.h  |   2 +-
 .../bindings/cpp/include/proton/cpp/Encoder.h   |  84 ++++-
 .../bindings/cpp/include/proton/cpp/Exception.h |  49 ---
 .../cpp/include/proton/cpp/MessagingHandler.h   |   2 +-
 .../bindings/cpp/include/proton/cpp/Value.h     |  63 ++--
 .../bindings/cpp/include/proton/cpp/Values.h    |  56 ++++
 .../bindings/cpp/include/proton/cpp/types.h     | 246 ++++++++++-----
 proton-c/bindings/cpp/src/ConnectionImpl.h      |   2 +-
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |   8 -
 proton-c/bindings/cpp/src/Data.cpp              |   4 +-
 proton-c/bindings/cpp/src/Decoder.cpp           |  83 ++++-
 proton-c/bindings/cpp/src/Encoder.cpp           |  74 ++++-
 proton-c/bindings/cpp/src/Handler.cpp           |   6 +-
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |  10 +-
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |   2 +-
 proton-c/bindings/cpp/src/Msg.h                 |  22 +-
 proton-c/bindings/cpp/src/ProtonEvent.cpp       |   3 +-
 proton-c/bindings/cpp/src/ProtonHandler.cpp     |   2 +-
 proton-c/bindings/cpp/src/Transport.cpp         |   2 +-
 proton-c/bindings/cpp/src/Value.cpp             | 111 +++++--
 proton-c/bindings/cpp/src/Values.cpp            |  39 +++
 proton-c/bindings/cpp/src/interop_test.cpp      |   8 +-
 proton-c/bindings/cpp/src/proton_bits.cpp       |   8 +
 proton-c/bindings/cpp/src/proton_bits.h         |   5 +
 proton-c/bindings/cpp/src/types.cpp             |  47 ++-
 proton-c/bindings/go/README.md                  |   5 -
 .../proton/go/amqp/interop_test.go              | 308 -------------------
 proton-c/docs/api/index.md                      |   6 +-
 proton-c/docs/api/user.doxygen.in               |   2 +-
 proton-c/include/proton/codec.h                 |   9 +-
 proton-c/src/codec/codec.c                      |  10 +-
 proton-c/src/codec/encoder.c                    |  10 +-
 40 files changed, 1106 insertions(+), 683 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index b1e4a1f..bafcd38 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,11 +17,19 @@
 # under the License.
 #
 
-include_directories ("${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
+include_directories("${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
 
-foreach(example broker helloworld helloworld_blocking helloworld_direct simple_recv simple_send)
+foreach(example
+    broker
+    helloworld
+    helloworld_blocking
+    helloworld_direct
+    simple_recv
+    simple_send
+    encode_decode)
   add_executable(${example} ${example}.cpp)
   target_link_libraries(${example} qpid-proton-cpp)
+  set_source_files_properties(${example}.cpp PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}")
 endforeach()
 
 add_test(

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/examples/cpp/encode_decode.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp
new file mode 100644
index 0000000..5096c40
--- /dev/null
+++ b/examples/cpp/encode_decode.cpp
@@ -0,0 +1,257 @@
+/*
+ * 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/cpp/Values.h>
+#include <proton/cpp/Value.h>
+#include <algorithm>
+#include <iostream>
+#include <iterator>
+#include <map>
+#include <sstream>
+#include <stdexcept>
+#include <vector>
+
+using namespace std;
+using namespace proton::reactor;
+
+// Examples of how to use the Encoder and Decoder to create and examine AMQP values.
+//
+
+// Print is defined at the end as an example of how to query and extract complex
+// values in terms of their simple components.
+void print(Values& values);
+
+// Inserting and extracting simple C++ values.
+void simple_insert_extract() {
+    Values values;
+    cout << endl << "== Simple values: int, string, bool" << endl;
+    values << 42 << "foo" << true;
+    print(values);
+    int i;
+    std::string s;
+    bool b;
+    values.rewind();
+    values >> i >> s >> b;
+    cout << "Extracted: " << i << ", " << s << ", " << b << endl;
+    cout << "Encoded as AMQP in " << values.encode().size() << " bytes" << endl;
+}
+
+// Inserting values as a specific AMQP type
+void simple_insert_extract_exact_type() {
+    Values values;
+    cout << endl << "== Specific AMQP types: byte, long, symbol" << endl;
+    values << Byte('x') << Long(123456789123456789) << Symbol("bar");
+    print(values);
+    values.rewind();
+    // Check that we encoded the correct types, but note that decoding will
+    // still convert to standard C++ types, in particular any AMQP integer type
+    // can be converted to a long-enough C++ integer type..
+    int64_t i1, i2;
+    std::string s;
+    values >> i1 >> i2 >> s;
+    cout << "Extracted (with conversion) " << i1 << ", " << i2 << ", " << s << endl;
+
+    // Now use the as() function to fail unless we extract the exact AMQP type expected.
+    values.rewind();            // Byte(1) << Long(2) << Symbol("bar");
+    Long l;
+    // Fails, extracting Byte as Long
+    try { values >> as<LONG>(l); throw logic_error("expected error"); } catch (Decoder::Error) {}
+    Byte b;
+    values >> as<BYTE>(b) >> as<LONG>(l); // OK, extract Byte as Byte, Long as Long.
+    std::string str;
+    // Fails, extracting Symbol as String.
+    try { values >> as<STRING>(str); throw logic_error("expected error"); } catch (Decoder::Error) {}
+    values >> as<SYMBOL>(str);       // OK, extract Symbol as Symbol
+    cout << "Extracted (exact) " << b << ", " << l << ", " << str << endl;
+}
+
+// Some helper templates to print map and vector results.
+namespace std {
+template<class T, class U> ostream& operator<<(ostream& o, const pair<T,U>& p) {
+    return o << p.first << ":" << p.second;
+}
+template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
+    o << "[ ";
+    ostream_iterator<T> oi(o, " ");
+    copy(v.begin(), v.end(), oi);
+    return o << "]";
+}
+template<class K, class T> ostream& operator<<(ostream& o, const map<K, T>& m) {
+    o << "{ ";
+    ostream_iterator<pair<K,T> > oi(o, " ");
+    copy(m.begin(), m.end(), oi);
+    return o << "}";
+}
+}
+
+// Insert/extract C++ containers.
+void insert_extract_containers() {
+    cout << endl << "== Array, list and map." << endl;
+
+    vector<int> a;
+    a.push_back(1);
+    a.push_back(2);
+    a.push_back(3);
+    vector<int> l;
+    l.push_back(4);
+    l.push_back(5);
+    map<string, int> m;
+    m["one"] = 1;
+    m["two"] = 2;
+
+    Values values;
+    values << as<ARRAY>(a) << as<LIST>(l) << as<MAP>(m);
+    print(values);
+
+    vector<int> a1, l1;
+    map<string, int> m1;
+    values.rewind();
+    values >> as<ARRAY>(a1) >> as<LIST>(l1) >> as<MAP>(m1);
+    cout << "Extracted: " << a1 << ", " << l1 << ", " << m1 << endl;
+}
+
+// Containers with mixed types, use Value to represent arbitrary AMQP types.
+void mixed_containers() {
+    cout << endl << "== List and map of mixed type values." << endl;
+    vector<Value> l;
+    l.push_back(Value(42));
+    l.push_back(Value(String("foo")));
+    map<Value, Value> m;
+    m[Value("five")] = Value(5);
+    m[Value(4)] = Value("four");
+    Values values;
+    values << as<LIST>(l) << as<MAP>(m);
+    print(values);
+
+    vector<Value> l1;
+    map<Value, Value> m1;
+    values.rewind();
+    values >> as<LIST>(l1) >> as<MAP>(m1);
+    cout << "Extracted: " << l1 << ", " << m1 << endl;
+}
+
+// Insert using stream operators (see printNext for example of extracting with stream ops.)
+void insert_extract_stream_operators() {
+    cout << endl << "== Insert with stream operators." << endl;
+    Values values;
+    // Note: array elements must be encoded with the exact type, they are not
+    // automaticlly converted. Mismatched types for array elements will not
+    // be detected until values.encode() is called.
+    values << Start::array(INT) << Int(1) << Int(2) << Int(3) << finish();
+    print(values);
+
+    values.clear();
+    values << Start::list() << Int(42) << false << Symbol("x") << finish();
+    print(values);
+
+    values.clear();
+    values << Start::map() << "k1" << Int(42) << Symbol("k2") << false << finish();
+    print(values);
+}
+
+int main(int, char**) {
+    try {
+        simple_insert_extract();
+        simple_insert_extract_exact_type();
+        insert_extract_containers();
+        mixed_containers();
+        insert_extract_stream_operators();
+    } catch (const exception& e) {
+        cerr << endl << "error: " << e.what() << endl;
+        return 1;
+    }
+}
+
+// printNext prints the next value from Values by recursively descending into complex values.
+//
+// NOTE this is for example puroses only: There is a built in ostream operator<< for Values.
+//
+//
+void printNext(Values& values) {
+    TypeId type = values.type();
+    Start start;
+    switch (type) {
+      case ARRAY: {
+          values >> start;
+          cout << "array<" << start.element;
+          if (start.isDescribed) {
+              cout  << ", descriptor=";
+              printNext(values);
+          }
+          cout << ">[";
+          for (size_t i = 0; i < start.size; ++i) {
+              if (i) cout << ", ";
+              printNext(values);
+          }
+          cout << "]";
+          values >> finish();
+          break;
+      }
+      case LIST: {
+          values >> start;
+          cout << "list[";
+          for (size_t i = 0; i < start.size; ++i) {
+              if (i) cout << ", ";
+              printNext(values);
+          }
+          cout << "]";
+          values >> finish();
+          break;
+      }
+      case MAP: {
+          values >> start;
+          cout << "map{";
+          for (size_t i = 0; i < start.size/2; ++i) {
+              if (i) cout << ", ";
+              printNext(values);
+              cout << ":";        // key:value
+              printNext(values);
+          }
+          cout << "}";
+          values >> finish();
+          break;
+      }
+      case DESCRIBED: {
+          values >> start;
+          cout << "described(";
+          printNext(values);      // Descriptor
+          printNext(values);      // Value
+          values >> finish();
+          break;
+      }
+      default:
+        // A simple type. We could continue the switch for all AMQP types but
+        // instead we us the `Value` type which can hold and print any AMQP
+        // value.
+        Value v;
+        values >> v;
+        cout << type << "(" << v << ")";
+    }
+}
+
+// Print all the values with printNext
+void print(Values& values) {
+    values.rewind();
+    cout << "Values: ";
+    while (values.more()) {
+        printNext(values);
+        if (values.more()) cout << ", ";
+    }
+    cout << endl;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 9a8ac67..3da1ddb 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -20,7 +20,7 @@
 import unittest
 import os, sys, socket, time
 from  random import randrange
-from subprocess import Popen, check_output, PIPE
+from subprocess import Popen, check_output, PIPE, STDOUT
 
 NULL = open(os.devnull, 'w')
 
@@ -58,7 +58,7 @@ class Broker(object):
 
 
 class ExampleTest(unittest.TestCase):
-    """Test examples"""
+    """Run the examples, verify they behave as expected."""
 
     @classmethod
     def tearDownClass(self):
@@ -89,6 +89,8 @@ class ExampleTest(unittest.TestCase):
         recv_expect += "".join(['[%d]: b"some arbitrary binary data"\n' % (i+1) for i in range(n)])
         self.assertEqual(recv_expect, recv)
 
+        # FIXME aconway 2015-06-16: bug when receiver is started before sender, messages
+        # are not delivered to receiver.
     def FIXME_test_simple_recv_send(self):
         """Start receiver first, then run sender"""
         b = Broker.get()
@@ -101,5 +103,40 @@ class ExampleTest(unittest.TestCase):
         out, err = recv.communicate()
         self.assertEqual(recv_expect, out)
 
+    def call(self, *cmd):
+        p = Popen(cmd, stdout=PIPE, stderr=STDOUT)
+        out, err = p.communicate()
+        self.assertEqual(0, p.returncode,
+                         "%s exit code %s, output:\n%s\n---- end of %s exit code %s" % (
+                             cmd, p.returncode, out, cmd, p.returncode))
+        return out
+
+    def test_encode_decode(self):
+        expect="""
+== Simple values: int, string, bool
+Values: int(42), string("foo"), bool(true)
+Extracted: 42, foo, 1
+Encoded as AMQP in 8 bytes
+
+== Specific AMQP types: byte, long, symbol
+Values: byte(120), long(123456789123456789), symbol(:bar)
+Extracted (with conversion) 120, 123456789123456789, bar
+Extracted (exact) x, 123456789123456789, bar
+
+== Array, list and map.
+Values: array<int>[int(1), int(2), int(3)], list[int(4), int(5)], map{string("one"):int(1), string("two"):int(2)}
+Extracted: [ 1 2 3 ], [ 4 5 ], { one:1 two:2 }
+
+== List and map of mixed type values.
+Values: list[int(42), string("foo")], map{int(4):string("four"), string("five"):int(5)}
+Extracted: [ 42 "foo" ], { 4:"four" "five":5 }
+
+== Insert with stream operators.
+Values: array<int>[int(1), int(2), int(3)]
+Values: list[int(42), bool(false), symbol(:x)]
+Values: map{string("k1"):int(42), symbol(:"k2"):bool(false)}
+"""
+        self.maxDiff = None
+        self.assertMultiLineEqual(expect, self.call("./encode_decode"))
 if __name__ == "__main__":
     unittest.main()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 42c561b..6612b16 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -46,7 +46,7 @@ class Recv : public MessagingHandler {
     }
 
     void onMessage(Event &e) {
-        uint64_t id = 0;
+        int64_t id = 0;
         Message msg = e.getMessage();
         if (msg.getIdType() == PN_ULONG) {
             id = msg.getId();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 049755e..9276a74 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -213,6 +213,8 @@ if (CMAKE_COMPILER_IS_GNUCC)
     set (WERROR "-Werror")
   endif (ENABLE_WARNING_ERROR)
   set (COMPILE_WARNING_FLAGS "${WERROR} -Wall -pedantic-errors")
+  # C++ allow "%z" format specifier and variadic macros
+  set (CXX_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format -Wno-variadic-macros" CACHE STRING "C++ warning flags")
   if (NOT BUILD_WITH_CXX)
     set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wstrict-prototypes")
     set (COMPILE_LANGUAGE_FLAGS "-std=c99")
@@ -227,8 +229,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
       set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wc++-compat -Wvla -Wsign-compare -Wwrite-strings")
     endif (${GCC_VERSION} VERSION_LESS "4.3.0")
   else (NOT BUILD_WITH_CXX)
-    # allow "%z" format specifier and variadic macros
-    set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format -Wno-variadic-macros")
+    set (COMPILE_WARNING_FLAGS "${CXX_WARNING_FLAGS}")
   endif (NOT BUILD_WITH_CXX)
 
   if (ENABLE_UNDEFINED_ERROR)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index cc1c74a..18533ec 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -22,8 +22,7 @@
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
 
-add_library (
-  qpid-proton-cpp SHARED
+set(qpid-proton-cpp-source
   src/Acceptor.cpp
   src/Acking.cpp
   src/Connection.cpp
@@ -54,6 +53,7 @@ add_library (
   src/Transport.cpp
   src/Url.cpp
   src/Value.cpp
+  src/Values.cpp
   src/proton_bits.cpp
   src/blocking/BlockingConnection.cpp
   src/blocking/BlockingConnectionImpl.cpp
@@ -63,6 +63,10 @@ add_library (
   src/types.cpp
   )
 
+set_source_files_properties(${qpid-proton-cpp-source} PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}")
+
+add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
+
 target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
 
 set_target_properties (

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Data.h b/proton-c/bindings/cpp/include/proton/cpp/Data.h
index 2204e8f..ef78a13 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Data.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Data.h
@@ -22,6 +22,10 @@
 #include "proton/cpp/ImportExport.h"
 #include <iosfwd>
 
+/**@file
+ * Base for classes that hold AMQP data.
+ * @internal
+ */
 struct pn_data_t;
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
index 542315e..9b6df6e 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
@@ -29,43 +29,40 @@ namespace reactor {
 
 class Value;
 
+/**@file
+ * Stream-like decoder from AMQP bytes to C++ values.
+ * @ingroup cpp
+ */
+
 /**
+@ingroup cpp
+
 Stream-like decoder from AMQP bytes to a stream of C++ values.
 
-@see types.h defines C++ typedefs and types for AMQP each type. These types can
-all be extracted from the corresponding AMQP type. In additon operator>> will do
-the following conversions from AMQP to C++ types:
-
-+-----------------------------------------+--------------------------------------------------+
-|Target C++ type                          |Allowed AMQP types                                |
-+=========================================+==================================================+
-|bool                                     |Bool                                              |
-|-----------------------------------------+--------------------------------------------------|
-|signed integer type                      |Byte,Short,Int,Long [1]                           |
-+-----------------------------------------+--------------------------------------------------+
-|unsigned integer type                    |UByte,UShort,UInt,ULong [1]                       |
-+-----------------------------------------+--------------------------------------------------+
-|float or double                          |Float or Double                                   |
-+-----------------------------------------+--------------------------------------------------+
-|Value                                    |Any type                                          |
-+-----------------------------------------+--------------------------------------------------+
-|std::string                              |String, Binary, Symbol                            |
-+-----------------------------------------+--------------------------------------------------+
-|wchar_t                                  |Char                                              |
-+-----------------------------------------+--------------------------------------------------+
-|std::map<K, T>                           |Map with keys that convert to K and data that     |
-|                                         |converts to T                                     |
-+-----------------------------------------+--------------------------------------------------+
-|Map                                      |Map may have mixed keys and data types            |
-+-----------------------------------------+--------------------------------------------------+
-|std::vector<T>                           |List or Array if data converts to T               |
-+-----------------------------------------+--------------------------------------------------+
-|List                                     |List, may have mixed types and datas              |
-+-----------------------------------------+--------------------------------------------------+
-
-You can disable conversions and force an exact type match using @see exact()
+types.h defines C++ types corresponding to AMQP types.
+
+Decoder operator>> will extract AMQP types into corresponding C++ types, and do
+simple conversions, e.g. from AMQP integer types to corresponding or larger C++
+integer types.
+
+You can require an exact AMQP type using the `as<type>(value)` helper. E.g.
+
+    Int i;
+    decoder >> as<INT>(i):       // Will throw if decoder does not contain an INT
+
+You can also use the `as` helper to extract an AMQP list, array or map into C++ containers.
+
+    std::vector<Int> v;
+    decoder >> as<LIST>(v);     // Extract a list of INT.
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also extract container values element-by-element, see the Start class.
 */
-class Decoder : public virtual Data {
+PN_CPP_EXTERN class Decoder : public virtual Data {
   public:
     /** Raised if a Decoder operation fails  */
     struct Error : public ProtonException {
@@ -95,10 +92,12 @@ class Decoder : public virtual Data {
      */
     PN_CPP_EXTERN TypeId type() const;
 
-    /** @defgroup decoder_simple_types Extract simple types, @see Decoder for details.
-     *@throw Error if the Decoder is empty or the current value has an incompatible type.
-     *@{
+    /** @name Extract simple types
+     * Overloads to extract simple types.
+     * @throw Error if the Decoder is empty or the current value has an incompatible type.
+     * @{
      */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Null);
     PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
     PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
     PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
@@ -120,14 +119,59 @@ class Decoder : public virtual Data {
     PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
     ///@}
 
-    ///@internal
-    template <class T> struct ExactRef { T& value; ExactRef(T& ref) : value(ref) {} };
+    /** Extract and return a value of type T. */
+    template <class T> T get() { T value; *this >> value; return value; }
+
+    /** Extract and return a value of type T, as AMQP type. */
+    template <class T, TypeId A> T getAs() { T value; *this >> as<A>(value); return value; }
 
-    /** @see exact() */
-  template <class T> friend Decoder& operator>>(Decoder&, ExactRef<T>);
+    /** Call Decoder::start() in constructor, Decoder::finish in destructor() */
+    struct Scope : public Start {
+        Decoder& decoder;
+        Scope(Decoder& d) : decoder(d) { d >> *this; }
+        ~Scope() { decoder >> finish(); }
+    };
+
+    template <TypeId A, class T> friend Decoder& operator>>(Decoder& d, Ref<T, A> ref) {
+        d.checkType(A);
+        d >> ref.value;
+        return d;
+    }
+
+    /** start extracting a container value, one of array, list, map, described.
+     * The basic pattern is:
+     *
+     *     Start s;
+     *     decoder >> s;
+     *     // check s.type() to see if this is an ARRAY, LIST, MAP or DESCRIBED type.
+     *     if (s.described) extract the descriptor...
+     *     for (size_t i = 0; i < s.size(); ++i) Extract each element...
+     *     decoder >> finish();
+     *
+     * The first value of an ARRAY is a descriptor if Start::descriptor is true,
+     * followed by Start::size elemets of type Start::element.
+     *
+     * A LIST has Start::size elements which may be of mixed type.
+     *
+     * A MAP has Start::size elements which alternate key, value, key, value...
+     * and may be of mixed type.
+     *
+     * A DESCRIBED contains a descriptor and a single element, so it always has
+     * Start::described=true and Start::size=1.
+     *
+     * Note Scope automatically calls finish() in its destructor.
+     *
+     *@throw decoder::error if the curent value is not a container type.
+     */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Start&);
+
+    /** Finish extracting a container value. */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Finish);
+
+    /** Skip a value */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Skip);
 
   private:
-    PN_CPP_EXTERN Decoder(pn_data_t*);
     template <class T> Decoder& extract(T& value);
     void checkType(TypeId);
 
@@ -139,26 +183,36 @@ class Decoder : public virtual Data {
   friend class Encoder;
 };
 
-/**
- * exact() disables the conversions allowed by Decoder operator>> and requires exact type match.
- *
- * For example the following will throw Decode::Error unless decoder conntains
- * an AMQP bool and an AMQP ULong.
- *
- * @code
- * Bool b;
- * ULong ul;
- * decoder >> exact(b) >> exact(ul)
- * @code
- */
-template <class T> Decoder::ExactRef<T> exact(T& value) {
-    return Decoder::ExactRef<T>(value);
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref)  {
+    Decoder::Scope s(d);
+    if (s.isDescribed) d >> skip();
+    ref.value.clear();
+    ref.value.resize(s.size);
+    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) {
+        d >> *i;
+    }
+    return d;
+}
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, LIST> ref)  {
+    Decoder::Scope s(d);
+    ref.value.clear();
+    ref.value.resize(s.size);
+    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i)
+        d >> *i;
+    return d;
 }
 
-///@see exact()
-template <class T> Decoder& operator>>(Decoder& d, Decoder::ExactRef<T> ref) {
-    d.checkType(TypeIdOf<T>::value);
-    d >> ref.value;
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref)  {
+    Decoder::Scope m(d);
+    ref.value.clear();
+    for (size_t i = 0; i < m.size/2; ++i) {
+        typename T::key_type k;
+        typename T::mapped_type v;
+        d >> k >> v;
+        ref.value[k] = v;
+    }
+    return d;
 }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Duration.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
index 08aaf3f..bb2a063 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Duration.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
@@ -28,7 +28,7 @@
 namespace proton {
 namespace reactor {
 
-/**   \ingroup C++
+/** @ingroup cpp
  * A duration is a time in milliseconds.
  */
 class Duration

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
index 460bea4..8e92881 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
@@ -31,13 +31,28 @@ namespace reactor {
 
 class Value;
 
+/**@file
+ * Stream-like encoder from C++ values to AMQP bytes.
+ * @ingroup cpp
+*/
+
 /**
-Stream-like encoder from C++ values to AMQP bytes.
+@ingroup cpp
 
-@see types.h defines C++ typedefs and types for AMQP each type. These types
+types.h defines C++ typedefs and types for AMQP each type. These types
 insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
 insert any other type.
 
+C++ containers can be inserted as AMQP containers with the as() helper functions. E.g.
+
+   std::vector<Symbol> v; encoder << as<List>(v);
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also insert containers element-by-element, see the Start class.
 */
 class Encoder : public virtual Data {
   public:
@@ -68,9 +83,10 @@ class Encoder : public virtual Data {
     /** Encode the current values into a std::string. Clears the encoder. */
     PN_CPP_EXTERN std::string encode();
 
-    /** @defgroup encoder_simple_types Insert simple types.
+    /** @name Insert simple types.
      *@{
      */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null);
     PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
     PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
     PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
@@ -94,8 +110,25 @@ class Encoder : public virtual Data {
     PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
     ///@}
 
+    /** Start a container type. See the Start class. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&);
+
+    /** Finish a container type. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish);
+
+
+    /**@name Insert values returned by the as<TypeId> helper.
+     *@{
+     */
+  template <class T, TypeId A> friend Encoder& operator<<(Encoder&, CRef<T, A>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>);
+    // TODO aconway 2015-06-16: DESCRIBED.
+    ///@}
+
   private:
-    PN_CPP_EXTERN Encoder(pn_data_t* pd); // Does not own.
+    PN_CPP_EXTERN Encoder(pn_data_t* pd);
 
     // Not implemented
     Encoder(const Encoder&);
@@ -104,5 +137,48 @@ class Encoder : public virtual Data {
   friend class Value;
 };
 
+/** Encode const char* as string */
+inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
+
+/** Encode char* as string */
+inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); }
+
+/** Encode std::string as string */
+inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); }
+
+//@internal Convert a Ref to a CRef.
+template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
+    return e << CRef<T,A>(ref);
+}
+
+// TODO aconway 2015-06-16: described array insertion.
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, ARRAY> a) {
+    e << Start::array(TypeIdOf<typename T::value_type>::value);
+    for (typename T::const_iterator i = a.value.begin(); i != a.value.end(); ++i)
+        e << *i;
+    e << finish();
+    return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, LIST> l) {
+    e << Start::list();
+    for (typename T::const_iterator i = l.value.begin(); i != l.value.end(); ++i)
+        e << *i;
+    e << finish();
+    return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
+    e << Start::map();
+    for (typename T::const_iterator i = m.value.begin(); i != m.value.end(); ++i) {
+        e << i->first;
+        e << i->second;
+    }
+    e << finish();
+    return e;
+}
+
+
 }}
 #endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Exception.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Exception.h b/proton-c/bindings/cpp/include/proton/cpp/Exception.h
deleted file mode 100644
index d24c8ef..0000000
--- a/proton-c/bindings/cpp/include/proton/cpp/Exception.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef PROTON_CPP_EXCEPTIONS_H
-#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
-
-namespace proton {
-namespace reactor {
-
-class Exception : public std::runtime_error
-{
-  public:
-    explicit Exception(const std::string& msg) throw() : std::runtime_error(msg) {}
-};
-
-class MessageReject : public Exception
-{
-  public:
-    explicit MessageReject(const std::string& msg) throw() : Exception(msg) {}
-};
-
-class MessageRelease : public Exception
-{
-  public:
-    explicit MessageRelease(const std::string& msg) throw() : Exception(msg) {}
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index e6c0341..07b0dde 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -78,8 +78,8 @@ class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
     virtual void onTransportClosed(Event &e);
   protected:
     int prefetch;
-    bool autoSettle;
     bool autoAccept;
+    bool autoSettle;
     bool peerCloseIsError;
     MessagingAdapter *messagingAdapter;
     Handler *flowController;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Value.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Value.h b/proton-c/bindings/cpp/include/proton/cpp/Value.h
index 65ca7ec..9555f29 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Value.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Value.h
@@ -19,66 +19,61 @@
  * under the License.
  */
 
-#include "proton/cpp/Encoder.h"
-#include "proton/cpp/Decoder.h"
-#include <iosfwd>
+#include "proton/cpp/Values.h"
 
+/**@file
+ * Holder for an AMQP value.
+ * @ingroup cpp
+ */
 namespace proton {
 namespace reactor {
 
-/** Holds a sequence of AMQP values, allows inserting and extracting.
- *
- * After inserting values, call rewind() to extract them.
- */
-class Values : public Encoder, public Decoder {
-  public:
-    Values();
-    Values(const Values&);
-    ~Values();
-
-    /** Copy data from another Values */
-    Values& operator=(const Values&);
-
-    PN_CPP_EXTERN void rewind();
-
-  private:
-  friend class Value;
-};
-
 /** Holds a single AMQP value. */
-class Value {
+PN_CPP_EXTERN class Value {
   public:
     PN_CPP_EXTERN Value();
     PN_CPP_EXTERN Value(const Value&);
+    /** Converting constructor from any settable value */
+    template <class T> explicit Value(const T& v);
     PN_CPP_EXTERN ~Value();
-
     PN_CPP_EXTERN Value& operator=(const Value&);
 
+
     TypeId type() const;
 
-    /** Set the value */
+    /** Set the value. */
     template<class T> void set(const T& value);
-    /** Get the value */
+    /** Get the value. */
     template<class T> void get(T& value) const;
     /** Get the value */
     template<class T> T get() const;
 
     /** Assignment sets the value */
     template<class T> Value& operator=(const T& value);
+
     /** Conversion operator gets  the value */
     template<class T> operator T() const;
 
-    /** Insert a value into an Encoder. */
+    /** insert a value into an Encoder. */
     PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
 
     /** Extract a value from a decoder. */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, const Value&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+
+    /** Human readable format */
+    PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&);
 
-  friend Decoder& operator>>(Decoder&, Value&);
-  friend Encoder& operator<<(Encoder&, const Value&);
+    bool operator==(const Value&) const;
+    bool operator !=(const Value& v) const{ return !(*this == v); }
 
-    private:
-    Values values;
+    /** operator < makes Value valid for use as a std::map key. */
+    bool operator<(const Value&) const;
+    bool operator>(const Value& v) const { return v < *this; }
+    bool operator<=(const Value& v) const { return !(*this > v); }
+    bool operator>=(const Value& v) const { return !(*this < v); }
+
+  private:
+    mutable Values values;
 };
 
 template<class T> void Value::set(const T& value) {
@@ -88,8 +83,7 @@ template<class T> void Value::set(const T& value) {
 
 template<class T> void Value::get(T& value) const {
     Values& v = const_cast<Values&>(values);
-    v.rewind();
-    v >> value;
+    v.rewind() >> value;
 }
 
 template<class T> T Value::get() const { T value; get(value); return value; }
@@ -98,6 +92,7 @@ template<class T> Value& Value::operator=(const T& value) { set(value); return *
 
 template<class T> Value::operator T() const { return get<T>(); }
 
+template<class T> Value::Value(const T& value) { set(value); }
 }}
 
 #endif // VALUE_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/Values.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Values.h b/proton-c/bindings/cpp/include/proton/cpp/Values.h
new file mode 100644
index 0000000..5f62dd9
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Values.h
@@ -0,0 +1,56 @@
+#ifndef VALUES_H
+#define VALUES_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/cpp/Encoder.h>
+#include <proton/cpp/Decoder.h>
+
+/**@file
+ * Holder for a sequence of AMQP values.
+ * @ingroup cpp
+ */
+
+namespace proton {
+namespace reactor {
+
+/** Holds a sequence of AMQP values, allows inserting and extracting.
+ *
+ * After inserting values, call rewind() to extract them.
+ */
+PN_CPP_EXTERN class Values : public Encoder, public Decoder {
+  public:
+    Values();
+    Values(const Values&);
+    ~Values();
+
+    /** Copy data from another Values */
+    Values& operator=(const Values&);
+
+    PN_CPP_EXTERN Values& rewind();
+
+  private:
+  friend class Value;
+};
+
+PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&);
+
+}}
+
+#endif // VALUES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/include/proton/cpp/types.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/types.h b/proton-c/bindings/cpp/include/proton/cpp/types.h
index 963a330..edd95b9 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/types.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/types.h
@@ -19,61 +19,68 @@
  * under the License.
  */
 
+#include <proton/codec.h>
+#include "proton/cpp/ImportExport.h"
+#include <algorithm>
+#include <bitset>
 #include <string>
 #include <stdint.h>
-#include <proton/codec.h>
-
-namespace proton {
-namespace reactor {
+#include <memory.h>
 
 /**@file
- *
- * C++ types representing simple AMQP types.
- *
+ * C++ types representing AMQP types.
+ * @ingroup cpp
  */
 
+namespace proton {
+namespace reactor {
 
-/** Convert pn_bytes_t to string */
-std::string str(const pn_bytes_t&);
-
-/** Convert string to pn_bytes_t */
-pn_bytes_t bytes(const std::string&);
-
-/** Identifies an AMQP type */
+/** TypeId identifies an AMQP type */
 enum TypeId {
-    NULL_=PN_NULL,
-    BOOL=PN_BOOL,
-    UBYTE=PN_UBYTE,
-    BYTE=PN_BYTE,
-    USHORT=PN_USHORT,
-    SHORT=PN_SHORT,
-    UINT=PN_UINT,
-    INT=PN_INT,
-    CHAR=PN_CHAR,
-    ULONG=PN_ULONG,
-    LONG=PN_LONG,
-    TIMESTAMP=PN_TIMESTAMP,
-    FLOAT=PN_FLOAT,
-    DOUBLE=PN_DOUBLE,
-    DECIMAL32=PN_DECIMAL32,
-    DECIMAL64=PN_DECIMAL64,
-    DECIMAL128=PN_DECIMAL128,
-    UUID=PN_UUID,
-    BINARY=PN_BINARY,
-    STRING=PN_STRING,
-    SYMBOL=PN_SYMBOL,
-    DESCRIBED=PN_DESCRIBED,
-    ARRAY=PN_ARRAY,
-    LIST=PN_LIST,
-    MAP=PN_MAP
+    NULL_=PN_NULL,              ///< The null type, contains no data.
+    BOOL=PN_BOOL,               ///< Boolean true or false.
+    UBYTE=PN_UBYTE,             ///< Unsigned 8 bit integer.
+    BYTE=PN_BYTE,               ///< Signed 8 bit integer.
+    USHORT=PN_USHORT,           ///< Unsigned 16 bit integer.
+    SHORT=PN_SHORT,             ///< Signed 16 bit integer.
+    UINT=PN_UINT,               ///< Unsigned 32 bit integer.
+    INT=PN_INT,                 ///< Signed 32 bit integer.
+    CHAR=PN_CHAR,               ///< 32 bit unicode character.
+    ULONG=PN_ULONG,             ///< Unsigned 64 bit integer.
+    LONG=PN_LONG,               ///< Signed 64 bit integer.
+    TIMESTAMP=PN_TIMESTAMP,     ///< Signed 64 bit milliseconds since the epoch.
+    FLOAT=PN_FLOAT,             ///< 32 bit binary floating point.
+    DOUBLE=PN_DOUBLE,           ///< 64 bit binary floating point.
+    DECIMAL32=PN_DECIMAL32,     ///< 32 bit decimal floating point.
+    DECIMAL64=PN_DECIMAL64,     ///< 64 bit decimal floating point.
+    DECIMAL128=PN_DECIMAL128,   ///< 128 bit decimal floating point.
+    UUID=PN_UUID,               ///< 16 byte UUID.
+    BINARY=PN_BINARY,           ///< Variable length sequence of bytes.
+    STRING=PN_STRING,           ///< Variable length utf8-encoded string.
+    SYMBOL=PN_SYMBOL,           ///< Variable length encoded string.
+    DESCRIBED=PN_DESCRIBED,     ///< A descriptor and a value.
+    ARRAY=PN_ARRAY,             ///< A sequence of values of the same type.
+    LIST=PN_LIST,               ///< A sequence of values, may be of mixed types.
+    MAP=PN_MAP                  ///< A sequence of key:value pairs, may be of mixed types.
 };
 
-/** @defgroup types C++ type definitions for AMQP types.
- *
+///@internal
+template <class T> struct Comparable {};
+template<class T> bool operator<(const Comparable<T>& a, const Comparable<T>& b) {
+    return static_cast<const T&>(a) < static_cast<const T&>(b); // operator < provided by type T
+}
+template<class T> bool operator>(const Comparable<T>& a, const Comparable<T>& b) { return b < a; }
+template<class T> bool operator<=(const Comparable<T>& a, const Comparable<T>& b) { return !(a > b); }
+template<class T> bool operator>=(const Comparable<T>& a, const Comparable<T>& b) { return !(a < b); }
+template<class T> bool operator==(const Comparable<T>& a, const Comparable<T>& b) { return a <= b && b <= a; }
+template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b) { return !(a == b); }
+
+/**
+ * @name C++ types representing AMQP types.
+ * @{
+ * @ingroup cpp
  * These types are all distinct for overloading purposes and will insert as the
  * corresponding AMQP type with Encoder operator<<.
- *
- * @{
  */
 struct Null {};
 typedef bool Bool;
@@ -90,11 +97,14 @@ typedef float Float;
 typedef double Double;
 
 ///@internal
+pn_bytes_t pn_bytes(const std::string&);
+
+///@internal
 #define STRING_LIKE(NAME)                                               \
-    struct NAME : public std::string{                                   \
+    PN_CPP_EXTERN struct NAME : public std::string{                     \
         NAME(const std::string& s=std::string()) : std::string(s) {}    \
-        NAME(const pn_bytes_t& b) : std::string(str(b)) {}              \
-        operator pn_bytes_t() const { return bytes(*this); }            \
+        NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {}     \
+        operator pn_bytes_t() const { return pn_bytes(*this); }         \
     }
 
 /** UTF-8 encoded string */
@@ -104,58 +114,136 @@ STRING_LIKE(Symbol);
 /** Binary data */
 STRING_LIKE(Binary);
 
+///@internal
+pn_uuid_t pn_uuid(const std::string&);
+
+/** UUID is represented as a string but treated as if it always has 16 bytes. */
+PN_CPP_EXTERN struct Uuid : public std::string{
+    Uuid(const std::string& s=std::string()) : std::string(s) {}
+    Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {}
+    operator pn_uuid_t() const { return pn_uuid(*this); }
+};
+
 // TODO aconway 2015-06-11: alternative representation of variable-length data
 // as pointer to existing buffers.
 
-template <class T> struct Decimal {
-    T value;
-    Decimal(T v) : value(v) {}
-    Decimal& operator=(T v) { value = v; }
-    operator T() const { return value; }
+// TODO aconway 2015-06-16: usable representation of decimal types.
+template <class T> struct Decimal : public Comparable<Decimal<T> > {
+    char value[sizeof(T)];
+    Decimal() { ::memset(value, 0, sizeof(T)); }
+    Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); }
+    operator T() const { return *reinterpret_cast<const T*>(value); }
+    bool operator<(const Decimal<T>& x) {
+        return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T));
+    }
 };
 typedef Decimal<pn_decimal32_t> Decimal32;
 typedef Decimal<pn_decimal64_t> Decimal64;
 typedef Decimal<pn_decimal128_t> Decimal128;
 
-struct Timestamp {
+PN_CPP_EXTERN struct Timestamp {
     pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
-    Timestamp(int64_t ms) : milliseconds(ms) {}
+    Timestamp(int64_t ms=0) : milliseconds(ms) {}
     operator pn_timestamp_t() const { return milliseconds; }
+    bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; }
 };
 
-typedef pn_uuid_t Uuid;
-
 ///@}
 
-/** Meta-function to get the type-id from a class */
 template <class T> struct TypeIdOf {};
-template<> struct TypeIdOf<Null> { static const TypeId value; };
-template<> struct TypeIdOf<Bool> { static const TypeId value; };
-template<> struct TypeIdOf<Ubyte> { static const TypeId value; };
-template<> struct TypeIdOf<Byte> { static const TypeId value; };
-template<> struct TypeIdOf<Ushort> { static const TypeId value; };
-template<> struct TypeIdOf<Short> { static const TypeId value; };
-template<> struct TypeIdOf<Uint> { static const TypeId value; };
-template<> struct TypeIdOf<Int> { static const TypeId value; };
-template<> struct TypeIdOf<Char> { static const TypeId value; };
-template<> struct TypeIdOf<Ulong> { static const TypeId value; };
-template<> struct TypeIdOf<Long> { static const TypeId value; };
-template<> struct TypeIdOf<Timestamp> { static const TypeId value; };
-template<> struct TypeIdOf<Float> { static const TypeId value; };
-template<> struct TypeIdOf<Double> { static const TypeId value; };
-template<> struct TypeIdOf<Decimal32> { static const TypeId value; };
-template<> struct TypeIdOf<Decimal64> { static const TypeId value; };
-template<> struct TypeIdOf<Decimal128> { static const TypeId value; };
-template<> struct TypeIdOf<Uuid> { static const TypeId value; };
-template<> struct TypeIdOf<Binary> { static const TypeId value; };
-template<> struct TypeIdOf<String> { static const TypeId value; };
-template<> struct TypeIdOf<Symbol> { static const TypeId value; };
+template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; };
+template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; };
+template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; };
+template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; };
+template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; };
+template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; };
+template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; };
+template<> struct TypeIdOf<Int> { static const TypeId value=INT; };
+template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; };
+template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; };
+template<> struct TypeIdOf<Long> { static const TypeId value=LONG; };
+template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; };
+template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; };
+template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; };
+template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; };
+template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; };
+template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; };
+template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; };
+template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; };
+template<> struct TypeIdOf<String> { static const TypeId value=STRING; };
+template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; };
+
+template<class T, TypeId A> struct TypePair {
+    typedef T CppType;
+    TypeId type;
+};
+
+template<class T, TypeId A> struct Ref : public TypePair<T, A> {
+    Ref(T& v) : value(v) {}
+    T& value;
+};
+
+template<class T, TypeId A> struct CRef : public TypePair<T, A> {
+    CRef(const T& v) : value(v) {}
+    CRef(const Ref<T,A>& ref) : value(ref.value) {}
+    const T& value;
+};
+
+/** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int:
+ *
+ *     std::vector<Int> v;
+ *     decoder >> as<ARRAY>(v);
+ */
+template <TypeId A, class T> Ref<T, A> as(T& value) { return Ref<T, A>(value); }
+
+/** Create a const reference to value as AMQP type A for encoding. */
+template <TypeId A, class T> CRef<T, A> as(const T& value) { return CRef<T, A>(value); }
+
+///@}
+
+// TODO aconway 2015-06-16: described types.
 
 /** Return the name of a type. */
-std::string typeName(TypeId);
+PN_CPP_EXTERN std::string typeName(TypeId);
+
+/** Print the name of a type */
+PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId);
 
 /** Return the name of a type from a class. */
-template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
+PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
+
+/** Information needed to start extracting or inserting a container type.
+ *
+ * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s`
+ * to get the Start for the current container.
+ *
+ * With an encoder use one of the member functions startArray, startList, startMap or startDescribed
+ * to create an appropriate Start value, e.g. `encoder << startList() << ...`
+ */
+PN_CPP_EXTERN struct Start {
+    Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0);
+    TypeId type;            ///< The container type: ARRAY, LIST, MAP or DESCRIBED.
+    TypeId element;         ///< the element type for array only.
+    bool isDescribed;       ///< true if first value is a descriptor.
+    size_t size;            ///< the element count excluding the descriptor (if any)
+
+    /** Return a Start for an array */
+    static Start array(TypeId element, bool described=false);
+    /** Return a Start for a list */
+    static Start list();
+    /** Return a Start for a map */
+    static Start map();
+    /** Return a Start for a described type */
+    static Start described();
+};
+
+/** Finish insterting or extracting a container value. */
+PN_CPP_EXTERN struct Finish {};
+inline Finish finish() { return Finish(); }
+
+/** Skip a value */
+PN_CPP_EXTERN struct Skip{};
+inline Skip skip() { return Skip(); }
 
 }}
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
index 7add9a0..f16c862 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -41,7 +41,7 @@ class ConnectionImpl : public Endpoint
   public:
     PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
     PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
-    PN_CPP_EXTERN ~ConnectionImpl();
+    PN_CPP_EXTERN virtual ~ConnectionImpl();
     PN_CPP_EXTERN Transport &getTransport();
     PN_CPP_EXTERN Handler *getOverride();
     PN_CPP_EXTERN void setOverride(Handler *h);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 61fc860..989bd00 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -47,10 +47,6 @@ ConnectionImpl *getImpl(const Connection &c) {
     return PrivateImplRef<Connection>::get(c);
 }
 
-ContainerImpl *getImpl(const Container &c) {
-    return PrivateImplRef<Container>::get(c);
-}
-
 } // namespace
 
 
@@ -253,8 +249,6 @@ Sender ContainerImpl::createSender(Connection &connection, std::string &addr, Ha
         pn_record_set_handler(record, wrapHandler(h));
     }
     snd.open();
-
-    ConnectionImpl *connImpl = getImpl(connection);
     return snd;
 }
 
@@ -266,8 +260,6 @@ Sender ContainerImpl::createSender(std::string &urlString) {
     Sender snd = session.createSender(containerId + '-' + path);
     pn_terminus_set_address(pn_link_target(snd.getPnLink()), path.c_str());
     snd.open();
-
-    ConnectionImpl *connImpl = getImpl(conn);
     return snd;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Data.cpp b/proton-c/bindings/cpp/src/Data.cpp
index 6cfc09b..790cecb 100644
--- a/proton-c/bindings/cpp/src/Data.cpp
+++ b/proton-c/bindings/cpp/src/Data.cpp
@@ -41,8 +41,6 @@ void Data::clear() { pn_data_clear(data); }
 
 bool Data::empty() const { return pn_data_size(data) == 0; }
 
-std::ostream& operator<<(std::ostream& o, const Data& d) {
-    o << Object(d.data);
-}
+std::ostream& operator<<(std::ostream& o, const Data& d) { return o << Object(d.data); }
 
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp
index 4170378..503db81 100644
--- a/proton-c/bindings/cpp/src/Decoder.cpp
+++ b/proton-c/bindings/cpp/src/Decoder.cpp
@@ -18,8 +18,10 @@
  */
 
 #include "proton/cpp/Decoder.h"
+#include "proton/cpp/Value.h"
 #include <proton/codec.h>
 #include "proton_bits.h"
+#include "Msg.h"
 
 namespace proton {
 namespace reactor {
@@ -44,15 +46,28 @@ struct SaveState {
     ~SaveState() { if (data) pn_data_restore(data, handle); }
     void cancel() { data = 0; }
 };
+
+struct Narrow {
+    pn_data_t* data;
+    Narrow(pn_data_t* d) : data(d) { pn_data_narrow(d); }
+    ~Narrow() { pn_data_widen(data); }
+};
+
+template <class T> T check(T result) {
+    if (result < 0)
+        throw Decoder::Error("decode: " + errorStr(result));
+    return result;
+}
+
+std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+
 }
 
 void Decoder::decode(const char* i, size_t size) {
     SaveState ss(data);
     const char* end = i + size;
     while (i < end) {
-        int result = pn_data_decode(data, i, end - i);
-        if (result < 0) throw Decoder::Error("decode: " + errorStr(result));
-        i += result;
+        i += check(pn_data_decode(data, i, end - i));
     }
 }
 
@@ -89,11 +104,65 @@ template <class T, class U> void extract(pn_data_t* data, T& value, U (*get)(pn_
 
 }
 
+void Decoder::checkType(TypeId want) {
+    TypeId got = type();
+    if (want != got) badType(want, got);
+}
+
 TypeId Decoder::type() const {
     SaveState ss(data);
     return preGet(data);
 }
 
+Decoder& operator>>(Decoder& d, Start& s) {
+    SaveState ss(d.data);
+    s.type = preGet(d.data);
+    switch (s.type) {
+      case ARRAY:
+        s.size = pn_data_get_array(d.data);
+        s.element = TypeId(pn_data_get_array_type(d.data));
+        s.isDescribed = pn_data_is_array_described(d.data);
+        break;
+      case LIST:
+        s.size = pn_data_get_list(d.data);
+        break;
+      case MAP:
+        s.size = pn_data_get_map(d.data);
+        break;
+      case DESCRIBED:
+        s.isDescribed = true;
+        s.size = 1;
+        break;
+      default:
+        throw Decoder::Error(MSG("decode: " << s.type << " is not a container type"));
+    }
+    pn_data_enter(d.data);
+    ss.cancel();
+    return d;
+}
+
+Decoder& operator>>(Decoder& d, Finish) { pn_data_exit(d.data); return d; }
+
+Decoder& operator>>(Decoder& d, Skip) { pn_data_next(d.data); return d; }
+
+Decoder& operator>>(Decoder& d, Value& v) {
+    if (d.data == v.values.data) throw Decoder::Error("decode: extract into self");
+    pn_data_clear(v.values.data);
+    {
+        Narrow n(d.data);
+        check(pn_data_appendn(v.values.data, d.data, 1));
+    }
+    if (!pn_data_next(d.data)) throw Decoder::Error("decode: no more data");
+    return d;
+}
+
+
+Decoder& operator>>(Decoder& d, Null) {
+    SaveState ss(d.data);
+    badType(NULL_, preGet(d.data));
+    return d;
+}
+
 Decoder& operator>>(Decoder& d, Bool& value) {
     extract(d.data, value, pn_data_get_bool);
     return d;
@@ -112,7 +181,7 @@ Decoder& operator>>(Decoder& d, Ubyte& value) {
 Decoder& operator>>(Decoder& d, Byte& value) {
     SaveState ss(d.data);
     switch (preGet(d.data)) {
-      case BYTE: value = pn_data_get_ubyte(d.data); break;
+      case BYTE: value = pn_data_get_byte(d.data); break;
       default: badType(BYTE, TypeId(TypeId(pn_data_type(d.data))));
     }
     ss.cancel();
@@ -256,10 +325,4 @@ Decoder& operator>>(Decoder& d, std::string& value) {
     return d;
 }
 
-void Decoder::checkType(TypeId want) {
-    TypeId got = type();
-    if (want != got) badType(want, got);
-}
-
-
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp
index 81fa365..9182400 100644
--- a/proton-c/bindings/cpp/src/Encoder.cpp
+++ b/proton-c/bindings/cpp/src/Encoder.cpp
@@ -18,8 +18,10 @@
  */
 
 #include "proton/cpp/Encoder.h"
+#include "proton/cpp/Value.h"
 #include <proton/codec.h>
 #include "proton_bits.h"
+#include "Msg.h"
 
 namespace proton {
 namespace reactor {
@@ -33,27 +35,30 @@ struct SaveState {
     pn_handle_t handle;
     SaveState(pn_data_t* d) : data(d), handle(pn_data_point(d)) {}
     ~SaveState() { if (data) pn_data_restore(data, handle); }
+    void cancel() { data = 0; }
 };
 
-template <class T> T check(T result) {
+void check(int result, pn_data_t* data) {
     if (result < 0)
-        throw Encoder::Error("encode: " + errorStr(result));
-    return result;
+        throw Encoder::Error("encode: " + errorStr(pn_data_error(data), result));
 }
 }
 
 bool Encoder::encode(char* buffer, size_t& size) {
     SaveState ss(data);               // In case of error
-    pn_data_rewind(data);
     ssize_t result = pn_data_encode(data, buffer, size);
     if (result == PN_OVERFLOW) {
-        size = pn_data_encoded_size(data);
-        return false;
+        result = pn_data_encoded_size(data);
+        if (result >= 0) {
+            size = result;
+            return false;
+        }
     }
-    check(result);
+    check(result, data);
     size = result;
-    ss.data = 0;                // Don't restore state, all is well.
+    ss.cancel();                // Don't restore state, all is well.
     pn_data_clear(data);
+    return true;
 }
 
 void Encoder::encode(std::string& s) {
@@ -70,16 +75,35 @@ std::string Encoder::encode() {
     return s;
 }
 
+Encoder& operator<<(Encoder& e, const Start& s) {
+    switch (s.type) {
+      case ARRAY: pn_data_put_array(e.data, s.isDescribed, pn_type_t(s.element)); break;
+      case MAP: pn_data_put_map(e.data); break;
+      case LIST: pn_data_put_list(e.data); break;
+      case DESCRIBED: pn_data_put_described(e.data); break;
+      default:
+        throw Encoder::Error(MSG("encode: " << s.type << " is not a container type"));
+    }
+    pn_data_enter(e.data);
+    return e;
+}
+
+Encoder& operator<<(Encoder& e, Finish) {
+    pn_data_exit(e.data);
+    return e;
+}
+
 namespace {
 template <class T, class U>
 Encoder& insert(Encoder& e, pn_data_t* data, T& value, int (*put)(pn_data_t*, U)) {
     SaveState ss(data);         // Save state in case of error.
-    check(put(data, value));
-    ss.data = 0;                // Don't restore state, all is good.
+    check(put(data, value), data);
+    ss.cancel();                // Don't restore state, all is good.
     return e;
 }
 }
 
+Encoder& operator<<(Encoder& e, Null) { pn_data_put_null(e.data); return e; }
 Encoder& operator<<(Encoder& e, Bool value) { return insert(e, e.data, value, pn_data_put_bool); }
 Encoder& operator<<(Encoder& e, Ubyte value) { return insert(e, e.data, value, pn_data_put_ubyte); }
 Encoder& operator<<(Encoder& e, Byte value) { return insert(e, e.data, value, pn_data_put_byte); }
@@ -101,4 +125,34 @@ Encoder& operator<<(Encoder& e, String value) { return insert(e, e.data, value,
 Encoder& operator<<(Encoder& e, Symbol value) { return insert(e, e.data, value, pn_data_put_symbol); }
 Encoder& operator<<(Encoder& e, Binary value) { return insert(e, e.data, value, pn_data_put_binary); }
 
+// Meta-function to get the class from the type ID.
+template <TypeId A> struct ClassOf {};
+template<> struct ClassOf<NULL_> { typedef Null ValueType; };
+template<> struct ClassOf<BOOL> { typedef Bool ValueType; };
+template<> struct ClassOf<UBYTE> { typedef Ubyte ValueType; };
+template<> struct ClassOf<BYTE> { typedef Byte ValueType; };
+template<> struct ClassOf<USHORT> { typedef Ushort ValueType; };
+template<> struct ClassOf<SHORT> { typedef Short ValueType; };
+template<> struct ClassOf<UINT> { typedef Uint ValueType; };
+template<> struct ClassOf<INT> { typedef Int ValueType; };
+template<> struct ClassOf<CHAR> { typedef Char ValueType; };
+template<> struct ClassOf<ULONG> { typedef Ulong ValueType; };
+template<> struct ClassOf<LONG> { typedef Long ValueType; };
+template<> struct ClassOf<TIMESTAMP> { typedef Timestamp ValueType; };
+template<> struct ClassOf<FLOAT> { typedef Float ValueType; };
+template<> struct ClassOf<DOUBLE> { typedef Double ValueType; };
+template<> struct ClassOf<DECIMAL32> { typedef Decimal32 ValueType; };
+template<> struct ClassOf<DECIMAL64> { typedef Decimal64 ValueType; };
+template<> struct ClassOf<DECIMAL128> { typedef Decimal128 ValueType; };
+template<> struct ClassOf<UUID> { typedef Uuid ValueType; };
+template<> struct ClassOf<BINARY> { typedef Binary ValueType; };
+template<> struct ClassOf<STRING> { typedef String ValueType; };
+template<> struct ClassOf<SYMBOL> { typedef Symbol ValueType; };
+
+Encoder& operator<<(Encoder& e, const Value& v) {
+    if (e.data == v.values.data) throw Encoder::Error("encode: cannot insert into self");
+    check(pn_data_appendn(e.data, v.values.data, 1), e.data);
+    return e;
+}
+
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Handler.cpp b/proton-c/bindings/cpp/src/Handler.cpp
index 4d1b581..5c37c8d 100644
--- a/proton-c/bindings/cpp/src/Handler.cpp
+++ b/proton-c/bindings/cpp/src/Handler.cpp
@@ -24,10 +24,10 @@
 namespace proton {
 namespace reactor {
 
-Handler::Handler(){};
-Handler::~Handler(){};
+Handler::Handler() {}
+Handler::~Handler() {}
 
-void Handler::onUnhandled(Event &e){};
+void Handler::onUnhandled(Event &e) {}
 
 void Handler::addChildHandler(Handler &e) {
     childHandlers.push_back(&e);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index 625485e..f137397 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -35,10 +35,10 @@ namespace reactor {
 MessagingAdapter::MessagingAdapter(MessagingHandler &delegate_) :
     MessagingHandler(true, delegate_.prefetch, delegate_.autoSettle, delegate_.autoAccept, delegate_.peerCloseIsError),
     delegate(delegate_)
-{};
+{}
 
 
-MessagingAdapter::~MessagingAdapter(){};
+MessagingAdapter::~MessagingAdapter(){}
 
 
 void MessagingAdapter::onReactorInit(Event &e) {
@@ -126,7 +126,7 @@ void MessagingAdapter::onDelivery(Event &e) {
                     MessagingEvent mevent(PN_MESSAGING_ACCEPTED, *pe);
                     delegate.onAccepted(mevent);
                 }
-                else if (rstate = PN_REJECTED) {
+                else if (rstate == PN_REJECTED) {
                     MessagingEvent mevent(PN_MESSAGING_REJECTED, *pe);
                     delegate.onRejected(mevent);
                 }
@@ -164,10 +164,6 @@ bool isRemoteOpen(pn_state_t state) {
     return state & PN_REMOTE_ACTIVE;
 }
 
-bool isRemoteClosed(pn_state_t state) {
-    return state & PN_REMOTE_CLOSED;
-}
-
 } // namespace
 
 void MessagingAdapter::onLinkRemoteClose(Event &e) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
index 925186a..6e3d2bd 100644
--- a/proton-c/bindings/cpp/src/MessagingHandler.cpp
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -83,7 +83,7 @@ void MessagingHandler::createHelpers() {
 MessagingHandler::~MessagingHandler(){
     delete flowController;
     delete messagingAdapter;
-};
+}
 
 void MessagingHandler::onAbort(Event &e) { onUnhandled(e); }
 void MessagingHandler::onAccepted(Event &e) { onUnhandled(e); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Msg.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Msg.h b/proton-c/bindings/cpp/src/Msg.h
index cd8f9e8..2b4c6da 100644
--- a/proton-c/bindings/cpp/src/Msg.h
+++ b/proton-c/bindings/cpp/src/Msg.h
@@ -44,30 +44,10 @@ struct Msg {
     Msg(const Msg& m) : os(m.str()) {}
     std::string str() const { return os.str(); }
     operator std::string() const { return str(); }
-
-    Msg& operator<<(long n) { os << n; return *this; }
-    Msg& operator<<(unsigned long n) { os << n; return *this; }
-    Msg& operator<<(bool n) { os << n; return *this; }
-    Msg& operator<<(short n) { os << n; return *this; }
-    Msg& operator<<(unsigned short n) { os << n; return *this; }
-    Msg& operator<<(int n) { os << n; return *this; }
-    Msg& operator<<(unsigned int n) { os << n; return *this; }
-#ifdef _GLIBCXX_USE_LONG_LONG
-    Msg& operator<<(long long n) { os << n; return *this; }
-    Msg& operator<<(unsigned long long n) { os << n; return *this; }
-#endif
-    Msg& operator<<(double n) { os << n; return *this; }
-    Msg& operator<<(float n) { os << n; return *this; }
-    Msg& operator<<(long double n) { os << n; return *this; }
-
     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();
-}
+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

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/ProtonEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonEvent.cpp b/proton-c/bindings/cpp/src/ProtonEvent.cpp
index 16b92b6..0b0f1d0 100644
--- a/proton-c/bindings/cpp/src/ProtonEvent.cpp
+++ b/proton-c/bindings/cpp/src/ProtonEvent.cpp
@@ -70,11 +70,12 @@ Receiver ProtonEvent::getReceiver() {
 
 Link ProtonEvent::getLink() {
     pn_link_t *lnk = pn_event_link(getPnEvent());
-    if (lnk)
+    if (lnk) {
         if (pn_link_is_sender(lnk))
             return Sender(lnk);
         else
             return Receiver(lnk);
+    }
     throw ProtonException(MSG("No link context for this event"));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/ProtonHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonHandler.cpp b/proton-c/bindings/cpp/src/ProtonHandler.cpp
index 83d9087..f96f5a6 100644
--- a/proton-c/bindings/cpp/src/ProtonHandler.cpp
+++ b/proton-c/bindings/cpp/src/ProtonHandler.cpp
@@ -24,7 +24,7 @@
 namespace proton {
 namespace reactor {
 
-ProtonHandler::ProtonHandler(){};
+ProtonHandler::ProtonHandler(){}
 
 // Everything goes to onUnhandled() unless overriden by subclass
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Transport.cpp b/proton-c/bindings/cpp/src/Transport.cpp
index 7f22b84..91eb8d9 100644
--- a/proton-c/bindings/cpp/src/Transport.cpp
+++ b/proton-c/bindings/cpp/src/Transport.cpp
@@ -27,7 +27,7 @@ namespace proton {
 namespace reactor {
 
 
-Transport::Transport() : connection(0), pnTransport(pn_transport()) {} ;
+Transport::Transport() : connection(0), pnTransport(pn_transport()) {}
 
 Transport::~Transport() { pn_decref(pnTransport); }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Value.cpp b/proton-c/bindings/cpp/src/Value.cpp
index 8e1e38c..b488481 100644
--- a/proton-c/bindings/cpp/src/Value.cpp
+++ b/proton-c/bindings/cpp/src/Value.cpp
@@ -21,21 +21,15 @@
 #include "proton_bits.h"
 #include <proton/codec.h>
 #include <ostream>
+#include <algorithm>
 
 namespace proton {
 namespace reactor {
 
-Values::Values() {}
-Values::Values(const Values& v) { *this = v; }
-Values::~Values() {}
-Values& Values::operator=(const Values& v) { Data::operator=(v); }
-
-void Values::rewind() { pn_data_rewind(data); }
-
-Value::Value() {}
+Value::Value() { *this = Null(); }
 Value::Value(const Value& v) { *this = v; }
 Value::~Value() {}
-Value& Value::operator=(const Value& v) { values = v.values; }
+Value& Value::operator=(const Value& v) { values = v.values; return *this; }
 
 TypeId Value::type() const {
     const_cast<Values&>(values).rewind();
@@ -50,22 +44,93 @@ template <class T> T check(T result) {
 }
 }
 
-Encoder& operator<<(Encoder& e, const Value& v) {
-    if (e.data == v.values.data) throw Encoder::Error("Values inserted into self");
-    pn_data_narrow(e.data);
-    int result = pn_data_appendn(e.data, v.values.data, 1);
-    pn_data_widen(e.data);
-    check(result);
-    return e;
+std::ostream& operator<<(std::ostream& o, const Value& v) {
+    return o << v.values;
+}
+
+namespace {
+
+// Compare nodes, return -1 if a<b, 0 if a==b, +1 if a>b
+// Forward-declare so we can use it recursively.
+int compareNext(Values& a, Values& b);
+
+template <class T> int compare(const T& a, const T& b) {
+    if (a < b) return -1;
+    else if (a > b) return +1;
+    else return 0;
+}
+
+int compareContainer(Values& a, Values& b) {
+    Decoder::Scope sa(a), sb(b);
+    // Compare described vs. not-described.
+    int cmp = compare(sa.isDescribed, sb.isDescribed);
+    if (cmp) return cmp;
+    // Lexical sort (including descriptor if there is one)
+    size_t minSize = std::min(sa.size, sb.size) + int(sa.isDescribed);
+    for (size_t i = 0; i < minSize; ++i) {
+        cmp = compareNext(a, b);
+        if (cmp) return cmp;
+    }
+    return compare(sa.size, sb.size);
+}
+
+template <class T> int compareSimple(Values& a, Values& b) {
+    T va, vb;
+    a >> va;
+    b >> vb;
+    return compare(va, vb);
+}
+
+int compareNext(Values& a, Values& b) {
+    // Sort by TypeId first.
+    TypeId ta = a.type(), tb = b.type();
+    int cmp = compare(ta, tb);
+    if (cmp) return cmp;
+
+    switch (ta) {
+      case NULL_: return 0;
+      case ARRAY:
+      case LIST:
+      case MAP:
+      case DESCRIBED:
+        return compareContainer(a, b);
+      case BOOL: return compareSimple<Bool>(a, b);
+      case UBYTE: return compareSimple<Ubyte>(a, b);
+      case BYTE: return compareSimple<Byte>(a, b);
+      case USHORT: return compareSimple<Ushort>(a, b);
+      case SHORT: return compareSimple<Short>(a, b);
+      case UINT: return compareSimple<Uint>(a, b);
+      case INT: return compareSimple<Int>(a, b);
+      case CHAR: return compareSimple<Char>(a, b);
+      case ULONG: return compareSimple<Ulong>(a, b);
+      case LONG: return compareSimple<Long>(a, b);
+      case TIMESTAMP: return compareSimple<Timestamp>(a, b);
+      case FLOAT: return compareSimple<Float>(a, b);
+      case DOUBLE: return compareSimple<Double>(a, b);
+      case DECIMAL32: return compareSimple<Decimal32>(a, b);
+      case DECIMAL64: return compareSimple<Decimal64>(a, b);
+      case DECIMAL128: return compareSimple<Decimal128>(a, b);
+      case UUID: return compareSimple<Uuid>(a, b);
+      case BINARY: return compareSimple<Binary>(a, b);
+      case STRING: return compareSimple<String>(a, b);
+      case SYMBOL: return compareSimple<Symbol>(a, b);
+    }
+    // Invalid but equal TypeId, treat as equal.
+    return 0;
+}
+
+} // namespace
+
+bool Value::operator==(const Value& v) const {
+    values.rewind();
+    v.values.rewind();
+    return compareNext(values, v.values) == 0;
 }
 
-Decoder& operator>>(Decoder& e, Value& v) {
-    if (e.data == v.values.data) throw Decoder::Error("Values extracted from self");
-    pn_data_narrow(e.data);
-    int result = pn_data_appendn(e.data, v.values.data, 1);
-    pn_data_widen(e.data);
-    check(result);
-    return e;
+bool Value::operator<(const Value& v) const {
+    values.rewind();
+    v.values.rewind();
+    return compareNext(values, v.values) < 0;
 }
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/Values.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Values.cpp b/proton-c/bindings/cpp/src/Values.cpp
new file mode 100644
index 0000000..20fb9f1
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Values.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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/cpp/Value.h"
+#include "proton_bits.h"
+#include <proton/codec.h>
+#include <ostream>
+
+namespace proton {
+namespace reactor {
+
+Values::Values() {}
+Values::Values(const Values& v) { *this = v; }
+Values::~Values() {}
+Values& Values::operator=(const Values& v) { Data::operator=(v); return *this; }
+
+Values& Values::rewind() { pn_data_rewind(data); return *this; }
+
+std::ostream& operator<<(std::ostream& o, const Values& v) {
+    return o << static_cast<const Encoder&>(v);
+}
+
+}}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index b344553..d7bef51 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -48,11 +48,7 @@ string read(string filename) {
     return string(istreambuf_iterator<char>(ifs), istreambuf_iterator<char>());
 }
 
-template <class T> T get(Decoder& d) {
-    T value;
-    d >> exact(value);
-    return value;
-}
+template <class T> T get(Decoder& d) { return d.getAs<T, TypeIdOf<T>::value>(); }
 
 template <class T> std::string str(const T& value) {
     ostringstream oss;
@@ -129,7 +125,7 @@ int run_test(void (*testfn)(), const char* name) {
     return 1;
 }
 
-// FIXME aconway 2015-06-11: not testing all types.
+// TODO aconway 2015-06-11: interop test is not complete.
 
 #define RUN_TEST(T) run_test(&T, #T)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/proton_bits.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp
index 2e96430..10f7c59 100644
--- a/proton-c/bindings/cpp/src/proton_bits.cpp
+++ b/proton-c/bindings/cpp/src/proton_bits.cpp
@@ -39,6 +39,14 @@ std::string errorStr(int code) {
   }
 }
 
+std::string errorStr(pn_error_t* err, int code) {
+    if (err && pn_error_code(err)) {
+        const char* text = pn_error_text(err);
+        return text ? std::string(text) : errorStr(pn_error_code(err));
+    }
+    return errorStr(code);
+}
+
 std::ostream& operator<<(std::ostream& o, const Object& object) {
     pn_string_t* str = pn_string("");
     pn_inspect(object.value, str);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/proton_bits.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.h b/proton-c/bindings/cpp/src/proton_bits.h
index a905172..e57f188 100644
--- a/proton-c/bindings/cpp/src/proton_bits.h
+++ b/proton-c/bindings/cpp/src/proton_bits.h
@@ -20,13 +20,18 @@
  */
 
 #include <iosfwd>
+#include <proton/error.h>
 
 /**@file
  *
  * Assorted internal proton utilities.
  */
+
 std::string errorStr(int code);
 
+/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
+std::string errorStr(pn_error_t*, int code=0);
+
 /** Wrapper for a proton object pointer. */
 struct Object { void* value; Object(void* o) : value(o) {} };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
index 127ee7d..4f2c6ac 100644
--- a/proton-c/bindings/cpp/src/types.cpp
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -19,32 +19,11 @@
 
 #include "proton/cpp/types.h"
 #include <proton/codec.h>
+#include <ostream>
 
 namespace proton {
 namespace reactor {
 
-const TypeId TypeIdOf<Null>::value = NULL_;
-const TypeId TypeIdOf<Bool>::value = BOOL;
-const TypeId TypeIdOf<Ubyte>::value = UBYTE;
-const TypeId TypeIdOf<Byte>::value = BYTE;
-const TypeId TypeIdOf<Ushort>::value = USHORT;
-const TypeId TypeIdOf<Short>::value = SHORT;
-const TypeId TypeIdOf<Uint>::value = UINT;
-const TypeId TypeIdOf<Int>::value = INT;
-const TypeId TypeIdOf<Char>::value = CHAR;
-const TypeId TypeIdOf<Ulong>::value = ULONG;
-const TypeId TypeIdOf<Long>::value = LONG;
-const TypeId TypeIdOf<Timestamp>::value = TIMESTAMP;
-const TypeId TypeIdOf<Float>::value = FLOAT;
-const TypeId TypeIdOf<Double>::value = DOUBLE;
-const TypeId TypeIdOf<Decimal32>::value = DECIMAL32;
-const TypeId TypeIdOf<Decimal64>::value = DECIMAL64;
-const TypeId TypeIdOf<Decimal128>::value = DECIMAL128;
-const TypeId TypeIdOf<Uuid>::value = UUID;
-const TypeId TypeIdOf<Binary>::value = BINARY;
-const TypeId TypeIdOf<String>::value = STRING;
-const TypeId TypeIdOf<Symbol>::value = SYMBOL;
-
 std::string typeName(TypeId t) {
     switch (t) {
       case NULL_: return "null";
@@ -76,7 +55,27 @@ std::string typeName(TypeId t) {
     }
 }
 
-std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
-pn_bytes_t bytes(const std::string& s) { pn_bytes_t b; b.start = &s[0]; b.size = s.size(); return b; }
+std::ostream& operator<<(std::ostream& o,TypeId t) { return o << typeName(t); }
+
+PN_CPP_EXTERN bool isContainer(TypeId t) {
+    return (t == LIST || t == MAP || t == ARRAY || t == DESCRIBED);
+}
+
+pn_bytes_t pn_bytes(const std::string& s) {
+    pn_bytes_t b = { s.size(), const_cast<char*>(&s[0]) };
+    return b;
+}
+
+pn_uuid_t pn_uuid(const std::string& s) {
+    pn_uuid_t u = {0};          // Zero initialized.
+    std::copy(s.begin(), s.begin() + std::max(s.size(), sizeof(pn_uuid_t::bytes)), &u.bytes[0]);
+    return u;
+}
+
+Start::Start(TypeId t, TypeId e, bool d, size_t s) : type(t), element(e), isDescribed(d), size(s) {}
+Start Start::array(TypeId element, bool described) { return Start(ARRAY, element, described); }
+Start Start::list() { return Start(LIST); }
+Start Start::map() { return Start(MAP); }
+Start Start::described() { return Start(DESCRIBED, NULL_, true); }
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/693752d3/proton-c/bindings/go/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/README.md b/proton-c/bindings/go/README.md
deleted file mode 100644
index 0d3a74e..0000000
--- a/proton-c/bindings/go/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# *EXPERIMENTAL* Go binding for proton
-
-Experimental work on the Go language binding has been moved to the `go1` branch
-until it is ready for use. You can `git checkout go1` on your git clone, or
-browse at https://github.com/apache/qpid-proton/blob/go1/proton-c/bindings/go/README.md


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


[12/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Task class to the Ruby reactor APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Task class to the Ruby reactor APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 6f56718bb1b2f54ee795ab3b68b8bc4a5281d0cd
Parents: 803d5e8
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Feb 23 16:19:33 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb  |  3 ++
 proton-c/bindings/ruby/lib/reactor/task.rb | 39 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6f56718b/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index a60a028..f3da844 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -92,6 +92,9 @@ require "handler/outgoing_message_handler"
 require "handler/c_flow_controller"
 require "handler/messaging_handler"
 
+# Reactor classes
+require "reactor/task"
+
 module Qpid::Proton
   # @private
   def self.registry

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6f56718b/proton-c/bindings/ruby/lib/reactor/task.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/task.rb b/proton-c/bindings/ruby/lib/reactor/task.rb
new file mode 100644
index 0000000..6818ed2
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/task.rb
@@ -0,0 +1,39 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class Task
+
+    # @private
+    include Qpid::Proton::Util::Wrapper
+
+    def self.wrap(impl)
+      return nil if impl.nil?
+      self.fetch_instance(impl, :pn_task_attachments) || Task.new(impl)
+    end
+
+    def initialize(impl)
+      @impl = impl
+      self.class.store_instance(self, :pn_task_attachments)
+    end
+
+  end
+
+end


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


[14/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Reactor mixin to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Reactor mixin to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 36380c9270d881f481f9a6755d762ed2bc10681f
Parents: 4b22327
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:37:12 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb  |  1 +
 proton-c/bindings/ruby/lib/util/reactor.rb | 32 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36380c92/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 03f5632..33fe9b6 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -42,6 +42,7 @@ require "util/engine"
 require "util/uuid"
 require "util/timeout"
 require "util/handler"
+require "util/reactor"
 
 # Types
 require "types/strings"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36380c92/proton-c/bindings/ruby/lib/util/reactor.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/reactor.rb b/proton-c/bindings/ruby/lib/util/reactor.rb
new file mode 100644
index 0000000..0bcb557
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/util/reactor.rb
@@ -0,0 +1,32 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Util
+
+  module Reactor
+
+    def create_session(connection, handler = nil)
+      session = connection.session
+      session.open
+      return session
+    end
+
+  end
+
+end


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


[41/50] [abbrv] qpid-proton git commit: PROTON-865: Move types out of reactor namespace, clean up Message.

Posted by ac...@apache.org.
PROTON-865: Move types out of reactor namespace, clean up Message.

Move  AMQP types and general type manipulation, including Message, into proton namespace.
Keep proton::reactor namespace for reactive, event-driven API.

Message cleanup
- use Value and Values for complex AMQP types.
- drop get/set prefixes for attributes.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 327f358e73a1bd3a9611032084b21d0e5b160690
Parents: 38f57e9
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Jun 16 20:42:20 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 examples/cpp/README.md                          |  18 +-
 examples/cpp/broker.cpp                         |   1 +
 examples/cpp/encode_decode.cpp                  |  14 +-
 examples/cpp/example_test.py                    |   5 +-
 examples/cpp/helloworld.cpp                     |   6 +-
 examples/cpp/helloworld_blocking.cpp            |   6 +-
 examples/cpp/helloworld_direct.cpp              |   6 +-
 examples/cpp/simple_recv.cpp                    |  11 +-
 examples/cpp/simple_send.cpp                    |  10 +-
 proton-c/bindings/cpp/CMakeLists.txt            |   1 +
 proton-c/bindings/cpp/README.md                 |  43 ++-
 .../bindings/cpp/include/proton/Acceptor.hpp    |   3 +-
 proton-c/bindings/cpp/include/proton/Acking.hpp |   2 +-
 .../cpp/include/proton/BlockingConnection.hpp   |   3 +-
 .../cpp/include/proton/BlockingLink.hpp         |   3 +-
 .../cpp/include/proton/BlockingSender.hpp       |   3 +-
 .../bindings/cpp/include/proton/Connection.hpp  |   3 +-
 .../bindings/cpp/include/proton/Container.hpp   |   2 +-
 proton-c/bindings/cpp/include/proton/Data.hpp   |  29 +-
 .../bindings/cpp/include/proton/Decoder.hpp     |  12 +-
 .../bindings/cpp/include/proton/Delivery.hpp    |   3 +-
 .../bindings/cpp/include/proton/Duration.hpp    |  33 +-
 .../bindings/cpp/include/proton/Encoder.hpp     |  16 +-
 .../bindings/cpp/include/proton/Endpoint.hpp    |   2 +-
 proton-c/bindings/cpp/include/proton/Error.hpp  |  42 +++
 proton-c/bindings/cpp/include/proton/Event.hpp  |   3 +-
 proton-c/bindings/cpp/include/proton/Handle.hpp |   4 +-
 .../bindings/cpp/include/proton/Handler.hpp     |   3 +-
 proton-c/bindings/cpp/include/proton/Link.hpp   |   3 +-
 .../bindings/cpp/include/proton/Message.hpp     | 112 +++---
 .../cpp/include/proton/MessagingAdapter.hpp     |   4 +-
 .../cpp/include/proton/MessagingEvent.hpp       |   3 +-
 .../cpp/include/proton/MessagingHandler.hpp     |   3 +-
 .../bindings/cpp/include/proton/ProtonEvent.hpp |   3 +-
 .../cpp/include/proton/ProtonHandle.hpp         |   4 +-
 .../cpp/include/proton/ProtonHandler.hpp        |   3 +-
 .../bindings/cpp/include/proton/Receiver.hpp    |   3 +-
 proton-c/bindings/cpp/include/proton/Sender.hpp |   2 +-
 .../bindings/cpp/include/proton/Session.hpp     |   3 +-
 .../bindings/cpp/include/proton/Terminus.hpp    |   2 +-
 .../bindings/cpp/include/proton/Transport.hpp   |   2 +-
 proton-c/bindings/cpp/include/proton/Value.hpp  |  24 +-
 proton-c/bindings/cpp/include/proton/Values.hpp |  13 +-
 .../cpp/include/proton/WaitCondition.hpp        |   2 +-
 .../bindings/cpp/include/proton/exceptions.hpp  |  49 ---
 proton-c/bindings/cpp/include/proton/types.hpp  |  10 +-
 proton-c/bindings/cpp/src/Acceptor.cpp          |   2 +-
 proton-c/bindings/cpp/src/Connection.cpp        |   2 +-
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    |  12 +-
 proton-c/bindings/cpp/src/Container.cpp         |   2 +-
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |  30 +-
 proton-c/bindings/cpp/src/Data.cpp              |  35 +-
 proton-c/bindings/cpp/src/Decoder.cpp           |  22 +-
 proton-c/bindings/cpp/src/Duration.cpp          |  26 +-
 proton-c/bindings/cpp/src/Encoder.cpp           |  11 +-
 proton-c/bindings/cpp/src/Error.cpp             |  30 ++
 proton-c/bindings/cpp/src/Event.cpp             |  16 +-
 proton-c/bindings/cpp/src/Link.cpp              |   2 +-
 proton-c/bindings/cpp/src/Message.cpp           | 361 ++++---------------
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |   4 +-
 proton-c/bindings/cpp/src/MessagingEvent.cpp    |  20 +-
 proton-c/bindings/cpp/src/ProtonEvent.cpp       |  12 +-
 proton-c/bindings/cpp/src/Receiver.cpp          |   4 +-
 proton-c/bindings/cpp/src/Sender.cpp            |   4 +-
 proton-c/bindings/cpp/src/Url.cpp               |   4 +-
 proton-c/bindings/cpp/src/Value.cpp             |   6 +-
 proton-c/bindings/cpp/src/Values.cpp            |   5 +-
 .../cpp/src/blocking/BlockingConnection.cpp     |   2 +-
 .../cpp/src/blocking/BlockingConnectionImpl.cpp |   8 +-
 .../bindings/cpp/src/blocking/BlockingLink.cpp  |   4 +-
 .../cpp/src/blocking/BlockingSender.cpp         |   4 +-
 proton-c/bindings/cpp/src/contexts.cpp          |   4 +-
 proton-c/bindings/cpp/src/interop_test.cpp      |  17 +-
 proton-c/bindings/cpp/src/proton_bits.cpp       |   2 +-
 proton-c/bindings/cpp/src/proton_bits.hpp       |   4 +-
 proton-c/bindings/cpp/src/types.cpp             |   5 +-
 76 files changed, 525 insertions(+), 667 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/README.md
----------------------------------------------------------------------
diff --git a/examples/cpp/README.md b/examples/cpp/README.md
index 867c671..52b73e7 100644
--- a/examples/cpp/README.md
+++ b/examples/cpp/README.md
@@ -1,10 +1,20 @@
 # C++ examples
 
+Many of the examples expect a broker to be running on the standard AMQP
+port. You can use any broker that supports AMQP 1.0, or you can use the simple
+example `broker` provided here. Run the broker in a separate window before
+running the other examples.
+
+If you use another broker you will need to create a queue named `examples`.
+
 ## broker.cpp
 
 A very simple "mini broker". You can use this to run other examples that reqiure
-an intermediary, or you can use a real AMQP 1.0 broker. It creates queues
-automatically when a client tries to send to or subscribe from a node.
+an intermediary, or you can use any AMQP 1.0 broker. This broker creates queues
+automatically when a client tries to send or subscribe.
+
+    $ ./broker
+    broker listening on :5672
 
 ## helloworld.cpp
 
@@ -40,3 +50,7 @@ an intermediary accessible on port 5672 on localhost.
 
 Subscribes to the 'examples' node on an intermediary accessible on port 5672 on
 localhost. Simply prints out the body of received messages.
+
+## encode_decode.cpp
+
+Shows how C++ data types can be converted to and from AMQP types.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index ccecefa..468af48 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+using namespace proton;
 using namespace proton::reactor;
 
 std::string generateUuid(){

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/encode_decode.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp
index bf1dba9..cad4c0e 100644
--- a/examples/cpp/encode_decode.cpp
+++ b/examples/cpp/encode_decode.cpp
@@ -28,7 +28,7 @@
 #include <vector>
 
 using namespace std;
-using namespace proton::reactor;
+using namespace proton;
 
 // Examples of how to use the Encoder and Decoder to create and examine AMQP values.
 //
@@ -49,7 +49,13 @@ void simple_insert_extract() {
     values.rewind();
     values >> i >> s >> b;
     cout << "Extracted: " << i << ", " << s << ", " << b << endl;
-    cout << "Encoded as AMQP in " << values.encode().size() << " bytes" << endl;
+    // Encode and decode as AMQP
+    string amqpData = values.encode();
+    cout << "Encoded as AMQP in " << amqpData.size() << " bytes" << endl;
+    Values values2;
+    values.decode(amqpData);
+    values >> i >> s >> b;
+    cout << "Decoded: " << i << ", " << s << ", " << b << endl;
 }
 
 // Inserting values as a specific AMQP type
@@ -71,12 +77,12 @@ void simple_insert_extract_exact_type() {
     values.rewind();            // Byte(1) << Long(2) << Symbol("bar");
     Long l;
     // Fails, extracting Byte as Long
-    try { values >> as<LONG>(l); throw logic_error("expected error"); } catch (Decoder::Error) {}
+    try { values >> as<LONG>(l); throw logic_error("expected error"); } catch (DecodeError) {}
     Byte b;
     values >> as<BYTE>(b) >> as<LONG>(l); // OK, extract Byte as Byte, Long as Long.
     std::string str;
     // Fails, extracting Symbol as String.
-    try { values >> as<STRING>(str); throw logic_error("expected error"); } catch (Decoder::Error) {}
+    try { values >> as<STRING>(str); throw logic_error("expected error"); } catch (DecodeError) {}
     values >> as<SYMBOL>(str);       // OK, extract Symbol as Symbol
     cout << "Extracted (exact) " << b << ", " << l << ", " << str << endl;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 3da1ddb..2e2d91c 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -17,6 +17,8 @@
 # under the License
 #
 
+# This is a test script to run the examples and verify that they behave as expected.
+
 import unittest
 import os, sys, socket, time
 from  random import randrange
@@ -86,7 +88,7 @@ class ExampleTest(unittest.TestCase):
         self.assertEqual("all messages confirmed\n", send)
         recv = check_output(["./simple_recv", "-a", b.addr, "-m", str(n)])
         recv_expect = "simple_recv listening on %s\n" % (b.addr)
-        recv_expect += "".join(['[%d]: b"some arbitrary binary data"\n' % (i+1) for i in range(n)])
+        recv_expect += "".join(['{"sequence"=%s}\n' % (i+1) for i in range(n)])
         self.assertEqual(recv_expect, recv)
 
         # FIXME aconway 2015-06-16: bug when receiver is started before sender, messages
@@ -117,6 +119,7 @@ class ExampleTest(unittest.TestCase):
 Values: int(42), string("foo"), bool(true)
 Extracted: 42, foo, 1
 Encoded as AMQP in 8 bytes
+Decoded: 42, foo, 1
 
 == Specific AMQP types: byte, long, symbol
 Values: byte(120), long(123456789123456789), symbol(:bar)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index 5ac73da..9546218 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -25,6 +25,7 @@
 #include <iostream>
 
 
+using namespace proton;
 using namespace proton::reactor;
 
 class HelloWorld : public MessagingHandler {
@@ -43,14 +44,13 @@ class HelloWorld : public MessagingHandler {
 
     void onSendable(Event &e) {
         Message m;
-        m.setBody("Hello World!");
+        m.body("Hello World!");
         e.getSender().send(m);
         e.getSender().close();
     }
 
     void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
+        std::cout << e.getMessage().body().get<String>() << std::endl;
         e.getConnection().close();
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/helloworld_blocking.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_blocking.cpp b/examples/cpp/helloworld_blocking.cpp
index c0ef4c5..b5aee8d 100644
--- a/examples/cpp/helloworld_blocking.cpp
+++ b/examples/cpp/helloworld_blocking.cpp
@@ -26,6 +26,7 @@
 #include <iostream>
 
 
+using namespace proton;
 using namespace proton::reactor;
 
 class HelloWorldBlocking : public MessagingHandler {
@@ -42,8 +43,7 @@ class HelloWorldBlocking : public MessagingHandler {
     }
 
     void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
+        std::cout << e.getMessage().body().get<String>() << std::endl;
         e.getConnection().close();
     }
 
@@ -56,7 +56,7 @@ int main(int argc, char **argv) {
         BlockingConnection conn = BlockingConnection(server);
         BlockingSender sender = conn.createSender(addr);
         Message m;
-        m.setBody("Hello World!");
+        m.body("Hello World!");
         sender.send(m);
         conn.close();
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 965ba04..536aba8 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -26,6 +26,7 @@
 #include <iostream>
 
 
+using namespace proton;
 using namespace proton::reactor;
 
 
@@ -44,14 +45,13 @@ class HelloWorldDirect : public MessagingHandler {
 
     void onSendable(Event &e) {
         Message m;
-        m.setBody("Hello World!");
+        m.body("Hello World!");
         e.getSender().send(m);
         e.getSender().close();
     }
 
     void onMessage(Event &e) {
-        std::string body = e.getMessage().getBody();
-        std::cout << body << std::endl;
+        std::cout << e.getMessage().body().get<String>() << std::endl;
     }
 
     void onAccepted(Event &e) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 48ba8a4..b4572f5 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -24,11 +24,13 @@
 #include "proton/Link.hpp"
 
 #include <iostream>
+#include <map>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 
+using namespace proton;
 using namespace proton::reactor;
 
 class Recv : public MessagingHandler {
@@ -46,15 +48,14 @@ class Recv : public MessagingHandler {
     }
 
     void onMessage(Event &e) {
-        int64_t id = 0;
         Message msg = e.getMessage();
-        if (msg.getIdType() == PN_ULONG) {
-            id = msg.getId();
-            if (id < received)
+        Value id = msg.id();
+        if (id.type() == ULONG) {
+            if (id.get<int>() < received)
                 return; // ignore duplicate
         }
         if (expected == 0 || received < expected) {
-            std::cout << '[' << id << "]: " << msg.getBody() << std::endl;
+            std::cout << msg.body() << std::endl;
             received++;
             if (received == expected) {
                 e.getReceiver().close();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index 59222e4..f7518c1 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -24,11 +24,13 @@
 #include "proton/Connection.hpp"
 
 #include <iostream>
+#include <map>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 
+using namespace proton;
 using namespace proton::reactor;
 
 class Send : public MessagingHandler {
@@ -49,10 +51,10 @@ class Send : public MessagingHandler {
         Sender sender = e.getSender();
         while (sender.getCredit() && sent < total) {
             Message msg;
-            msg.setId(sent + 1);
-            // TODO: fancy map body content as in Python example.  Simple binary for now.
-            const char *bin = "some arbitrary binary data";
-            msg.setBody(bin, strlen(bin));
+            msg.id(Value(sent + 1));
+            std::map<std::string, int> m;
+            m["sequence"] = sent+1;
+            msg.body(as<MAP>(m));
             sender.send(msg);
             sent++;
         }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index b7e198f..f3fbb44 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -36,6 +36,7 @@ set(qpid-proton-cpp-source
   src/Duration.cpp
   src/Encoder.cpp
   src/Endpoint.cpp
+  src/Error.cpp
   src/Event.cpp
   src/Handler.cpp
   src/Link.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/README.md b/proton-c/bindings/cpp/README.md
index 9a30e35..b6640e5 100644
--- a/proton-c/bindings/cpp/README.md
+++ b/proton-c/bindings/cpp/README.md
@@ -7,24 +7,33 @@ API documentation in doxygen format.
 
 # TO DO
 
-There are a number of things that remain to be done.
-
-- Mapping of complex types.
-
-- Finish blocking API & demos.
-- API documentation, HTML docs on website.
-- FIXME and TODO notes in code, esp. error handling, missing sender/receiver/connection methods.
-
-- Valgrind for automated tests and demos.
-- More automated tests and examples.
-
-- Security: SASL/SSL support.
+Doc & examples
+- Example set with tutorial documentation. Follow pyton examples + C++ encode/decode example.
+  - Consistent option parsing for examples, like other languages.
+  - Auto tests for all examples validating all statements & code in tutorial.
+- API documentation, fill out & organize for readable doxygen HTML.
+- C++ section on website.
+
+Bugs
+- Memory management
+  - Drop PIMPL pattern in API: pn_foo pointer is already hiding the impl.
+  - Proper ownership of pn_objects created by user, e.g. Message. Let user choose pointer style?
+- Error handling, examples crash on error e.g. queue not found.
+- FIXME and TODO notes in code.
+
+Tests
+- Interop/type testing for full AMQP type coverage.
+- Unit testing for reasonable code coverage.
+- Valgrind for automated unit and example tests.
+
+Features
+- SASL/SSL support with interop tests.
 - Reconnection
-
+- Finish blocking API & examples.
+- Described types, full support and tests.
+- Durable subscriptions & demos (see python changes)
 
 # Nice to have
 
-Subclasses of Encoder/Decoder that push to/pull from a std::ostream/istream as
-values are inserted/extracted.
-
-Better support for Decimal type.
+- Helpers (or at least doc) for multi-threaded use (reactor/engine per connection)
+- Usable support for decimal types.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acceptor.hpp b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
index 5fd0004..591af2c 100644
--- a/proton-c/bindings/cpp/include/proton/Acceptor.hpp
+++ b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
@@ -44,7 +44,6 @@ class Acceptor : public ProtonHandle<pn_acceptor_t>
     friend class ProtonImplRef<Acceptor>;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_ACCEPTOR_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Acking.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acking.hpp b/proton-c/bindings/cpp/include/proton/Acking.hpp
index f9f079f..67da0b1 100644
--- a/proton-c/bindings/cpp/include/proton/Acking.hpp
+++ b/proton-c/bindings/cpp/include/proton/Acking.hpp
@@ -39,6 +39,6 @@ class Acking
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_ACKING_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
index 138b239..77345c4 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
@@ -61,7 +61,6 @@ class BlockingConnection : public Handle<BlockingConnectionImpl>
     friend class PrivateImplRef<BlockingConnection>;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_BLOCKINGCONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
index 3eec755..80df739 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
@@ -53,7 +53,6 @@ class BlockingLink
     friend class BlockingReceiver;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_BLOCKINGLINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
index 64cbdfd..25f09bb 100644
--- a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
+++ b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
@@ -48,7 +48,6 @@ class BlockingSender : public BlockingLink
     friend class BlockingConnection;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_BLOCKINGSENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Connection.hpp b/proton-c/bindings/cpp/include/proton/Connection.hpp
index e72b091..5656889 100644
--- a/proton-c/bindings/cpp/include/proton/Connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/Connection.hpp
@@ -64,7 +64,6 @@ class Connection : public Endpoint, public Handle<ConnectionImpl>
    friend class ConnectionImpl;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_CONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Container.hpp b/proton-c/bindings/cpp/include/proton/Container.hpp
index 0f61599..7333566 100644
--- a/proton-c/bindings/cpp/include/proton/Container.hpp
+++ b/proton-c/bindings/cpp/include/proton/Container.hpp
@@ -72,6 +72,6 @@ class Container : public Handle<ContainerImpl>
    friend class PrivateImplRef<Container>;
 };
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_CONTAINER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Data.hpp b/proton-c/bindings/cpp/include/proton/Data.hpp
index 7f9dad0..30f85b7 100644
--- a/proton-c/bindings/cpp/include/proton/Data.hpp
+++ b/proton-c/bindings/cpp/include/proton/Data.hpp
@@ -29,31 +29,44 @@
 struct pn_data_t;
 
 namespace proton {
-namespace reactor {
 
 /** Base for classes that hold AMQP data. */
-class Data {
+PN_CPP_EXTERN class Data {
   public:
+    explicit Data();
     virtual ~Data();
+    Data(const Data&);
 
-    /** Copies the data */
     Data& operator=(const Data&);
 
     /** Clear the data. */
-    PN_CPP_EXTERN void clear();
+    void clear();
 
     /** True if there are no values. */
-    PN_CPP_EXTERN bool empty() const;
+    bool empty() const;
 
     /** Human readable representation of data. */
     friend std::ostream& operator<<(std::ostream&, const Data&);
 
+    /** The underlying pn_data_t */
+    pn_data_t* pnData() { return data; }
+
+    /** True if this Data object owns it's own pn_data_t, false if it is acting as a "view" */
+    bool own() const { return own_; }
+
+    void swap(Data&);
+
   protected:
-    /** Takes ownership of pd */
-    explicit Data(pn_data_t* pd=0);
+    /** Does not take ownership, just a view on the data */
+    explicit Data(pn_data_t*);
+
+    /** Does not take ownership, just a view on the data */
+    void view(pn_data_t*);
+
     mutable pn_data_t* data;
+    bool own_;
 };
 
 
-}}
+}
 #endif // DATA_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Decoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Decoder.hpp b/proton-c/bindings/cpp/include/proton/Decoder.hpp
index 814fb05..c3da9dc 100644
--- a/proton-c/bindings/cpp/include/proton/Decoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/Decoder.hpp
@@ -21,14 +21,16 @@
 
 #include "proton/Data.hpp"
 #include "proton/types.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include <iosfwd>
 
 namespace proton {
-namespace reactor {
 
 class Value;
 
+/** Raised by Decoder operations on error */
+struct DecodeError : public Error { explicit DecodeError(const std::string&) throw(); };
+
 /**@file
  * Stream-like decoder from AMQP bytes to C++ values.
  * @ingroup cpp
@@ -64,10 +66,6 @@ You can also extract container values element-by-element, see the Start class.
 */
 PN_CPP_EXTERN class Decoder : public virtual Data {
   public:
-    /** Raised if a Decoder operation fails  */
-    struct Error : public ProtonException {
-        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
-    };
 
     PN_CPP_EXTERN Decoder();
     PN_CPP_EXTERN ~Decoder();
@@ -215,5 +213,5 @@ template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref)  {
     return d;
 }
 
-}} // namespace proton::reactor
+}
 #endif // DECODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Delivery.hpp b/proton-c/bindings/cpp/include/proton/Delivery.hpp
index 63ecfcd..b90f7fa 100644
--- a/proton-c/bindings/cpp/include/proton/Delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/Delivery.hpp
@@ -55,7 +55,6 @@ class Delivery : public ProtonHandle<pn_delivery_t>
     friend class ProtonImplRef<Delivery>;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_DELIVERY_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Duration.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Duration.hpp b/proton-c/bindings/cpp/include/proton/Duration.hpp
index 0265e73..288ef9d 100644
--- a/proton-c/bindings/cpp/include/proton/Duration.hpp
+++ b/proton-c/bindings/cpp/include/proton/Duration.hpp
@@ -23,34 +23,33 @@
  */
 
 #include "proton/ImportExport.hpp"
-#include "proton/types.h"
+#include "proton/types.hpp"
 
 namespace proton {
-namespace reactor {
 
 /** @ingroup cpp
  * A duration is a time in milliseconds.
  */
-class Duration
+class Duration : public Comparable<Duration>
 {
   public:
-    PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
-    PN_CPP_EXTERN uint64_t getMilliseconds() const;
-    PN_CPP_EXTERN static const Duration FOREVER;
-    PN_CPP_EXTERN static const Duration IMMEDIATE;
-    PN_CPP_EXTERN static const Duration SECOND;
-    PN_CPP_EXTERN static const Duration MINUTE;
-  private:
     uint64_t milliseconds;
+    explicit Duration(uint64_t ms) : milliseconds(ms) {}
+
+    bool operator<(Duration d) { return milliseconds < d.milliseconds; }
+    bool operator==(Duration d) { return milliseconds == d.milliseconds; }
+
+    static const Duration FOREVER;
+    static const Duration IMMEDIATE;
+    static const Duration SECOND;
+    static const Duration MINUTE;
 };
 
-PN_CPP_EXTERN Duration operator*(const Duration& duration,
-                                         uint64_t multiplier);
-PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
-                                         const Duration& duration);
-PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
-PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+inline Duration operator*(Duration d, uint64_t n) { return Duration(d.milliseconds*n); }
+inline Duration operator*(uint64_t n, Duration d) { return d * n; }
 
-}} // namespace proton::reactor
+inline Timestamp operator+(Timestamp ts, Duration d) { return Timestamp(ts.milliseconds+d.milliseconds); }
+inline Timestamp operator+(Duration d, Timestamp ts) { return ts + d; }
+}
 
 #endif  /*!PROTON_CPP_DURATION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Encoder.hpp b/proton-c/bindings/cpp/include/proton/Encoder.hpp
index e32fce5..aaa8d93 100644
--- a/proton-c/bindings/cpp/include/proton/Encoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/Encoder.hpp
@@ -21,13 +21,13 @@
 
 #include "proton/Data.hpp"
 #include "proton/types.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include <iosfwd>
 
 struct pn_data_t;
 
 namespace proton {
-namespace reactor {
+
 
 class Value;
 
@@ -36,6 +36,9 @@ class Value;
  * @ingroup cpp
 */
 
+/** Raised by Encoder operations on error */
+struct EncodeError : public Error { explicit EncodeError(const std::string&) throw(); };
+
 /**
 @ingroup cpp
 
@@ -56,11 +59,6 @@ You can also insert containers element-by-element, see the Start class.
 */
 class Encoder : public virtual Data {
   public:
-    /** Raised if a Encoder operation fails  */
-    struct Error : public ProtonException {
-        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
-    };
-
     PN_CPP_EXTERN Encoder();
     PN_CPP_EXTERN ~Encoder();
 
@@ -127,6 +125,8 @@ class Encoder : public virtual Data {
     // TODO aconway 2015-06-16: DESCRIBED.
     ///@}
 
+    /** Copy data from a raw pn_data_t */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, pn_data_t*);
   private:
     PN_CPP_EXTERN Encoder(pn_data_t* pd);
 
@@ -180,5 +180,5 @@ template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
 }
 
 
-}}
+}
 #endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Endpoint.hpp b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
index e68ffbf..2736047 100644
--- a/proton-c/bindings/cpp/include/proton/Endpoint.hpp
+++ b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
@@ -53,6 +53,6 @@ class Endpoint
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_ENDPOINT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Error.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Error.hpp b/proton-c/bindings/cpp/include/proton/Error.hpp
new file mode 100644
index 0000000..a3d3242
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Error.hpp
@@ -0,0 +1,42 @@
+#ifndef PROTON_CPP_EXCEPTIONS_H
+#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
+
+namespace proton {
+
+/** @ingroup cpp
+ * Functions in the proton namespace throw a subclass of proton::Error on error.
+ */
+struct Error : public std::runtime_error { explicit Error(const std::string&) throw(); };
+
+/** Raised if a message is rejected */
+struct MessageReject : public Error { explicit MessageReject(const std::string&) throw(); };
+
+/** Raised if a message is released */
+struct MessageRelease : public Error { explicit MessageRelease(const std::string&) throw(); };
+
+
+}
+
+#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Event.hpp b/proton-c/bindings/cpp/include/proton/Event.hpp
index f808dd1..db85c9c 100644
--- a/proton-c/bindings/cpp/include/proton/Event.hpp
+++ b/proton-c/bindings/cpp/include/proton/Event.hpp
@@ -54,7 +54,6 @@ class Event
     PN_CPP_EXTERN Event& operator=(const Event&);
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_EVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Handle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handle.hpp b/proton-c/bindings/cpp/include/proton/Handle.hpp
index f8fc81b..648658b 100644
--- a/proton-c/bindings/cpp/include/proton/Handle.hpp
+++ b/proton-c/bindings/cpp/include/proton/Handle.hpp
@@ -69,11 +69,11 @@ template <class T> class Handle {
     typedef T Impl;
     PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
 
-    Impl* impl;
+    mutable Impl* impl;
 
   friend class PrivateImplRef<T>;
 };
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_HANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handler.hpp b/proton-c/bindings/cpp/include/proton/Handler.hpp
index d20fbeb..c66eecb 100644
--- a/proton-c/bindings/cpp/include/proton/Handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/Handler.hpp
@@ -44,7 +44,6 @@ class PN_CPP_EXTERN Handler
     std::vector<Handler *>childHandlers;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Link.hpp b/proton-c/bindings/cpp/include/proton/Link.hpp
index bf5a9a7..5500041 100644
--- a/proton-c/bindings/cpp/include/proton/Link.hpp
+++ b/proton-c/bindings/cpp/include/proton/Link.hpp
@@ -61,8 +61,7 @@ class Link : public Endpoint, public ProtonHandle<pn_link_t>
     bool senderLink;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #include "proton/Sender.hpp"
 #include "proton/Receiver.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Message.hpp b/proton-c/bindings/cpp/include/proton/Message.hpp
index f94f58b..b35eb18 100644
--- a/proton-c/bindings/cpp/include/proton/Message.hpp
+++ b/proton-c/bindings/cpp/include/proton/Message.hpp
@@ -23,94 +23,90 @@
  */
 #include "proton/ImportExport.hpp"
 #include "proton/ProtonHandle.hpp"
-#include "proton/message.h"
+#include "proton/Value.hpp"
+#include "proton/Message.hpp"
 #include <string>
 
+struct pn_message_t;
+struct pn_data_t;
 
 namespace proton {
-namespace reactor {
 
-class Message : public ProtonHandle<pn_message_t>
+// FIXME aconway 2015-06-17: documentation of properties.
+PN_CPP_EXTERN class Message : public reactor::ProtonHandle<pn_message_t>
 {
   public:
-    PN_CPP_EXTERN Message();
-    PN_CPP_EXTERN Message(pn_message_t *);
-    PN_CPP_EXTERN Message(const Message&);
-    PN_CPP_EXTERN Message& operator=(const Message&);
-    PN_CPP_EXTERN ~Message();
+    Message();
+    Message(pn_message_t *);
+    Message(const Message&);
+    Message& operator=(const Message&);
+    ~Message();
 
-    PN_CPP_EXTERN pn_message_t *getPnMessage() const;
+    pn_message_t *pnMessage() const;
 
-    // FIXME aconway 2015-06-11: get rid of get/set prefixes
+    void id(const Value& id);
+    Value id() const;
 
-    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
-    PN_CPP_EXTERN void setId(uint64_t id);
-    PN_CPP_EXTERN uint64_t getId();
-    PN_CPP_EXTERN void setId(const std::string &id);
-    PN_CPP_EXTERN std::string getStringId();
-    PN_CPP_EXTERN void setId(const char *p, size_t len);
-    PN_CPP_EXTERN size_t getId(const char **p);
-    PN_CPP_EXTERN pn_type_t getIdType();
+    void user(const std::string &user);
+    std::string user() const;
 
-    PN_CPP_EXTERN void setUserId(const std::string &id);
-    PN_CPP_EXTERN std::string getUserId();
+    void address(const std::string &addr);
+    std::string address() const;
 
-    PN_CPP_EXTERN void setAddress(const std::string &addr);
-    PN_CPP_EXTERN std::string getAddress();
+    void subject(const std::string &s);
+    std::string subject() const;
 
-    PN_CPP_EXTERN void setSubject(const std::string &s);
-    PN_CPP_EXTERN std::string getSubject();
+    void replyTo(const std::string &s);
+    std::string replyTo() const;
 
-    PN_CPP_EXTERN void setReplyTo(const std::string &s);
-    PN_CPP_EXTERN std::string getReplyTo();
+    void correlationId(const Value&);
+    Value correlationId() const;
 
-    PN_CPP_EXTERN void setCorrelationId(uint64_t id);
-    PN_CPP_EXTERN uint64_t getCorrelationId();
-    PN_CPP_EXTERN void setCorrelationId(const std::string &id);
-    PN_CPP_EXTERN std::string getStringCorrelationId();
-    PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
-    PN_CPP_EXTERN size_t getCorrelationId(const char **p);
+    void contentType(const std::string &s);
+    std::string contentType() const;
 
-    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
-    PN_CPP_EXTERN pn_type_t getCorrelationIdType();
+    void contentEncoding(const std::string &s);
+    std::string contentEncoding() const;
 
-    PN_CPP_EXTERN void setContentType(const std::string &s);
-    PN_CPP_EXTERN std::string getContentType();
+    void expiry(Timestamp t);
+    Timestamp expiry() const;
 
-    PN_CPP_EXTERN void setContentEncoding(const std::string &s);
-    PN_CPP_EXTERN std::string getContentEncoding();
+    void creationTime(Timestamp t);
+    Timestamp creationTime() const;
 
-    PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
-    PN_CPP_EXTERN pn_timestamp_t getExpiry();
+    void groupId(const std::string &s);
+    std::string groupId() const;
 
-    PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
-    PN_CPP_EXTERN pn_timestamp_t getCreationTime();
+    void replyToGroupId(const std::string &s);
+    std::string replyToGroupId() const;
 
-    PN_CPP_EXTERN void setGroupId(const std::string &s);
-    PN_CPP_EXTERN std::string getGroupId();
+    /** Set the body to an AMQP value. */
+    void body(const Value&);
 
-    PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
-    PN_CPP_EXTERN std::string getReplyToGroupId();
+    /** Template to convert any type to a Value and set as the body */
+    template <class T> void body(const T& v) { body(Value(v)); }
 
-    // FIXME aconway 2015-06-11: use Values for body.
-    PN_CPP_EXTERN void setBody(const std::string &data);
-    PN_CPP_EXTERN std::string getBody();
+    /** Set the body to a sequence of sections containing AMQP values. */
+    void body(const Values&);
 
-    PN_CPP_EXTERN void getBody(std::string &str);
+    const Values& body() const;
 
-    PN_CPP_EXTERN void setBody(const char *, size_t len);
-    PN_CPP_EXTERN size_t getBody(char *, size_t len);
-    PN_CPP_EXTERN size_t getBinaryBodySize();
+    Values& body(); ///< Allows in-place modification of body sections.
 
+    // FIXME aconway 2015-06-17: consistent and flexible treatment of buffers.
+    // Allow convenient std::string encoding/decoding (with re-use of existing
+    // string capacity) but also need to allow encoding/decoding of non-string
+    // buffers. Introduce a buffer type with begin/end pointers?
 
-    PN_CPP_EXTERN void encode(std::string &data);
-    PN_CPP_EXTERN void decode(const std::string &data);
+    void encode(std::string &data);
+    std::string encode();
+    void decode(const std::string &data);
 
   private:
-    friend class ProtonImplRef<Message>;
+    mutable Values body_;
+  friend class reactor::ProtonImplRef<Message>;
 };
 
-
-}} // namespace proton::reactor
+}
 
 #endif  /*!PROTON_CPP_MESSAGE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
index 7c6fa79..243e049 100644
--- a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
+++ b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
@@ -34,7 +34,6 @@ namespace reactor {
 
 // Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
 
-
 class MessagingAdapter : public MessagingHandler
 {
   public:
@@ -73,7 +72,6 @@ class MessagingAdapter : public MessagingHandler
     MessagingHandler &delegate;  // The handler for generated MessagingEvent's
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
index a73a7ad..e80f44b 100644
--- a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
+++ b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
@@ -94,7 +94,6 @@ class MessagingEvent : public ProtonEvent
     MessagingEvent(const MessagingEvent&);
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_MESSAGINGEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
index ea712a6..06858e3 100644
--- a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
+++ b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
@@ -91,7 +91,6 @@ class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
     void createHelpers();
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_MESSAGING_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
index 88358c9..0d1d534 100644
--- a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
+++ b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
@@ -51,7 +51,6 @@ class ProtonEvent : public Event
     Container &container;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
index 1170753..213bc14 100644
--- a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
@@ -58,11 +58,11 @@ template <class T> class ProtonHandle {
     typedef T Impl;
     PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
 
-    Impl* impl;
+    mutable Impl* impl;
 
   friend class ProtonImplRef<T>;
 };
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_PROTONHANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
index 91d8bd9..799ca89 100644
--- a/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandler.hpp
@@ -77,7 +77,6 @@ class ProtonHandler : public Handler
     virtual void onUnhandled(Event &e);
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Receiver.hpp b/proton-c/bindings/cpp/include/proton/Receiver.hpp
index a913b7b..ad22302 100644
--- a/proton-c/bindings/cpp/include/proton/Receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/Receiver.hpp
@@ -42,7 +42,6 @@ class Receiver : public Link
     virtual void verifyType(pn_link_t *l);
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_RECEIVER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Sender.hpp b/proton-c/bindings/cpp/include/proton/Sender.hpp
index bb39b6d..3a3ee41 100644
--- a/proton-c/bindings/cpp/include/proton/Sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/Sender.hpp
@@ -47,6 +47,6 @@ class Sender : public Link
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_SENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Session.hpp b/proton-c/bindings/cpp/include/proton/Session.hpp
index 4a3eccc..1f19b32 100644
--- a/proton-c/bindings/cpp/include/proton/Session.hpp
+++ b/proton-c/bindings/cpp/include/proton/Session.hpp
@@ -57,7 +57,6 @@ class Transport;
     friend class ProtonImplRef<Session>;
 };
 
-
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_SESSION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Terminus.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Terminus.hpp b/proton-c/bindings/cpp/include/proton/Terminus.hpp
index 0b798b3..b13165e 100644
--- a/proton-c/bindings/cpp/include/proton/Terminus.hpp
+++ b/proton-c/bindings/cpp/include/proton/Terminus.hpp
@@ -76,6 +76,6 @@ class Terminus : public ProtonHandle<pn_terminus_t>
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_TERMINUS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Transport.hpp b/proton-c/bindings/cpp/include/proton/Transport.hpp
index ca93674..f81e483 100644
--- a/proton-c/bindings/cpp/include/proton/Transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/Transport.hpp
@@ -43,6 +43,6 @@ class Transport
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_TRANSPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/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 9448dc5..a5f2edf 100644
--- a/proton-c/bindings/cpp/include/proton/Value.hpp
+++ b/proton-c/bindings/cpp/include/proton/Value.hpp
@@ -21,23 +21,29 @@
 
 #include "proton/Values.hpp"
 
+struct pn_data_t;
+
 /**@file
  * Holder for an AMQP value.
  * @ingroup cpp
  */
 namespace proton {
-namespace reactor {
 
 /** Holds a single AMQP value. */
 PN_CPP_EXTERN class Value {
   public:
-    PN_CPP_EXTERN Value();
-    PN_CPP_EXTERN Value(const Value&);
+    Value();
+    Value(const Value&);
+
     /** Converting constructor from any settable value */
     template <class T> explicit Value(const T& v);
-    PN_CPP_EXTERN ~Value();
-    PN_CPP_EXTERN Value& operator=(const Value&);
 
+    ~Value();
+
+    Value& operator=(const Value&);
+
+    /** Copy the first value from a raw pn_data_t. */
+    Value& operator=(pn_data_t*);
 
     TypeId type() const;
 
@@ -55,13 +61,13 @@ PN_CPP_EXTERN class Value {
     template<class T> operator T() const;
 
     /** insert a value into an Encoder. */
-    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+    friend Encoder& operator<<(Encoder&, const Value&);
 
     /** Extract a value from a decoder. */
-    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+    friend Decoder& operator>>(Decoder&, Value&);
 
     /** Human readable format */
-    PN_CPP_EXTERN friend std::ostream& operator<<(std::ostream&, const Value&);
+    friend std::ostream& operator<<(std::ostream&, const Value&);
 
     bool operator==(const Value&) const;
     bool operator !=(const Value& v) const{ return !(*this == v); }
@@ -93,6 +99,6 @@ template<class T> Value& Value::operator=(const T& value) { set(value); return *
 template<class T> Value::operator T() const { return get<T>(); }
 
 template<class T> Value::Value(const T& value) { set(value); }
-}}
+}
 
 #endif // VALUE_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/Values.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Values.hpp b/proton-c/bindings/cpp/include/proton/Values.hpp
index 0377c0c..604d2be 100644
--- a/proton-c/bindings/cpp/include/proton/Values.hpp
+++ b/proton-c/bindings/cpp/include/proton/Values.hpp
@@ -28,7 +28,7 @@
  */
 
 namespace proton {
-namespace reactor {
+
 
 /** Holds a sequence of AMQP values, allows inserting and extracting.
  *
@@ -38,19 +38,24 @@ PN_CPP_EXTERN class Values : public Encoder, public Decoder {
   public:
     Values();
     Values(const Values&);
+
+    /** Does not take ownership, just a view on the data */
+    Values(pn_data_t*);
+
     ~Values();
 
     /** Copy data from another Values */
     Values& operator=(const Values&);
 
-    PN_CPP_EXTERN Values& rewind();
+    Values& rewind();
+
 
-  private:
   friend class Value;
+  friend class Message;
 };
 
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Values&);
 
-}}
+}
 
 #endif // VALUES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
index a960c42..12c7708 100644
--- a/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
+++ b/proton-c/bindings/cpp/include/proton/WaitCondition.hpp
@@ -40,6 +40,6 @@ class WaitCondition
 };
 
 
-}} // namespace proton::reactor
+}}
 
 #endif  /*!PROTON_CPP_WAITCONDITION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/exceptions.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/exceptions.hpp b/proton-c/bindings/cpp/include/proton/exceptions.hpp
deleted file mode 100644
index 9fdef94..0000000
--- a/proton-c/bindings/cpp/include/proton/exceptions.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef PROTON_CPP_EXCEPTIONS_H
-#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
-
-namespace proton {
-namespace reactor {
-
-class ProtonException : public std::runtime_error
-{
-  public:
-    explicit ProtonException(const std::string& msg) throw() : std::runtime_error(msg) {}
-};
-
-class MessageReject : public ProtonException
-{
-  public:
-    explicit MessageReject(const std::string& msg) throw() : ProtonException(msg) {}
-};
-
-class MessageRelease : public ProtonException
-{
-  public:
-    explicit MessageRelease(const std::string& msg) throw() : ProtonException(msg) {}
-};
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/include/proton/types.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp
index 819abb1..62b2f53 100644
--- a/proton-c/bindings/cpp/include/proton/types.hpp
+++ b/proton-c/bindings/cpp/include/proton/types.hpp
@@ -33,7 +33,7 @@
  */
 
 namespace proton {
-namespace reactor {
+
 
 /** TypeId identifies an AMQP type */
 enum TypeId {
@@ -98,11 +98,14 @@ typedef double Double;
 
 ///@internal
 pn_bytes_t pn_bytes(const std::string&);
+//@internal
+std::string str(const pn_bytes_t& b);
 
 ///@internal
 #define STRING_LIKE(NAME)                                               \
     PN_CPP_EXTERN struct NAME : public std::string{                     \
         NAME(const std::string& s=std::string()) : std::string(s) {}    \
+        NAME(const char* s) : std::string(s) {}    \
         NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {}     \
         operator pn_bytes_t() const { return pn_bytes(*this); }         \
     }
@@ -141,10 +144,11 @@ typedef Decimal<pn_decimal32_t> Decimal32;
 typedef Decimal<pn_decimal64_t> Decimal64;
 typedef Decimal<pn_decimal128_t> Decimal128;
 
-PN_CPP_EXTERN struct Timestamp {
+PN_CPP_EXTERN struct Timestamp : public Comparable<Timestamp> {
     pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
     Timestamp(int64_t ms=0) : milliseconds(ms) {}
     operator pn_timestamp_t() const { return milliseconds; }
+    bool operator==(const Timestamp& x) { return milliseconds == x.milliseconds; }
     bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; }
 };
 
@@ -245,6 +249,6 @@ inline Finish finish() { return Finish(); }
 PN_CPP_EXTERN struct Skip{};
 inline Skip skip() { return Skip(); }
 
-}}
+}
 
 #endif // TYPES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Acceptor.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Acceptor.cpp b/proton-c/bindings/cpp/src/Acceptor.cpp
index 6d3d1af..2756a0a 100644
--- a/proton-c/bindings/cpp/src/Acceptor.cpp
+++ b/proton-c/bindings/cpp/src/Acceptor.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "proton/Acceptor.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "ProtonImplRef.hpp"
 #include "Msg.hpp"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
index 006b567..2f31013 100644
--- a/proton-c/bindings/cpp/src/Connection.cpp
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -21,7 +21,7 @@
 #include "proton/Container.hpp"
 #include "proton/Connection.hpp"
 #include "proton/Handler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 #include "contexts.hpp"
 #include "ConnectionImpl.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
index 450d504..5fa2fb2 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -20,7 +20,7 @@
  */
 #include "proton/Container.hpp"
 #include "proton/Handler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "ConnectionImpl.hpp"
 #include "proton/Transport.hpp"
 #include "Msg.hpp"
@@ -73,7 +73,7 @@ ConnectionImpl::~ConnectionImpl() {
 Transport &ConnectionImpl::getTransport() {
     if (transport)
         return *transport;
-    throw ProtonException(MSG("Connection has no transport"));
+    throw Error(MSG("Connection has no transport"));
 }
 
 Handler* ConnectionImpl::getOverride() { return override; }
@@ -99,7 +99,7 @@ std::string ConnectionImpl::getHostname() {
 
 Connection &ConnectionImpl::getConnection() {
     // Endpoint interface.  Should be implemented in the Connection object.
-    throw ProtonException(MSG("Internal error"));
+    throw Error(MSG("Internal error"));
 }
 
 Container &ConnectionImpl::getContainer() {
@@ -117,16 +117,16 @@ void ConnectionImpl::reactorDetach() {
 
 Connection &ConnectionImpl::getReactorReference(pn_connection_t *conn) {
     if (!conn)
-        throw ProtonException(MSG("Null Proton connection"));
+        throw Error(MSG("Null Proton connection"));
     ConnectionImpl *impl = getConnectionContext(conn);
     if (!impl) {
         // First time we have seen this connection
         pn_reactor_t *reactor = pn_object_reactor(conn);
         if (!reactor)
-            throw ProtonException(MSG("Invalid Proton connection specifier"));
+            throw Error(MSG("Invalid Proton connection specifier"));
         Container container(getContainerContext(reactor));
         if (!container)  // can't be one created by our container
-            throw ProtonException(MSG("Unknown Proton connection specifier"));
+            throw Error(MSG("Unknown Proton connection specifier"));
         impl = new ConnectionImpl(container, *conn);
     }
     return impl->reactorReference;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index 4fa6c6a..16de0c1 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -24,7 +24,7 @@
 #include "proton/Session.hpp"
 #include "proton/MessagingAdapter.hpp"
 #include "proton/Acceptor.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "ContainerImpl.hpp"
 #include "PrivateImplRef.hpp"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index 80137b5..29c1e72 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -24,7 +24,7 @@
 #include "proton/Session.hpp"
 #include "proton/MessagingAdapter.hpp"
 #include "proton/Acceptor.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 
 #include "Msg.hpp"
 #include "ContainerImpl.hpp"
@@ -205,7 +205,7 @@ ContainerImpl::~ContainerImpl() {
 }
 
 Connection ContainerImpl::connect(std::string &host, Handler *h) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     Container cntnr(this);
     Connection connection(cntnr, handler);
     Connector *connector = new Connector(connection);
@@ -229,17 +229,17 @@ Duration ContainerImpl::getTimeout() {
 }
 
 void ContainerImpl::setTimeout(Duration timeout) {
-    if (timeout == Duration::FOREVER || timeout.getMilliseconds() > PN_MILLIS_MAX)
+    if (timeout == Duration::FOREVER || timeout.milliseconds > PN_MILLIS_MAX)
         pn_reactor_set_timeout(reactor, PN_MILLIS_MAX);
     else {
-        pn_millis_t tmo = timeout.getMilliseconds();
+        pn_millis_t tmo = timeout.milliseconds;
         pn_reactor_set_timeout(reactor, tmo);
     }
 }
 
 
 Sender ContainerImpl::createSender(Connection &connection, std::string &addr, Handler *h) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     Session session = getDefaultSession(connection.getPnConnection(), &getImpl(connection)->defaultSession);
     Sender snd = session.createSender(containerId  + '-' + addr);
     pn_link_t *lnk = snd.getPnLink();
@@ -253,7 +253,7 @@ Sender ContainerImpl::createSender(Connection &connection, std::string &addr, Ha
 }
 
 Sender ContainerImpl::createSender(std::string &urlString) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     Connection conn = connect(urlString, 0);
     Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
     std::string path = Url(urlString).getPath();
@@ -264,7 +264,7 @@ Sender ContainerImpl::createSender(std::string &urlString) {
 }
 
 Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     ConnectionImpl *connImpl = getImpl(connection);
     Session session = getDefaultSession(connImpl->pnConnection, &connImpl->defaultSession);
     Receiver rcv = session.createReceiver(containerId + '-' + addr);
@@ -274,7 +274,7 @@ Receiver ContainerImpl::createReceiver(Connection &connection, std::string &addr
 }
 
 Receiver ContainerImpl::createReceiver(const std::string &urlString) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     // TODO: const cleanup of API
     Connection conn = connect(const_cast<std::string &>(urlString), 0);
     Session session = getDefaultSession(conn.getPnConnection(), &getImpl(conn)->defaultSession);
@@ -290,11 +290,11 @@ Acceptor ContainerImpl::acceptor(const std::string &host, const std::string &por
     if (acptr)
         return Acceptor(acptr);
     else
-        throw ProtonException(MSG("accept fail: " << pn_error_text(pn_io_error(pn_reactor_io(reactor))) << "(" << host << ":" << port << ")"));
+        throw Error(MSG("accept fail: " << pn_error_text(pn_io_error(pn_reactor_io(reactor))) << "(" << host << ":" << port << ")"));
 }
 
 Acceptor ContainerImpl::listen(const std::string &urlString) {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     Url url(urlString);
     // TODO: SSL
     return acceptor(url.getHost(), url.getPort());
@@ -307,7 +307,7 @@ pn_handler_t *ContainerImpl::wrapHandler(Handler *h) {
 
 
 void ContainerImpl::initializeReactor() {
-    if (reactor) throw ProtonException(MSG("Container already running"));
+    if (reactor) throw Error(MSG("Container already running"));
     reactor = pn_reactor();
 
     // Set our context on the reactor
@@ -343,26 +343,26 @@ void ContainerImpl::start() {
 }
 
 bool ContainerImpl::process() {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     bool result = pn_reactor_process(reactor);
     // TODO: check errors
     return result;
 }
 
 void ContainerImpl::stop() {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     pn_reactor_stop(reactor);
     // TODO: check errors
 }
 
 void ContainerImpl::wakeup() {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     pn_reactor_wakeup(reactor);
     // TODO: check errors
 }
 
 bool ContainerImpl::isQuiesced() {
-    if (!reactor) throw ProtonException(MSG("Container not started"));
+    if (!reactor) throw Error(MSG("Container not started"));
     return pn_reactor_quiesced(reactor);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Data.cpp b/proton-c/bindings/cpp/src/Data.cpp
index 3cfa715..dc017ae 100644
--- a/proton-c/bindings/cpp/src/Data.cpp
+++ b/proton-c/bindings/cpp/src/Data.cpp
@@ -18,20 +18,39 @@
  */
 
 #include "proton/Data.hpp"
-#include <proton/codec.h>
+#include "proton/codec.h"
 #include "proton_bits.hpp"
+#include <utility>
 
 namespace proton {
-namespace reactor {
 
-Data::Data(pn_data_t* p) : data(p ? p : pn_data(0)) {}
+Data::Data() : data(pn_data(0)), own_(true) {}
 
-Data::~Data() { if (data) pn_data_free(data); }
+Data::Data(pn_data_t* p) : data(p), own_(false) { }
+
+Data::Data(const Data& x) : data(pn_data(0)), own_(true) { *this = x; }
+
+Data::~Data() { if (own_ && data) pn_data_free(data); }
+
+void Data::view(pn_data_t* newData) {
+    if (data && own_) pn_data_free(data);
+    data = newData;
+    own_ = false;
+}
+
+void Data::swap(Data& x) {
+    std::swap(data, x.data);
+    std::swap(own_, x.own_);
+}
 
 Data& Data::operator=(const Data& x) {
     if (this != &x) {
-        pn_data_free(data);
-        data = pn_data(pn_data_size(x.data));
+        if (!own_) {
+            data = pn_data(pn_data_size(x.data));
+            own_ = true;
+        } else {
+            clear();
+        }
         pn_data_copy(data, x.data);
     }
     return *this;
@@ -41,6 +60,6 @@ void Data::clear() { pn_data_clear(data); }
 
 bool Data::empty() const { return pn_data_size(data) == 0; }
 
-std::ostream& operator<<(std::ostream& o, const Data& d) { return o << Object(d.data); }
+std::ostream& operator<<(std::ostream& o, const Data& d) { return o << PnObject(d.data); }
 
-}} // namespace proton::reactor
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp
index 6f5b73b..50e6a12 100644
--- a/proton-c/bindings/cpp/src/Decoder.cpp
+++ b/proton-c/bindings/cpp/src/Decoder.cpp
@@ -24,8 +24,6 @@
 #include "Msg.hpp"
 
 namespace proton {
-namespace reactor {
-
 
 /**@file
  *
@@ -38,6 +36,8 @@ Decoder::Decoder(const char* buffer, size_t size) { decode(buffer, size); }
 Decoder::Decoder(const std::string& buffer) { decode(buffer); }
 Decoder::~Decoder() {}
 
+DecodeError::DecodeError(const std::string& msg) throw() : Error("decode: "+msg) {}
+
 namespace {
 struct SaveState {
     pn_data_t* data;
@@ -55,12 +55,10 @@ struct Narrow {
 
 template <class T> T check(T result) {
     if (result < 0)
-        throw Decoder::Error("decode: " + errorStr(result));
+        throw DecodeError("" + errorStr(result));
     return result;
 }
 
-std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
-
 }
 
 void Decoder::decode(const char* i, size_t size) {
@@ -84,13 +82,13 @@ namespace {
 
 void badType(TypeId want, TypeId got) {
     if (want != got)
-        throw Decoder::Error("decode: expected "+typeName(want)+" found "+typeName(got));
+        throw DecodeError("expected "+typeName(want)+" found "+typeName(got));
 }
 
 TypeId preGet(pn_data_t* data) {
-    if (!pn_data_next(data)) throw Decoder::Error("decode: no more data");
+    if (!pn_data_next(data)) throw DecodeError("no more data");
     TypeId t = TypeId(pn_data_type(data));
-    if (t < 0) throw Decoder::Error("decode: invalid data");
+    if (t < 0) throw DecodeError("invalid data");
     return t;
 }
 
@@ -134,7 +132,7 @@ Decoder& operator>>(Decoder& d, Start& s) {
         s.size = 1;
         break;
       default:
-        throw Decoder::Error(MSG("decode: " << s.type << " is not a container type"));
+        throw DecodeError(MSG("" << s.type << " is not a container type"));
     }
     pn_data_enter(d.data);
     ss.cancel();
@@ -146,13 +144,13 @@ Decoder& operator>>(Decoder& d, Finish) { pn_data_exit(d.data); return d; }
 Decoder& operator>>(Decoder& d, Skip) { pn_data_next(d.data); return d; }
 
 Decoder& operator>>(Decoder& d, Value& v) {
-    if (d.data == v.values.data) throw Decoder::Error("decode: extract into self");
+    if (d.data == v.values.data) throw DecodeError("extract into self");
     pn_data_clear(v.values.data);
     {
         Narrow n(d.data);
         check(pn_data_appendn(v.values.data, d.data, 1));
     }
-    if (!pn_data_next(d.data)) throw Decoder::Error("decode: no more data");
+    if (!pn_data_next(d.data)) throw DecodeError("no more data");
     return d;
 }
 
@@ -325,4 +323,4 @@ Decoder& operator>>(Decoder& d, std::string& value) {
     return d;
 }
 
-}} // namespace proton::reactor
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Duration.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Duration.cpp b/proton-c/bindings/cpp/src/Duration.cpp
index 1c5c5ea..7a11819 100644
--- a/proton-c/bindings/cpp/src/Duration.cpp
+++ b/proton-c/bindings/cpp/src/Duration.cpp
@@ -22,34 +22,10 @@
 #include <limits>
 
 namespace proton {
-namespace reactor {
-
-Duration::Duration(uint64_t ms) : milliseconds(ms) {}
-uint64_t Duration::getMilliseconds() const { return milliseconds; }
-
-Duration operator*(const Duration& duration, uint64_t multiplier)
-{
-    return Duration(duration.getMilliseconds() * multiplier);
-}
-
-Duration operator*(uint64_t multiplier, const Duration& duration)
-{
-    return Duration(duration.getMilliseconds() * multiplier);
-}
-
-bool operator==(const Duration& a, const Duration& b)
-{
-    return a.getMilliseconds() == b.getMilliseconds();
-}
-
-bool operator!=(const Duration& a, const Duration& b)
-{
-    return a.getMilliseconds() != b.getMilliseconds();
-}
 
 const Duration Duration::FOREVER(std::numeric_limits<uint64_t>::max());
 const Duration Duration::IMMEDIATE(0);
 const Duration Duration::SECOND(1000);
 const Duration Duration::MINUTE(SECOND * 60);
 
-}} // namespace proton::reactor
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp
index 0bd6943..892c338 100644
--- a/proton-c/bindings/cpp/src/Encoder.cpp
+++ b/proton-c/bindings/cpp/src/Encoder.cpp
@@ -24,11 +24,12 @@
 #include "Msg.hpp"
 
 namespace proton {
-namespace reactor {
 
 Encoder::Encoder() {}
 Encoder::~Encoder() {}
 
+EncodeError::EncodeError(const std::string& msg) throw() : Error("encode: "+msg) {}
+
 namespace {
 struct SaveState {
     pn_data_t* data;
@@ -40,7 +41,7 @@ struct SaveState {
 
 void check(int result, pn_data_t* data) {
     if (result < 0)
-        throw Encoder::Error("encode: " + errorStr(pn_data_error(data), result));
+        throw EncodeError(errorStr(pn_data_error(data), result));
 }
 }
 
@@ -82,7 +83,7 @@ Encoder& operator<<(Encoder& e, const Start& s) {
       case LIST: pn_data_put_list(e.data); break;
       case DESCRIBED: pn_data_put_described(e.data); break;
       default:
-        throw Encoder::Error(MSG("encode: " << s.type << " is not a container type"));
+        throw EncodeError(MSG("" << s.type << " is not a container type"));
     }
     pn_data_enter(e.data);
     return e;
@@ -150,9 +151,9 @@ template<> struct ClassOf<STRING> { typedef String ValueType; };
 template<> struct ClassOf<SYMBOL> { typedef Symbol ValueType; };
 
 Encoder& operator<<(Encoder& e, const Value& v) {
-    if (e.data == v.values.data) throw Encoder::Error("encode: cannot insert into self");
+    if (e.data == v.values.data) throw EncodeError("cannot insert into self");
     check(pn_data_appendn(e.data, v.values.data, 1), e.data);
     return e;
 }
 
-}} // namespace proton::reactor
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Error.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Error.cpp b/proton-c/bindings/cpp/src/Error.cpp
new file mode 100644
index 0000000..e97bf5f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Error.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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"
+
+namespace proton {
+
+Error::Error(const std::string& msg) throw() : std::runtime_error("proton: "+msg) {}
+
+MessageReject::MessageReject(const std::string& msg) throw() : Error(msg) {}
+
+MessageRelease::MessageRelease(const std::string& msg) throw() : Error(msg) {}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Event.cpp b/proton-c/bindings/cpp/src/Event.cpp
index 937e3ed..69825a8 100644
--- a/proton-c/bindings/cpp/src/Event.cpp
+++ b/proton-c/bindings/cpp/src/Event.cpp
@@ -24,7 +24,7 @@
 
 #include "proton/Event.hpp"
 #include "proton/Handler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 
 #include "Msg.hpp"
 #include "contexts.hpp"
@@ -39,31 +39,31 @@ Event::~Event() {}
 
 Container &Event::getContainer() {
     // Subclasses to override as appropriate
-    throw ProtonException(MSG("No container context for event"));
+    throw Error(MSG("No container context for event"));
 }
 
 Connection &Event::getConnection() {
-    throw ProtonException(MSG("No connection context for Event"));
+    throw Error(MSG("No connection context for Event"));
 }
 
 Sender Event::getSender() {
-    throw ProtonException(MSG("No Sender context for event"));
+    throw Error(MSG("No Sender context for event"));
 }
 
 Receiver Event::getReceiver() {
-    throw ProtonException(MSG("No Receiver context for event"));
+    throw Error(MSG("No Receiver context for event"));
 }
 
 Link Event::getLink() {
-    throw ProtonException(MSG("No Link context for event"));
+    throw Error(MSG("No Link context for event"));
 }
 
 Message Event::getMessage() {
-    throw ProtonException(MSG("No message associated with event"));
+    throw Error(MSG("No message associated with event"));
 }
 
 void Event::setMessage(Message &) {
-    throw ProtonException(MSG("Operation not supported for this type of event"));
+    throw Error(MSG("Operation not supported for this type of event"));
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp
index 9065524..76c100c 100644
--- a/proton-c/bindings/cpp/src/Link.cpp
+++ b/proton-c/bindings/cpp/src/Link.cpp
@@ -19,7 +19,7 @@
  *
  */
 #include "proton/Link.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "proton/Connection.hpp"
 #include "ConnectionImpl.hpp"
 #include "Msg.hpp"


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


[21/50] [abbrv] qpid-proton git commit: PROTON-781: Added SessionPerConnection to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added SessionPerConnection to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: f9b4d3ec2061299a186227d973a1b387565fb3a2
Parents: 7bb1b71
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:40:01 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 .../ruby/lib/reactor/session_per_connection.rb  | 45 ++++++++++++++++++++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f9b4d3ec/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 661927e..f40c608 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -105,6 +105,7 @@ require "reactor/global_overrides"
 require "reactor/urls"
 require "reactor/connector"
 require "reactor/backoff"
+require "reactor/session_per_connection"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f9b4d3ec/proton-c/bindings/ruby/lib/reactor/session_per_connection.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/session_per_connection.rb b/proton-c/bindings/ruby/lib/reactor/session_per_connection.rb
new file mode 100644
index 0000000..f8180c0
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/session_per_connection.rb
@@ -0,0 +1,45 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class SessionPerConnection
+
+    include Qpid::Proton::Util::Reactor
+
+    def initialize
+      @default_session = nil
+    end
+
+    def session(connection)
+      if @default_session.nil?
+        @default_session = self.create_session
+        @default_session.context = self
+      end
+      return @default_session
+    end
+
+    def on_session_remote_close(event)
+      event.connection.close
+      @default_session = nil
+    end
+
+  end
+
+end


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


[26/50] [abbrv] qpid-proton git commit: PROTON-781: Added reactor support to the Ruby Event class.

Posted by ac...@apache.org.
PROTON-781: Added reactor support to the Ruby Event class.


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

Branch: refs/heads/cjansen-cpp-client
Commit: ebb14bafb2aedc816ad472d84e64489332f00c64
Parents: 02387ab
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon May 18 15:02:18 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/event/event.rb | 38 ++++++++++++++++++++------
 1 file changed, 30 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ebb14baf/proton-c/bindings/ruby/lib/event/event.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/event/event.rb b/proton-c/bindings/ruby/lib/event/event.rb
index dd5d869..e839f63 100644
--- a/proton-c/bindings/ruby/lib/event/event.rb
+++ b/proton-c/bindings/ruby/lib/event/event.rb
@@ -37,6 +37,13 @@ module Qpid::Proton
     # be generated.
     NONE = event_type(:PN_EVENT_NONE)
 
+    # A reactor has been started.
+    REACTOR_INIT = event_type(:PN_REACTOR_INIT)
+    # A reactor has no more events to process.
+    REACTOR_QUIESCED = event_type(:PN_REACTOR_QUIESCED)
+    # A reactor has been stopred.
+    REACTOR_FINAL = event_type(:PN_REACTOR_FINAL)
+
     # A timer event has occurred.
     TIMER_TASK = event_type(:PN_TIMER_TASK)
 
@@ -199,17 +206,32 @@ module Qpid::Proton
       #
       def dispatch(handler, type = nil)
         type = @type if type.nil?
-        #notify any and all attached handlers
-        if handler.respond_to?(:handlers?) && handler.handlers?
-          handler.handlers.each {|hndlr| self.dispatch(hndlr, type)}
-        end
-        if handler.respond_to?(type.method)
-          handler.__send__(type.method, self)
-        elsif handler.respond_to?(:on_unhandled)
-          handler.on_unhandled(self)
+        if handler.is_a?(Qpid::Proton::Handler::WrappedHandler)
+          Cproton.pn_handler_dispatch(handler.impl, @impl, type.number)
+        else
+          result = Qpid::Proton::Event.dispatch(handler, type.method, self)
+          if (result != "DELEGATED") && handler.respond_to?(:handlers)
+            handler.handlers.each do |hndlr|
+              self.dispatch(hndlr)
+            end
+          end
         end
       end
 
+      # Returns the reactor for this event.
+      #
+      # @return [Reactor, nil] The reactor.
+      #
+      def reactor
+        impl = Cproton.pn_event_reactor(@impl)
+        Qpid::Proton::Util::ClassWrapper::WRAPPERS["pn_reactor"].call(impl)
+      end
+
+      def container
+        impl = Cproton.pn_event_reactor(@impl)
+        Qpid::Proton::Util::ClassWrapper::WRAPPERS["pn_reactor"].call(impl)
+      end
+
       # Returns the transport for this event.
       #
       # @return [Transport, nil] The transport.


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


[20/50] [abbrv] qpid-proton git commit: PROTON-781: Added Container to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added Container to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: b7ee18cdbcef119310927a527cda05e9ef4dca37
Parents: f9b4d3e
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 26 10:26:11 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |   1 +
 proton-c/bindings/ruby/lib/reactor/container.rb | 272 +++++++++++++++++++
 2 files changed, 273 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b7ee18cd/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index f40c608..ba1e66e 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -106,6 +106,7 @@ require "reactor/urls"
 require "reactor/connector"
 require "reactor/backoff"
 require "reactor/session_per_connection"
+require "reactor/container"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b7ee18cd/proton-c/bindings/ruby/lib/reactor/container.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/container.rb b/proton-c/bindings/ruby/lib/reactor/container.rb
new file mode 100644
index 0000000..93b49bb
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/container.rb
@@ -0,0 +1,272 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  # @private
+  class InternalTransactionHandler < Qpid::Proton::Handler::OutgoingMessageHandler
+
+    def initialize
+      super
+    end
+
+    def on_settled(event)
+      if event.delivery.respond_to? :transaction
+        event.transaction = event.delivery.transaction
+        event.delivery.transaction.handle_outcome(event)
+      end
+    end
+
+  end
+
+
+  # A representation of the AMQP concept of a container which, loosely
+  # speaking, is something that establishes links to or from another
+  # container on which messages are transferred.
+  #
+  # This is an extension to the Reactor classthat adds convenience methods
+  # for creating instances of Qpid::Proton::Connection, Qpid::Proton::Sender
+  # and Qpid::Proton::Receiver.
+  #
+  # @example
+  #
+  class Container < Reactor
+
+    include Qpid::Proton::Util::Reactor
+
+    include Qpid::Proton::Util::UUID
+
+    attr_accessor :container_id
+    attr_accessor :global_handler
+
+    def initialize(handlers, options = {})
+      super(handlers, options)
+
+      # only do the following if we're creating a new instance
+      if !options.has_key?(:impl)
+        @ssl = SSLConfig.new
+        if options[:global_handler]
+          self.global_handler = GlobalOverrides.new(options[:global_handler])
+        else
+          # very ugly, but using self.global_handler doesn't work in the constructor
+          ghandler = Reactor.instance_method(:global_handler).bind(self).call
+          ghandler = GlobalOverrides.new(ghandler)
+          Reactor.instance_method(:global_handler=).bind(self).call(ghandler)
+        end
+        @trigger = nil
+        @container_id = generate_uuid
+      end
+    end
+
+    # Initiates the establishment of an AMQP connection.
+    #
+    # @param options [Hash] A hash of named arguments.
+    #
+    def connect(options = {})
+      conn = self.connection(options[:handler])
+      conn.container = self.container_id || generate_uuid
+      connector = Connector.new(conn)
+      conn.overrides = connector
+      if !options[:url].nil?
+        connector.address = URLs.new([options[:url]])
+      elsif !options[:urls].nil?
+        connector.address = URLs.new(options[:urls])
+      elsif !options[:address].nil?
+        connector.address = URLs.new([Qpid::Proton::URL.new(options[:address])])
+      else
+        raise ArgumentError.new("either :url or :urls or :address required")
+      end
+
+      connector.heartbeat = options[:heartbeat] if !options[:heartbeat].nil?
+      if !options[:reconnect].nil?
+        connector.reconnect = options[:reconnect]
+      else
+        connector.reconnect = Backoff.new()
+      end
+
+      connector.ssl_domain = SessionPerConnection.new # TODO seems this should be configurable
+
+      conn.open
+
+      return conn
+    end
+
+    def _session(context)
+      if context.is_a?(Qpid::Proton::URL)
+        return self._session(self.connect(:url => context))
+      elsif context.is_a?(Qpid::Proton::Session)
+        return context
+      elsif context.is_a?(Qpid::Proton::Connection)
+        if context.session_policy?
+          return context.session_policy.session(context)
+        else
+          return self.create_session(context)
+        end
+      else
+        return context.session
+      end
+    end
+
+    # Initiates the establishment of a link over which messages can be sent.
+    #
+    # @param context [String, URL] The context.
+    # @param opts [Hash] Additional options.
+    # @param opts [String, Qpid::Proton::URL] The target address.
+    # @param opts [String] :source The source address.
+    # @param opts [Boolean] :dynamic
+    # @param opts [Object] :handler
+    # @param opts [Object] :tag_generator The tag generator.
+    # @param opts [Hash] :options Addtional link options
+    #
+    # @return [Sender] The sender.
+    #
+    def create_sender(context, opts = {})
+      if context.is_a?(::String)
+        context = Qpid::Proton::URL.new(context)
+      end
+
+      target = opts[:target]
+      if context.is_a?(Qpid::Proton::URL) && target.nil?
+        target = context.path
+      end
+
+      session = self._session(context)
+
+      sender = session.sender(opts[:name] ||
+                              id(session.connection.container,
+                                target, opts[:source]))
+        sender.source.address = opts[:source] if !opts[:source].nil?
+        sender.target.address = target if target
+        sender.handler = opts[:handler] if !opts[:handler].nil?
+        sender.tag_generator = opts[:tag_generator] if !opts[:tag_gnenerator].nil?
+        self._apply_link_options(opts[:options], sender)
+        sender.open
+        return sender
+    end
+
+    # Initiates the establishment of a link over which messages can be received.
+    #
+    # There are two accepted arguments for the context
+    #  1. If a Connection is supplied then the link is established using that
+    # object. The source, and optionally the target, address can be supplied
+    #  2. If it is a String or a URL then a new Connection is created on which
+    # the link will be attached. If a path is specified, but not the source
+    # address, then the path of the URL is used as the target address.
+    #
+    # The name will be generated for the link if one is not specified.
+    #
+    # @param context [Connection, URL, String] The connection or the address.
+    # @param opts [Hash] Additional otpions.
+    # @option opts [String, Qpid::Proton::URL] The source address.
+    # @option opts [String] :target The target address
+    # @option opts [String] :name The link name.
+    # @option opts [Boolean] :dynamic
+    # @option opts [Object] :handler
+    # @option opts [Hash] :options Additional link options.
+    #
+    # @return [Receiver
+    #
+    def create_receiver(context, opts = {})
+      if context.is_a?(::String)
+        context = Qpid::Proton::URL.new(context)
+      end
+
+      source = opts[:source]
+      if context.is_a?(Qpid::Proton::URL) && source.nil?
+        source = context.path
+      end
+
+      session = self._session(context)
+
+      receiver = session.receiver(opts[:name] ||
+                                  id(session.connection.container,
+                                      source, opts[:target]))
+      receiver.source.address = source if source
+      receiver.source.dynamic = true if opts.has_key?(:dynamic) && opts[:dynamic]
+      receiver.target.address = opts[:target] if !opts[:target].nil?
+      receiver.handler = opts[:handler] if !opts[:handler].nil?
+      self._apply_link_options(opts[:options], receiver)
+      receiver.open
+      return receiver
+    end
+
+    def declare_transaction(context, handler = nil, settle_before_discharge = false)
+      if context.respond_to? :txn_ctl && !context.__send__(:txn_ctl).nil?
+        class << context
+          attr_accessor :txn_ctl
+        end
+        context.txn_ctl = self.create_sender(context, nil, "txn-ctl",
+        InternalTransactionHandler.new())
+      end
+      return Transaction.new(context.txn_ctl, handler, settle_before_discharge)
+    end
+
+    # Initiates a server socket, accepting incoming AMQP connections on the
+    # interface and port specified.
+    #
+    # @param url []
+    # @param ssl_domain []
+    #
+    def listen(url, ssl_domain = nil)
+      url = Qpid::Proton::URL.new(url)
+      acceptor = self.acceptor(url.host, url.port)
+      ssl_config = ssl_domain
+      if ssl_config.nil? && (url.scheme == 'amqps') && @ssl
+        ssl_config = @ssl.server
+      end
+      if !ssl_config.nil?
+        acceptor.ssl_domain(ssl_config)
+      end
+      return acceptor
+    end
+
+    def do_work(timeout = nil)
+      self.timeout = timeout unless timeout.nil?
+      self.process
+    end
+
+    def id(container, remote, local)
+      if !local.nil? && !remote.nil?
+        "#{container}-#{remote}-#{local}"
+      elsif !local.nil?
+        "#{container}-#{local}"
+      elsif !remote.nil?
+        "#{container}-#{remote}"
+      else
+        "#{container}-#{generate_uuid}"
+      end
+    end
+
+    def _apply_link_options(options, link)
+      if !options.nil? && !options.empty?
+        if !options.is_a?(::List)
+          options = [Options].flatten
+        end
+
+        options.each {|option| o.apply(link) if o.test(link)}
+      end
+    end
+
+    def to_s
+      "#{self.class}<@impl=#{Cproton.pni_address_of(@impl)}>"
+    end
+
+  end
+
+end


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


[40/50] [abbrv] qpid-proton git commit: PROTON-865: Move types out of reactor namespace, clean up Message.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/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 f422202..540ba15 100644
--- a/proton-c/bindings/cpp/src/Message.cpp
+++ b/proton-c/bindings/cpp/src/Message.cpp
@@ -20,411 +20,209 @@
  */
 
 #include "proton/Message.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
+#include "proton/message.h"
 #include "Msg.hpp"
+#include "proton_bits.hpp"
 #include "ProtonImplRef.hpp"
 
 #include <cstring>
 
 namespace proton {
-namespace reactor {
 
+namespace reactor {
 template class ProtonHandle<pn_message_t>;
-typedef ProtonImplRef<Message> PI;
+}
+typedef reactor::ProtonImplRef<Message> PI;
 
-Message::Message() {
+Message::Message() : body_(0) {
     PI::ctor(*this, 0);
 }
-Message::Message(pn_message_t *p) {
+Message::Message(pn_message_t *p) : body_(0) {
     PI::ctor(*this, p);
 }
-Message::Message(const Message& m) : ProtonHandle<pn_message_t>() {
+Message::Message(const Message& m) : ProtonHandle<pn_message_t>(), body_(0) {
     PI::copy(*this, m);
 }
+
+// FIXME aconway 2015-06-17: Message should be a value type, needs to own pn_message_t
+// and do appropriate _copy and _free operations.
 Message& Message::operator=(const Message& m) {
     return PI::assign(*this, m);
 }
 Message::~Message() { PI::dtor(*this); }
 
 namespace {
-void confirm(pn_message_t *&p) {
+void confirm(pn_message_t * const&  p) {
     if (p) return;
-    p = pn_message(); // Correct refcount of 1
+    const_cast<pn_message_t*&>(p) = pn_message(); // Correct refcount of 1
     if (!p)
-        throw ProtonException(MSG("No memory"));
-}
-
-void getFormatedStringContent(pn_data_t *data, std::string &str) {
-    pn_data_rewind(data);
-    size_t sz = str.capacity();
-    if (sz < 512) sz = 512;
-    while (true) {
-        str.resize(sz);
-        int err = pn_data_format(data, (char *) str.data(), &sz);
-        if (err) {
-            if (err != PN_OVERFLOW)
-                throw ProtonException(MSG("Unexpected message body data error"));
-        }
-        else {
-            str.resize(sz);
-            return;
-        }
-        sz *= 2;
-    }
-}
-
-} // namespace
-
-void Message::setId(uint64_t id) {
-    confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_ulong(data, id))
-        throw ProtonException(MSG("setId error " << err));
+        throw Error(MSG("No memory"));
 }
 
-uint64_t Message::getId() {
-    confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_ULONG) {
-        return pn_data_get_ulong(data);
-    }
-    throw ProtonException(MSG("Message ID is not a ULONG"));
+void check(int err) {
+    if (err) throw Error(errorStr(err));
 }
 
-void Message::setId(const std::string &id) {
-    confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_string(data, pn_bytes(id.size(), id.data())))
-        throw ProtonException(MSG("setId error " << err));
+void setValue(pn_data_t* d, const Value& v) {
+    Values values(d);
+    values.clear();
+    values << v;
 }
 
-std::string Message::getStringId() {
-    confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_STRING) {
-        pn_bytes_t bytes = pn_data_get_string(data);
-        return (std::string(bytes.start, bytes.size));
-    }
-    throw ProtonException(MSG("Message ID is not a string value"));
+Value getValue(pn_data_t* d) {
+    Values values(d);
+    values.rewind();
+    return values.get<Value>();
 }
+} // namespace
 
-void Message::setId(const char *p, size_t len) {
+void Message::id(const Value& id) {
     confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_binary(data, pn_bytes(len, p)))
-        throw ProtonException(MSG("setId error " << err));
+    setValue(pn_message_id(impl), id);
 }
 
-size_t Message::getId(const char **p) {
+Value Message::id() const {
     confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_BINARY) {
-        pn_bytes_t pnb = pn_data_get_binary(data);
-        *p = pnb.start;
-        return pnb.size;
-    }
-    throw ProtonException(MSG("Message ID is not a binary value"));
+    return getValue(pn_message_id(impl));
 }
-
-pn_type_t Message::getIdType() {
+void Message::user(const std::string &id) {
     confirm(impl);
-    pn_data_t *data = pn_message_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data)) {
-        pn_type_t type = pn_data_type(data);
-        switch (type) {
-        case PN_ULONG:
-        case PN_STRING:
-        case PN_BINARY:
-        case PN_UUID:
-            return type;
-            break;
-        default:
-            break;
-        }
-    }
-    return PN_NULL;
+    check(pn_message_set_user_id(impl, pn_bytes(id)));
 }
 
-void Message::setUserId(const std::string &id) {
+std::string Message::user() const {
     confirm(impl);
-    if (int err = pn_message_set_user_id(impl, pn_bytes(id.size(), id.data())))
-        throw ProtonException(MSG("setUserId error " << err));
+    return str(pn_message_get_user_id(impl));
 }
 
-std::string Message::getUserId() {
+void Message::address(const std::string &addr) {
     confirm(impl);
-    pn_bytes_t bytes = pn_message_get_user_id(impl);
-    return (std::string(bytes.start, bytes.size));
+    check(pn_message_set_address(impl, addr.c_str()));
 }
 
-void Message::setAddress(const std::string &addr) {
-    confirm(impl);
-    if (int err = pn_message_set_address(impl, addr.c_str()))
-        throw ProtonException(MSG("setAddress error " << err));
-}
-
-std::string Message::getAddress() {
+std::string Message::address() const {
     confirm(impl);
     const char* addr = pn_message_get_address(impl);
     return addr ? std::string(addr) : std::string();
 }
 
-void Message::setSubject(const std::string &s) {
+void Message::subject(const std::string &s) {
     confirm(impl);
-    if (int err = pn_message_set_subject(impl, s.c_str()))
-        throw ProtonException(MSG("setSubject error " << err));
+    check(pn_message_set_subject(impl, s.c_str()));
 }
 
-std::string Message::getSubject() {
+std::string Message::subject() const {
     confirm(impl);
     const char* s = pn_message_get_subject(impl);
     return s ? std::string(s) : std::string();
 }
 
-void Message::setReplyTo(const std::string &s) {
+void Message::replyTo(const std::string &s) {
     confirm(impl);
-    if (int err = pn_message_set_reply_to(impl, s.c_str()))
-        throw ProtonException(MSG("setReplyTo error " << err));
+    check(pn_message_set_reply_to(impl, s.c_str()));
 }
 
-std::string Message::getReplyTo() {
+std::string Message::replyTo() const {
     confirm(impl);
     const char* s = pn_message_get_reply_to(impl);
     return s ? std::string(s) : std::string();
 }
 
-void Message::setCorrelationId(uint64_t id) {
+void Message::correlationId(const Value& id) {
     confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_ulong(data, id))
-        throw ProtonException(MSG("setCorrelationId error " << err));
+    setValue(pn_message_correlation_id(impl), id);
 }
 
-uint64_t Message::getCorrelationId() {
+Value Message::correlationId() const {
     confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_ULONG) {
-        return pn_data_get_ulong(data);
-    }
-    throw ProtonException(MSG("Correlation ID is not a ULONG"));
+    return getValue(pn_message_correlation_id(impl));
 }
 
-void Message::setCorrelationId(const std::string &id) {
+void Message::contentType(const std::string &s) {
     confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_string(data, pn_bytes(id.size(), id.data())))
-        throw ProtonException(MSG("setCorrelationId error " << err));
-}
-
-std::string Message::getStringCorrelationId() {
-    confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_STRING) {
-        pn_bytes_t bytes = pn_data_get_string(data);
-        return (std::string(bytes.start, bytes.size));
-    }
-    throw ProtonException(MSG("Message ID is not a string value"));
+    check(pn_message_set_content_type(impl, s.c_str()));
 }
 
-void Message::setCorrelationId(const char *p, size_t len) {
-    confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_clear(data);
-    if (int err = pn_data_put_binary(data, pn_bytes(len, p)))
-        throw ProtonException(MSG("setCorrelationId error " << err));
-}
-
-size_t Message::getCorrelationId(const char **p) {
-    confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_BINARY) {
-        pn_bytes_t pnb = pn_data_get_binary(data);
-        *p = pnb.start;
-        return pnb.size;
-    }
-    throw ProtonException(MSG("Message ID is not a binary value"));
-}
-
-pn_type_t Message::getCorrelationIdType() {
-    confirm(impl);
-    pn_data_t *data = pn_message_correlation_id(impl);
-    pn_data_rewind(data);
-    if (pn_data_size(data) == 1 && pn_data_next(data)) {
-        pn_type_t type = pn_data_type(data);
-        switch (type) {
-        case PN_ULONG:
-        case PN_STRING:
-        case PN_BINARY:
-        case PN_UUID:
-            return type;
-            break;
-        default:
-            break;
-        }
-    }
-    return PN_NULL;
-}
-
-void Message::setContentType(const std::string &s) {
-    confirm(impl);
-    if (int err = pn_message_set_content_type(impl, s.c_str()))
-        throw ProtonException(MSG("setContentType error " << err));
-}
-
-std::string Message::getContentType() {
+std::string Message::contentType() const {
     confirm(impl);
     const char* s = pn_message_get_content_type(impl);
     return s ? std::string(s) : std::string();
 }
 
-void Message::setContentEncoding(const std::string &s) {
+void Message::contentEncoding(const std::string &s) {
     confirm(impl);
-    if (int err = pn_message_set_content_encoding(impl, s.c_str()))
-        throw ProtonException(MSG("setContentEncoding error " << err));
+    check(pn_message_set_content_encoding(impl, s.c_str()));
 }
 
-std::string Message::getContentEncoding() {
+std::string Message::contentEncoding() const {
     confirm(impl);
     const char* s = pn_message_get_content_encoding(impl);
     return s ? std::string(s) : std::string();
 }
 
-void Message::setExpiry(pn_timestamp_t t) {
+void Message::expiry(Timestamp t) {
     confirm(impl);
-    pn_message_set_expiry_time(impl, t);
+    pn_message_set_expiry_time(impl, t.milliseconds);
 }
-pn_timestamp_t Message::getExpiry() {
+Timestamp Message::expiry() const {
     confirm(impl);
-    return pn_message_get_expiry_time(impl);
+    return Timestamp(pn_message_get_expiry_time(impl));
 }
 
-void Message::setCreationTime(pn_timestamp_t t) {
+void Message::creationTime(Timestamp t) {
     confirm(impl);
     pn_message_set_creation_time(impl, t);
 }
-pn_timestamp_t Message::getCreationTime() {
+Timestamp Message::creationTime() const {
     confirm(impl);
     return pn_message_get_creation_time(impl);
 }
 
-
-void Message::setGroupId(const std::string &s) {
+void Message::groupId(const std::string &s) {
     confirm(impl);
-    if (int err = pn_message_set_group_id(impl, s.c_str()))
-        throw ProtonException(MSG("setGroupId error " << err));
+    check(pn_message_set_group_id(impl, s.c_str()));
 }
 
-std::string Message::getGroupId() {
+std::string Message::groupId() const {
     confirm(impl);
     const char* s = pn_message_get_group_id(impl);
     return s ? std::string(s) : std::string();
 }
 
-void Message::setReplyToGroupId(const std::string &s) {
+void Message::replyToGroupId(const std::string &s) {
     confirm(impl);
-    if (int err = pn_message_set_reply_to_group_id(impl, s.c_str()))
-        throw ProtonException(MSG("setReplyToGroupId error " << err));
+    check(pn_message_set_reply_to_group_id(impl, s.c_str()));
 }
 
-std::string Message::getReplyToGroupId() {
+std::string Message::replyToGroupId() const {
     confirm(impl);
     const char* s = pn_message_get_reply_to_group_id(impl);
     return s ? std::string(s) : std::string();
 }
 
-
-void Message::setBody(const std::string &buf) {
+void Message::body(const Value& v) {
     confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_clear(body);
-    pn_data_put_string(body, pn_bytes(buf.size(), buf.data()));
+    setValue(pn_message_body(impl), v);
 }
 
-void Message::getBody(std::string &str) {
-    // User supplied string/buffer
+void Message::body(const Values& v) {
     confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_rewind(body);
-
-    if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
-        pn_bytes_t bytes = pn_data_get_string(body);
-        if (!pn_data_next(body)) {
-            // String data and nothing else
-            str.resize(bytes.size);
-            memmove((void *) str.data(), bytes.start, bytes.size);
-            return;
-        }
-    }
-
-    getFormatedStringContent(body, str);
-}
-
-std::string Message::getBody() {
-    confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_rewind(body);
-
-    if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
-        pn_bytes_t bytes= pn_data_get_string(body);
-        if (!pn_data_next(body)) {
-            // String data and nothing else
-            return std::string(bytes.start, bytes.size);
-        }
-    }
-
-    std::string str;
-    getFormatedStringContent(body, str);
-    return str;
-}
-
-void Message::setBody(const char *bytes, size_t len) {
-    confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_clear(body);
-    pn_data_put_binary(body, pn_bytes(len, bytes));
+    pn_data_copy(pn_message_body(impl), v.data);
 }
 
-size_t Message::getBody(char *bytes, size_t len) {
+const Values& Message::body() const {
     confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_rewind(body);
-    if (pn_data_size(body) == 1 && pn_data_next(body) && pn_data_type(body) == PN_BINARY) {
-        pn_bytes_t pnb = pn_data_get_binary(body);
-        if (len >= pnb.size) {
-            memmove(bytes, pnb.start, pnb.size);
-            return pnb.size;
-        }
-        throw ProtonException(MSG("Binary buffer too small"));
-    }
-    throw ProtonException(MSG("Not simple binary data"));
+    body_.view(pn_message_body(impl));
+    return body_;
 }
 
-
-
-size_t Message::getBinaryBodySize() {
+Values& Message::body() {
     confirm(impl);
-    pn_data_t *body = pn_message_body(impl);
-    pn_data_rewind(body);
-    if (pn_data_size(body) == 1 && pn_data_next(body) && pn_data_type(body) == PN_BINARY) {
-        pn_bytes_t bytes = pn_data_get_binary(body);
-        return bytes.size;
-    }
-    return 0;
+    body_.view(pn_message_body(impl));
+    return body_;
 }
 
-
 void Message::encode(std::string &s) {
     confirm(impl);
     size_t sz = s.capacity();
@@ -434,7 +232,7 @@ void Message::encode(std::string &s) {
         int err = pn_message_encode(impl, (char *) s.data(), &sz);
         if (err) {
             if (err != PN_OVERFLOW)
-                throw ProtonException(MSG("unexpected error"));
+                check(err);
         } else {
             s.resize(sz);
             return;
@@ -445,12 +243,11 @@ void Message::encode(std::string &s) {
 
 void Message::decode(const std::string &s) {
     confirm(impl);
-    int err = pn_message_decode(impl, s.data(), s.size());
-    if (err) throw ProtonException(MSG("unexpected error"));
+    check(pn_message_decode(impl, s.data(), s.size()));
 }
 
-pn_message_t *Message::getPnMessage() const {
+pn_message_t *Message::pnMessage() const {
     return impl;
 }
 
-}} // namespace proton::reactor
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index 7c3ba6c..3b4152d 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -21,7 +21,7 @@
 #include "proton/MessagingAdapter.hpp"
 #include "proton/MessagingEvent.hpp"
 #include "proton/Sender.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 
 #include "proton/link.h"
@@ -69,7 +69,7 @@ Message receiveMessage(pn_link_t *lnk, pn_delivery_t *dlv) {
     buf.resize(sz);
     ssize_t n = pn_link_recv(lnk, (char *) buf.data(), sz);
     if (n != (ssize_t) sz)
-        throw ProtonException(MSG("link read failure"));
+        throw Error(MSG("link read failure"));
     Message m;
     m. decode(buf);
     pn_link_advance(lnk);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/MessagingEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingEvent.cpp b/proton-c/bindings/cpp/src/MessagingEvent.cpp
index fc20e2b..083180a 100644
--- a/proton-c/bindings/cpp/src/MessagingEvent.cpp
+++ b/proton-c/bindings/cpp/src/MessagingEvent.cpp
@@ -27,7 +27,7 @@
 #include "proton/Message.hpp"
 #include "proton/ProtonHandler.hpp"
 #include "proton/MessagingHandler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 #include "contexts.hpp"
 
@@ -41,7 +41,7 @@ MessagingEvent::MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c)
 MessagingEvent::MessagingEvent(MessagingEventType_t t, ProtonEvent &p) :
     ProtonEvent(NULL, PN_EVENT_NONE, p.getContainer()), messagingType(t), parentEvent(&p), message(0) {
     if (messagingType == PN_MESSAGING_PROTON)
-        throw ProtonException(MSG("invalid messaging event type"));
+        throw Error(MSG("invalid messaging event type"));
 }
 
 MessagingEvent::~MessagingEvent() {
@@ -53,7 +53,7 @@ Connection &MessagingEvent::getConnection() {
         return ProtonEvent::getConnection();
     if (parentEvent)
         return parentEvent->getConnection();
-    throw ProtonException(MSG("No connection context for event"));
+    throw Error(MSG("No connection context for event"));
 }
 
 Sender MessagingEvent::getSender() {
@@ -61,7 +61,7 @@ Sender MessagingEvent::getSender() {
         return ProtonEvent::getSender();
     if (parentEvent)
         return parentEvent->getSender();
-    throw ProtonException(MSG("No sender context for event"));
+    throw Error(MSG("No sender context for event"));
 }
 
 Receiver MessagingEvent::getReceiver() {
@@ -69,7 +69,7 @@ Receiver MessagingEvent::getReceiver() {
         return ProtonEvent::getReceiver();
     if (parentEvent)
         return parentEvent->getReceiver();
-    throw ProtonException(MSG("No receiver context for event"));
+    throw Error(MSG("No receiver context for event"));
 }
 
 Link MessagingEvent::getLink() {
@@ -77,7 +77,7 @@ Link MessagingEvent::getLink() {
         return ProtonEvent::getLink();
     if (parentEvent)
         return parentEvent->getLink();
-    throw ProtonException(MSG("No link context for event"));
+    throw Error(MSG("No link context for event"));
 }
 
 Message MessagingEvent::getMessage() {
@@ -86,13 +86,13 @@ Message MessagingEvent::getMessage() {
         if (m)
             return Message(m);
     }
-    throw ProtonException(MSG("No message context for event"));
+    throw Error(MSG("No message context for event"));
 }
 
 void MessagingEvent::setMessage(Message &m) {
     if (messagingType != PN_MESSAGING_MESSAGE || !parentEvent)
-        throw ProtonException(MSG("Event type does not provide message"));
-    setEventContext(parentEvent->getPnEvent(), m.getPnMessage());
+        throw Error(MSG("Event type does not provide message"));
+    setEventContext(parentEvent->getPnEvent(), m.pnMessage());
 }
 
 void MessagingEvent::dispatch(Handler &h) {
@@ -133,7 +133,7 @@ void MessagingEvent::dispatch(Handler &h) {
 
         case PN_MESSAGING_TRANSPORT_CLOSED:       handler->onTransportClosed(*this); break;
         default:
-            throw ProtonException(MSG("Unkown messaging event type " << messagingType));
+            throw Error(MSG("Unkown messaging event type " << messagingType));
             break;
         }
     } else {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/ProtonEvent.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonEvent.cpp b/proton-c/bindings/cpp/src/ProtonEvent.cpp
index 4567ea7..8d32f35 100644
--- a/proton-c/bindings/cpp/src/ProtonEvent.cpp
+++ b/proton-c/bindings/cpp/src/ProtonEvent.cpp
@@ -25,7 +25,7 @@
 
 #include "proton/ProtonEvent.hpp"
 #include "proton/ProtonHandler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "proton/Container.hpp"
 
 #include "ConnectionImpl.hpp"
@@ -50,7 +50,7 @@ Container &ProtonEvent::getContainer() { return container; }
 Connection &ProtonEvent::getConnection() {
     pn_connection_t *conn = pn_event_connection(getPnEvent());
     if (!conn)
-        throw ProtonException(MSG("No connection context for this event"));
+        throw Error(MSG("No connection context for this event"));
     return ConnectionImpl::getReactorReference(conn);
 }
 
@@ -58,14 +58,14 @@ Sender ProtonEvent::getSender() {
     pn_link_t *lnk = pn_event_link(getPnEvent());
     if (lnk && pn_link_is_sender(lnk))
         return Sender(lnk);
-    throw ProtonException(MSG("No sender context for this event"));
+    throw Error(MSG("No sender context for this event"));
 }
 
 Receiver ProtonEvent::getReceiver() {
     pn_link_t *lnk = pn_event_link(getPnEvent());
     if (lnk && pn_link_is_receiver(lnk))
         return Receiver(lnk);
-    throw ProtonException(MSG("No receiver context for this event"));
+    throw Error(MSG("No receiver context for this event"));
 }
 
 Link ProtonEvent::getLink() {
@@ -76,7 +76,7 @@ Link ProtonEvent::getLink() {
         else
             return Receiver(lnk);
     }
-    throw ProtonException(MSG("No link context for this event"));
+    throw Error(MSG("No link context for this event"));
 }
 
 
@@ -136,7 +136,7 @@ void ProtonEvent::dispatch(Handler &h) {
         case PN_SELECTABLE_ERROR: handler->onSelectableError(*this); break;
         case PN_SELECTABLE_FINAL: handler->onSelectableFinal(*this); break;
         default:
-            throw ProtonException(MSG("Invalid Proton event type " << type));
+            throw Error(MSG("Invalid Proton event type " << type));
             break;
         }
     } else {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Receiver.cpp b/proton-c/bindings/cpp/src/Receiver.cpp
index d148372..b46ab87 100644
--- a/proton-c/bindings/cpp/src/Receiver.cpp
+++ b/proton-c/bindings/cpp/src/Receiver.cpp
@@ -20,7 +20,7 @@
  */
 #include "proton/Link.hpp"
 #include "proton/Receiver.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 
 #include "proton/connection.h"
@@ -38,7 +38,7 @@ Receiver::Receiver(const Link& c) : Link(c.getPnLink()) {}
 
 void Receiver::verifyType(pn_link_t *lnk) {
     if (lnk && pn_link_is_sender(lnk))
-        throw ProtonException(MSG("Creating receiver with sender context"));
+        throw Error(MSG("Creating receiver with sender context"));
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
index 8c2e414..11fa3c8 100644
--- a/proton-c/bindings/cpp/src/Sender.cpp
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -20,7 +20,7 @@
  */
 #include "proton/Link.hpp"
 #include "proton/Sender.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 #include "contexts.hpp"
 
@@ -43,7 +43,7 @@ Sender::Sender() : Link(0) {}
 
 void Sender::verifyType(pn_link_t *lnk) {
     if (lnk && pn_link_is_receiver(lnk))
-        throw ProtonException(MSG("Creating sender with receiver context"));
+        throw Error(MSG("Creating sender with receiver context"));
 }
 
 Sender::Sender(const Link& c) : Link(c.getPnLink()) {}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Url.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.cpp b/proton-c/bindings/cpp/src/Url.cpp
index 80020fb..60ab58d 100644
--- a/proton-c/bindings/cpp/src/Url.cpp
+++ b/proton-c/bindings/cpp/src/Url.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Url.hpp"
 #include "ProtonImplRef.hpp"
 #include "Msg.hpp"
@@ -35,7 +35,7 @@ Url::Url(const std::string &url) {
     pn_url_t *up = pn_url_parse(url.c_str());
     // refcount is 1, no need to incref
     if (!up)
-        throw ProtonException(MSG("invalid URL: " << url));
+        throw Error(MSG("invalid URL: " << url));
     impl = up;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Value.cpp b/proton-c/bindings/cpp/src/Value.cpp
index 6d0a55c..cf41175 100644
--- a/proton-c/bindings/cpp/src/Value.cpp
+++ b/proton-c/bindings/cpp/src/Value.cpp
@@ -24,11 +24,11 @@
 #include <algorithm>
 
 namespace proton {
-namespace reactor {
 
 Value::Value() { *this = Null(); }
 Value::Value(const Value& v) { *this = v; }
 Value::~Value() {}
+
 Value& Value::operator=(const Value& v) { values = v.values; return *this; }
 
 TypeId Value::type() const {
@@ -39,7 +39,7 @@ TypeId Value::type() const {
 namespace {
 template <class T> T check(T result) {
     if (result < 0)
-        throw Encoder::Error("encode: " + errorStr(result));
+        throw EncodeError("encode: " + errorStr(result));
     return result;
 }
 }
@@ -133,4 +133,4 @@ bool Value::operator<(const Value& v) const {
     return compareNext(values, v.values) < 0;
 }
 
-}}
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/Values.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Values.cpp b/proton-c/bindings/cpp/src/Values.cpp
index fadfacf..95e5784 100644
--- a/proton-c/bindings/cpp/src/Values.cpp
+++ b/proton-c/bindings/cpp/src/Values.cpp
@@ -23,10 +23,11 @@
 #include <ostream>
 
 namespace proton {
-namespace reactor {
 
 Values::Values() {}
 Values::Values(const Values& v) { *this = v; }
+Values::Values(pn_data_t* d) : Data(d) {}
+
 Values::~Values() {}
 Values& Values::operator=(const Values& v) { Data::operator=(v); return *this; }
 
@@ -36,4 +37,4 @@ std::ostream& operator<<(std::ostream& o, const Values& v) {
     return o << static_cast<const Encoder&>(v);
 }
 
-}}
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
index 95499d6..3e57b91 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
@@ -22,7 +22,7 @@
 #include "proton/BlockingConnection.hpp"
 #include "proton/BlockingSender.hpp"
 #include "proton/MessagingHandler.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 #include "BlockingConnectionImpl.hpp"
 #include "PrivateImplRef.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
index 7bb1261..912f11f 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
@@ -21,7 +21,7 @@
 #include "proton/Container.hpp"
 #include "proton/MessagingHandler.hpp"
 #include "proton/Duration.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "proton/WaitCondition.hpp"
 #include "BlockingConnectionImpl.hpp"
 #include "Msg.hpp"
@@ -98,10 +98,10 @@ void BlockingConnectionImpl::wait(WaitCondition &condition, std::string &msg, Du
 
     pn_reactor_t *reactor = container.getReactor();
     pn_millis_t origTimeout = pn_reactor_get_timeout(reactor);
-    pn_reactor_set_timeout(reactor, waitTimeout.getMilliseconds());
+    pn_reactor_set_timeout(reactor, waitTimeout.milliseconds);
     try {
         pn_timestamp_t now = pn_reactor_mark(reactor);
-        pn_timestamp_t deadline = now + waitTimeout.getMilliseconds();
+        pn_timestamp_t deadline = now + waitTimeout.milliseconds;
         while (!condition.achieved()) {
             container.process();
             if (deadline < pn_reactor_mark(reactor)) {
@@ -109,7 +109,7 @@ void BlockingConnectionImpl::wait(WaitCondition &condition, std::string &msg, Du
                 if (!msg.empty())
                     txt += ": " + msg;
                 // TODO: proper Timeout exception
-                throw ProtonException(MSG(txt));
+                throw Error(MSG(txt));
             }
         }
     } catch (...) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
index 9dfc844..afc5f35 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
@@ -22,7 +22,7 @@
 #include "proton/BlockingConnection.hpp"
 #include "proton/MessagingHandler.hpp"
 #include "proton/WaitCondition.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 
 
@@ -72,7 +72,7 @@ void BlockingLink::checkClosed() {
     if (pn_link_state(pnLink) & PN_REMOTE_CLOSED) {
         link.close();
         // TODO: LinkDetached exception
-        throw ProtonException(MSG("Link detached"));
+        throw Error(MSG("Link detached"));
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
index ac37477..7a24324 100644
--- a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
+++ b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
@@ -21,7 +21,7 @@
 #include "proton/BlockingSender.hpp"
 #include "proton/BlockingConnection.hpp"
 #include "proton/WaitCondition.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 
 
@@ -45,7 +45,7 @@ BlockingSender::BlockingSender(BlockingConnection &c, Sender &l) : BlockingLink(
         waitForClosed();
         link.close();
         std::string txt = "Failed to open sender " + link.getName() + ", target does not match";
-        throw ProtonException(MSG("Container not started"));
+        throw Error(MSG("Container not started"));
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
index 28f4778..fd2f3e1 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "contexts.hpp"
-#include "proton/exceptions.hpp"
+#include "proton/Error.hpp"
 #include "Msg.hpp"
 #include "proton/object.h"
 #include "proton/message.h"
@@ -55,7 +55,7 @@ void setContainerContext(pn_reactor_t *pnReactor, ContainerImpl *container) {
 ContainerImpl *getContainerContext(pn_reactor_t *pnReactor) {
     pn_record_t *record = pn_reactor_attachments(pnReactor);
     ContainerImpl *p = (ContainerImpl *) pn_record_get(record, PNI_CPP_CONTAINER_CONTEXT);
-    if (!p) throw ProtonException(MSG("Reactor has no C++ container context"));
+    if (!p) throw Error(MSG("Reactor has no C++ container context"));
     return p;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index 122e983..db309f7 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -30,6 +30,7 @@
 #include <unistd.h>
 
 using namespace std;
+using namespace proton;
 using namespace proton::reactor;
 
 std::string testsDir;
@@ -66,22 +67,22 @@ void testDataOstream() {
 void testDecoderPrimitvesExact() {
     Decoder d(read("primitives"));
     ASSERT(d.more());
-    try { get<int8_t>(d); FAIL("got bool as byte"); } catch(Decoder::Error){}
+    try { get<int8_t>(d); FAIL("got bool as byte"); } catch(DecodeError){}
     ASSERT_EQUAL(true, get<bool>(d));
     ASSERT_EQUAL(false, get<bool>(d));
-    try { get<int8_t>(d); FAIL("got ubyte as byte"); } catch(Decoder::Error){}
+    try { get<int8_t>(d); FAIL("got ubyte as byte"); } catch(DecodeError){}
     ASSERT_EQUAL(42, get<uint8_t>(d));
-    try { get<int32_t>(d); FAIL("got uint as ushort"); } catch(Decoder::Error){}
+    try { get<int32_t>(d); FAIL("got uint as ushort"); } catch(DecodeError){}
     ASSERT_EQUAL(42, get<uint16_t>(d));
-    try { get<uint16_t>(d); FAIL("got short as ushort"); } catch(Decoder::Error){}
+    try { get<uint16_t>(d); FAIL("got short as ushort"); } catch(DecodeError){}
     ASSERT_EQUAL(-42, get<int16_t>(d));
     ASSERT_EQUAL(12345, get<uint32_t>(d));
     ASSERT_EQUAL(-12345, get<int32_t>(d));
     ASSERT_EQUAL(12345, get<uint64_t>(d));
     ASSERT_EQUAL(-12345, get<int64_t>(d));
-    try { get<double>(d); FAIL("got float as double"); } catch(Decoder::Error){}
+    try { get<double>(d); FAIL("got float as double"); } catch(DecodeError){}
     ASSERT_EQUAL(0.125, get<float>(d));
-    try { get<float>(d); FAIL("got double as float"); } catch(Decoder::Error){}
+    try { get<float>(d); FAIL("got double as float"); } catch(DecodeError){}
     ASSERT_EQUAL(0.125, get<double>(d));
     ASSERT(!d.more());
 }
@@ -109,8 +110,8 @@ void testValueConversions() {
     ASSERT_EQUAL(3, long(v=Byte(3)));
     ASSERT_EQUAL(1.0, double(v=Float(1.0)));
     ASSERT_EQUAL(1.0, float(v=Double(1.0)));
-    try { bool(v = Byte(1)); FAIL("got byte as bool"); } catch (Decoder::Error) {}
-    try { float(v = true); FAIL("got bool as float"); } catch (Decoder::Error) {}
+    try { bool(v = Byte(1)); FAIL("got byte as bool"); } catch (DecodeError) {}
+    try { float(v = true); FAIL("got bool as float"); } catch (DecodeError) {}
 }
 
 int run_test(void (*testfn)(), const char* name) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/proton_bits.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp
index 6a85b1d..e06589c 100644
--- a/proton-c/bindings/cpp/src/proton_bits.cpp
+++ b/proton-c/bindings/cpp/src/proton_bits.cpp
@@ -47,7 +47,7 @@ std::string errorStr(pn_error_t* err, int code) {
     return errorStr(code);
 }
 
-std::ostream& operator<<(std::ostream& o, const Object& object) {
+std::ostream& operator<<(std::ostream& o, const PnObject& object) {
     pn_string_t* str = pn_string("");
     pn_inspect(object.value, str);
     o << pn_string_get(str);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
index e57f188..55c6473 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -33,10 +33,10 @@ std::string errorStr(int code);
 std::string errorStr(pn_error_t*, int code=0);
 
 /** Wrapper for a proton object pointer. */
-struct Object { void* value; Object(void* o) : value(o) {} };
+struct PnObject { void* value; PnObject(void* o) : value(o) {} };
 
 /** Stream a proton object via pn_inspect. */
-std::ostream& operator<<(std::ostream& o, const Object& object);
+std::ostream& operator<<(std::ostream& o, const PnObject& object);
 
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/327f358e/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
index 1998b97..593d052 100644
--- a/proton-c/bindings/cpp/src/types.cpp
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -22,7 +22,6 @@
 #include <ostream>
 
 namespace proton {
-namespace reactor {
 
 std::string typeName(TypeId t) {
     switch (t) {
@@ -66,6 +65,8 @@ pn_bytes_t pn_bytes(const std::string& s) {
     return b;
 }
 
+std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+
 pn_uuid_t pn_uuid(const std::string& s) {
     pn_uuid_t u = {0};          // Zero initialized.
     std::copy(s.begin(), s.begin() + std::max(s.size(), sizeof(pn_uuid_t::bytes)), &u.bytes[0]);
@@ -78,4 +79,4 @@ Start Start::list() { return Start(LIST); }
 Start Start::map() { return Start(MAP); }
 Start Start::described() { return Start(DESCRIBED, NULL_, true); }
 
-}}
+}


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


[07/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Handler mixin to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Handler mixin to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 4b2232722b26e4e8d6207a97b0a5cad01fc8e61d
Parents: 44ad0ff
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 08:06:19 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb  |  1 +
 proton-c/bindings/ruby/lib/util/handler.rb | 41 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b223272/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 0c84f20..03f5632 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -41,6 +41,7 @@ require "util/class_wrapper"
 require "util/engine"
 require "util/uuid"
 require "util/timeout"
+require "util/handler"
 
 # Types
 require "types/strings"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4b223272/proton-c/bindings/ruby/lib/util/handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/handler.rb b/proton-c/bindings/ruby/lib/util/handler.rb
new file mode 100644
index 0000000..e7d07b1
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/util/handler.rb
@@ -0,0 +1,41 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Util
+
+  # @private
+  module Handler
+
+    def chandler(handler, on_error)
+      return nil if handler.nil?
+
+      if handler.instance_of?(Qpid::Proton::Handler::WrappedHandler)
+        impl = handler.impl
+        Cproton.pn_incref(impl)
+        return impl
+      else
+        cadaptor = Qpid::Proton::Handler::CAdaptor.new(handler, on_error)
+        rbhandler = Cproton.pn_rbhandler(cadaptor)
+        return rbhandler
+      end
+    end
+
+  end
+
+end


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


[25/50] [abbrv] qpid-proton git commit: PROTON-781: Added the set of LinkOption classes to Ruby.

Posted by ac...@apache.org.
PROTON-781: Added the set of LinkOption classes to Ruby.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 56bf2c25d0da859869741a169027533a0a9e5bf7
Parents: 1ea8561
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon May 4 13:26:26 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  1 +
 .../bindings/ruby/lib/reactor/link_option.rb    | 90 ++++++++++++++++++++
 2 files changed, 91 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56bf2c25/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index ba1e66e..1d614a4 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -107,6 +107,7 @@ require "reactor/connector"
 require "reactor/backoff"
 require "reactor/session_per_connection"
 require "reactor/container"
+require "reactor/link_option"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56bf2c25/proton-c/bindings/ruby/lib/reactor/link_option.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/link_option.rb b/proton-c/bindings/ruby/lib/reactor/link_option.rb
new file mode 100644
index 0000000..628a811
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/link_option.rb
@@ -0,0 +1,90 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class LinkOption
+    def apply(link)
+    end
+
+    # Subclasses should override this to selectively apply an option.
+    def test(link)
+      true
+    end
+  end
+
+  class AtMostOne < LinkOption
+    def apply(link)
+      link.snd_settle_mod = Link::SND_SETTLED
+    end
+  end
+
+  class AtLeastOnce < LinkOption
+    def apply(link)
+      link.snd_settle_mode = Link::SND_UNSETTLED
+      link.rcv_settle_mode = Link::RCV_FIRST
+    end
+  end
+
+  class SenderOption < LinkOption
+    def test(link)
+      link.sender?
+    end
+  end
+
+  class ReceiverOption < LinkOption
+    def test(link)
+      link.receiver?
+    end
+  end
+
+  class DynamicNodeProperties < LinkOption
+    def initialize(properties = {})
+      @properties = []
+      properties.each do |property|
+        @properties << property.to_sym
+      end
+    end
+
+    def apply(link)
+      if link.receiver?
+        link.source.properties.dict = @properties
+      else
+        link.target.properties.dict = @properties
+      end
+    end
+  end
+
+  class Filter < ReceiverOption
+    def initialize(filter_set = {})
+      @filter_set = filter_set
+    end
+
+    def apply(receiver)
+      receiver.source.filter.dict = @filter_set
+    end
+  end
+
+  #class Selector < Filter
+  #  def initialize(value, name = 'selector')
+  #
+  #  end
+  #end
+
+end


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


[49/50] [abbrv] qpid-proton git commit: PROTON-865: Fix extern declarations and other windows portability issues.

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/include/proton/types.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp
index 62b2f53..d3cdd27 100644
--- a/proton-c/bindings/cpp/include/proton/types.hpp
+++ b/proton-c/bindings/cpp/include/proton/types.hpp
@@ -19,14 +19,33 @@
  * under the License.
  */
 
+#include "proton/export.hpp"
 #include <proton/codec.h>
-#include "proton/ImportExport.hpp"
 #include <algorithm>
 #include <bitset>
 #include <string>
-#include <stdint.h>
 #include <memory.h>
 
+// Workaround for older C++ compilers
+#if  defined(__cplusplus) && __cplusplus >= 201100
+#include <cstdint>
+
+#else  // Workaround for older C++ compilers
+
+#include <proton/type_compat.h>
+namespace std {
+// Exact-size integer types.
+using ::int8_t;
+using ::int16_t;
+using ::int32_t;
+using ::int64_t;
+using ::uint8_t;
+using ::uint16_t;
+using ::uint32_t;
+using ::uint64_t;
+}
+#endif
+
 /**@file
  * C++ types representing AMQP types.
  * @ingroup cpp
@@ -34,7 +53,6 @@
 
 namespace proton {
 
-
 /** TypeId identifies an AMQP type */
 enum TypeId {
     NULL_=PN_NULL,              ///< The null type, contains no data.
@@ -84,26 +102,26 @@ template<class T> bool operator!=(const Comparable<T>& a, const Comparable<T>& b
  */
 struct Null {};
 typedef bool Bool;
-typedef uint8_t Ubyte;
-typedef int8_t Byte;
-typedef uint16_t Ushort;
-typedef int16_t Short;
-typedef uint32_t Uint;
-typedef int32_t Int;
+typedef std::uint8_t Ubyte;
+typedef std::int8_t Byte;
+typedef std::uint16_t Ushort;
+typedef std::int16_t Short;
+typedef std::uint32_t Uint;
+typedef std::int32_t Int;
 typedef wchar_t Char;
-typedef uint64_t Ulong;
-typedef int64_t Long;
+typedef std::uint64_t Ulong;
+typedef std::int64_t Long;
 typedef float Float;
 typedef double Double;
 
 ///@internal
-pn_bytes_t pn_bytes(const std::string&);
+PN_CPP_EXTERN pn_bytes_t pn_bytes(const std::string&);
 //@internal
-std::string str(const pn_bytes_t& b);
+PN_CPP_EXTERN std::string str(const pn_bytes_t& b);
 
 ///@internal
 #define STRING_LIKE(NAME)                                               \
-    PN_CPP_EXTERN struct NAME : public std::string{                     \
+    struct NAME : public std::string{                     \
         NAME(const std::string& s=std::string()) : std::string(s) {}    \
         NAME(const char* s) : std::string(s) {}    \
         NAME(const pn_bytes_t& b) : std::string(b.start, b.size) {}     \
@@ -117,36 +135,53 @@ STRING_LIKE(Symbol);
 /** Binary data */
 STRING_LIKE(Binary);
 
-///@internal
-pn_uuid_t pn_uuid(const std::string&);
-
-/** UUID is represented as a string but treated as if it always has 16 bytes. */
-PN_CPP_EXTERN struct Uuid : public std::string{
-    Uuid(const std::string& s=std::string()) : std::string(s) {}
-    Uuid(const pn_uuid_t& u) : std::string(&u.bytes[0], sizeof(pn_uuid_t::bytes)) {}
-    operator pn_uuid_t() const { return pn_uuid(*this); }
-};
-
 // TODO aconway 2015-06-11: alternative representation of variable-length data
-// as pointer to existing buffers.
+// as pointer to existing buffer.
+
+/** Array of 16 bytes representing a UUID */
+struct Uuid : public Comparable<Uuid> { // FIXME aconway 2015-06-18: std::array in C++11
+  public:
+    static const size_t SIZE = 16;
+
+    PN_CPP_EXTERN Uuid();
+    PN_CPP_EXTERN Uuid(const pn_uuid_t& u);
+    PN_CPP_EXTERN operator pn_uuid_t() const;
+    PN_CPP_EXTERN bool operator==(const Uuid&) const;
+    PN_CPP_EXTERN bool operator<(const Uuid&) const;
+
+    char* begin() { return bytes; }
+    const char* begin() const { return bytes; }
+    char* end() { return bytes + SIZE; }
+    const char* end() const { return bytes + SIZE; }
+    char& operator[](size_t i) { return bytes[i]; }
+    const char& operator[](size_t i) const { return bytes[i]; }
+    size_t size() const { return SIZE; }
+
+    // Human-readable representation.
+  friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const Uuid&);
+  private:
+    char bytes[SIZE];
+};
 
 // TODO aconway 2015-06-16: usable representation of decimal types.
+/**@internal*/
 template <class T> struct Decimal : public Comparable<Decimal<T> > {
     char value[sizeof(T)];
     Decimal() { ::memset(value, 0, sizeof(T)); }
     Decimal(const T& v) { ::memcpy(value, &v, sizeof(T)); }
-    operator T() const { return *reinterpret_cast<const T*>(value); }
+    operator T() const { T x; ::memcpy(&x, value, sizeof(T)); return x; }
     bool operator<(const Decimal<T>& x) {
         return std::lexicographical_compare(value, value+sizeof(T), x.value, x.value+sizeof(T));
     }
 };
+
 typedef Decimal<pn_decimal32_t> Decimal32;
 typedef Decimal<pn_decimal64_t> Decimal64;
 typedef Decimal<pn_decimal128_t> Decimal128;
 
-PN_CPP_EXTERN struct Timestamp : public Comparable<Timestamp> {
+struct Timestamp : public Comparable<Timestamp> {
     pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
-    Timestamp(int64_t ms=0) : milliseconds(ms) {}
+    Timestamp(std::int64_t ms=0) : milliseconds(ms) {}
     operator pn_timestamp_t() const { return milliseconds; }
     bool operator==(const Timestamp& x) { return milliseconds == x.milliseconds; }
     bool operator<(const Timestamp& x) { return milliseconds < x.milliseconds; }
@@ -154,29 +189,6 @@ PN_CPP_EXTERN struct Timestamp : public Comparable<Timestamp> {
 
 ///@}
 
-template <class T> struct TypeIdOf {};
-template<> struct TypeIdOf<Null> { static const TypeId value=NULL_; };
-template<> struct TypeIdOf<Bool> { static const TypeId value=BOOL; };
-template<> struct TypeIdOf<Ubyte> { static const TypeId value=UBYTE; };
-template<> struct TypeIdOf<Byte> { static const TypeId value=BYTE; };
-template<> struct TypeIdOf<Ushort> { static const TypeId value=USHORT; };
-template<> struct TypeIdOf<Short> { static const TypeId value=SHORT; };
-template<> struct TypeIdOf<Uint> { static const TypeId value=UINT; };
-template<> struct TypeIdOf<Int> { static const TypeId value=INT; };
-template<> struct TypeIdOf<Char> { static const TypeId value=CHAR; };
-template<> struct TypeIdOf<Ulong> { static const TypeId value=ULONG; };
-template<> struct TypeIdOf<Long> { static const TypeId value=LONG; };
-template<> struct TypeIdOf<Timestamp> { static const TypeId value=TIMESTAMP; };
-template<> struct TypeIdOf<Float> { static const TypeId value=FLOAT; };
-template<> struct TypeIdOf<Double> { static const TypeId value=DOUBLE; };
-template<> struct TypeIdOf<Decimal32> { static const TypeId value=DECIMAL32; };
-template<> struct TypeIdOf<Decimal64> { static const TypeId value=DECIMAL64; };
-template<> struct TypeIdOf<Decimal128> { static const TypeId value=DECIMAL128; };
-template<> struct TypeIdOf<Uuid> { static const TypeId value=UUID; };
-template<> struct TypeIdOf<Binary> { static const TypeId value=BINARY; };
-template<> struct TypeIdOf<String> { static const TypeId value=STRING; };
-template<> struct TypeIdOf<Symbol> { static const TypeId value=SYMBOL; };
-
 template<class T, TypeId A> struct TypePair {
     typedef T CppType;
     TypeId type;
@@ -193,6 +205,20 @@ template<class T, TypeId A> struct CRef : public TypePair<T, A> {
     const T& value;
 };
 
+/** A holder for AMQP values. A holder is always encoded/decoded as its AmqpValue, no need
+ * for the as<TYPE>() helper functions.
+ *
+ * For example to encode an array of arrays using std::vector:
+ *
+ *     typedef Holder<std::vector<String>, ARRAY> Inner;
+ *     typedef Holder<std::vector<Inner>, ARRAY> Outer;
+ *     Outer o ...
+ *     encoder << o;
+ */
+template<class T, TypeId A> struct Holder : public TypePair<T, A> {
+    T value;
+};
+
 /** Create a reference to value as AMQP type A for decoding. For example to decode an array of Int:
  *
  *     std::vector<Int> v;
@@ -213,9 +239,6 @@ PN_CPP_EXTERN std::string typeName(TypeId);
 /** Print the name of a type */
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, TypeId);
 
-/** Return the name of a type from a class. */
-PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
-
 /** Information needed to start extracting or inserting a container type.
  *
  * With a decoder you can use `Start s = decoder.start()` or `Start s; decoder > s`
@@ -224,29 +247,29 @@ PN_CPP_EXTERN template<class T> std::string typeName() { return typeName(TypeIdO
  * With an encoder use one of the member functions startArray, startList, startMap or startDescribed
  * to create an appropriate Start value, e.g. `encoder << startList() << ...`
  */
-PN_CPP_EXTERN struct Start {
-    Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0);
+struct Start {
+    PN_CPP_EXTERN Start(TypeId type=NULL_, TypeId element=NULL_, bool described=false, size_t size=0);
     TypeId type;            ///< The container type: ARRAY, LIST, MAP or DESCRIBED.
     TypeId element;         ///< the element type for array only.
     bool isDescribed;       ///< true if first value is a descriptor.
     size_t size;            ///< the element count excluding the descriptor (if any)
 
     /** Return a Start for an array */
-    static Start array(TypeId element, bool described=false);
+    PN_CPP_EXTERN static Start array(TypeId element, bool described=false);
     /** Return a Start for a list */
-    static Start list();
+    PN_CPP_EXTERN static Start list();
     /** Return a Start for a map */
-    static Start map();
+    PN_CPP_EXTERN static Start map();
     /** Return a Start for a described type */
-    static Start described();
+    PN_CPP_EXTERN static Start described();
 };
 
 /** Finish insterting or extracting a container value. */
-PN_CPP_EXTERN struct Finish {};
+struct Finish {};
 inline Finish finish() { return Finish(); }
 
 /** Skip a value */
-PN_CPP_EXTERN struct Skip{};
+struct Skip{};
 inline Skip skip() { return Skip(); }
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/BlockingConnection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/BlockingConnection.cpp b/proton-c/bindings/cpp/src/BlockingConnection.cpp
new file mode 100644
index 0000000..3e57b91
--- /dev/null
+++ b/proton-c/bindings/cpp/src/BlockingConnection.cpp
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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/BlockingConnection.hpp"
+#include "proton/BlockingSender.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Error.hpp"
+#include "Msg.hpp"
+#include "BlockingConnectionImpl.hpp"
+#include "PrivateImplRef.hpp"
+
+namespace proton {
+namespace reactor {
+
+template class Handle<BlockingConnectionImpl>;
+typedef PrivateImplRef<BlockingConnection> PI;
+
+BlockingConnection::BlockingConnection() {PI::ctor(*this, 0); }
+
+BlockingConnection::BlockingConnection(const BlockingConnection& c) : Handle<BlockingConnectionImpl>() { PI::copy(*this, c); }
+
+BlockingConnection& BlockingConnection::operator=(const BlockingConnection& c) { return PI::assign(*this, c); }
+BlockingConnection::~BlockingConnection() { PI::dtor(*this); }
+
+BlockingConnection::BlockingConnection(std::string &url, Duration d, SslDomain *ssld, Container *c) {
+    BlockingConnectionImpl *cimpl = new BlockingConnectionImpl(url, d,ssld, c);
+    PI::ctor(*this, cimpl);
+}
+
+void BlockingConnection::close() { impl->close(); }
+
+void BlockingConnection::wait(WaitCondition &cond) { return impl->wait(cond); }
+void BlockingConnection::wait(WaitCondition &cond, std::string &msg, Duration timeout) {
+    return impl->wait(cond, msg, timeout);
+}
+
+BlockingSender BlockingConnection::createSender(std::string &address, Handler *h) {
+    Sender sender = impl->container.createSender(impl->connection, address, h);
+    return BlockingSender(*this, sender);
+}
+
+Duration BlockingConnection::getTimeout() { return impl->getTimeout(); }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/BlockingConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/BlockingConnectionImpl.cpp b/proton-c/bindings/cpp/src/BlockingConnectionImpl.cpp
new file mode 100644
index 0000000..912f11f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/BlockingConnectionImpl.cpp
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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/MessagingHandler.hpp"
+#include "proton/Duration.hpp"
+#include "proton/Error.hpp"
+#include "proton/WaitCondition.hpp"
+#include "BlockingConnectionImpl.hpp"
+#include "Msg.hpp"
+#include "contexts.hpp"
+
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+WaitCondition::~WaitCondition() {}
+
+
+void BlockingConnectionImpl::incref(BlockingConnectionImpl *impl) {
+    impl->refCount++;
+}
+
+void BlockingConnectionImpl::decref(BlockingConnectionImpl *impl) {
+    impl->refCount--;
+    if (impl->refCount == 0)
+        delete impl;
+}
+
+namespace {
+struct ConnectionOpening : public WaitCondition {
+    ConnectionOpening(pn_connection_t *c) : pnConnection(c) {}
+    bool achieved() { return (pn_connection_state(pnConnection) & PN_REMOTE_UNINIT); }
+    pn_connection_t *pnConnection;
+};
+
+struct ConnectionClosed : public WaitCondition {
+    ConnectionClosed(pn_connection_t *c) : pnConnection(c) {}
+    bool achieved() { return !(pn_connection_state(pnConnection) & PN_REMOTE_ACTIVE); }
+    pn_connection_t *pnConnection;
+};
+
+}
+
+
+BlockingConnectionImpl::BlockingConnectionImpl(std::string &u, Duration timeout0, SslDomain *ssld, Container *c)
+    : url(u), timeout(timeout0), refCount(0)
+{
+    if (c)
+        container = *c;
+    container.start();
+    container.setTimeout(timeout);
+    // Create connection and send the connection events here
+    connection = container.connect(url, static_cast<Handler *>(this));
+    ConnectionOpening cond(connection.getPnConnection());
+    wait(cond);
+}
+
+BlockingConnectionImpl::~BlockingConnectionImpl() {
+    container = Container();
+}
+
+void BlockingConnectionImpl::close() {
+    connection.close();
+    ConnectionClosed cond(connection.getPnConnection());
+    wait(cond);
+}
+
+void BlockingConnectionImpl::wait(WaitCondition &condition) {
+    std::string empty;
+    wait(condition, empty, timeout);
+}
+
+void BlockingConnectionImpl::wait(WaitCondition &condition, std::string &msg, Duration waitTimeout) {
+    if (waitTimeout == Duration::FOREVER) {
+        while (!condition.achieved()) {
+            container.process();
+        }
+    }
+
+    pn_reactor_t *reactor = container.getReactor();
+    pn_millis_t origTimeout = pn_reactor_get_timeout(reactor);
+    pn_reactor_set_timeout(reactor, waitTimeout.milliseconds);
+    try {
+        pn_timestamp_t now = pn_reactor_mark(reactor);
+        pn_timestamp_t deadline = now + waitTimeout.milliseconds;
+        while (!condition.achieved()) {
+            container.process();
+            if (deadline < pn_reactor_mark(reactor)) {
+                std::string txt = "Connection timed out";
+                if (!msg.empty())
+                    txt += ": " + msg;
+                // TODO: proper Timeout exception
+                throw Error(MSG(txt));
+            }
+        }
+    } catch (...) {
+        pn_reactor_set_timeout(reactor, origTimeout);
+        throw;
+    }
+    pn_reactor_set_timeout(reactor, origTimeout);
+}
+
+
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/BlockingConnectionImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/BlockingConnectionImpl.hpp b/proton-c/bindings/cpp/src/BlockingConnectionImpl.hpp
new file mode 100644
index 0000000..2b2ef7e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/BlockingConnectionImpl.hpp
@@ -0,0 +1,63 @@
+#ifndef PROTON_CPP_CONNECTIONIMPL_H
+#define PROTON_CPP_CONNECTIONIMPL_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/export.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class SslDomain;
+
+ class BlockingConnectionImpl : public MessagingHandler
+{
+  public:
+    PN_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
+    PN_CPP_EXTERN ~BlockingConnectionImpl();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN void wait(WaitCondition &condition);
+    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
+    PN_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
+    Duration getTimeout() { return timeout; }
+    static void incref(BlockingConnectionImpl *);
+    static void decref(BlockingConnectionImpl *);
+  private:
+    friend class BlockingConnection;
+    Container container;
+    Connection connection;
+    std::string url;
+    Duration timeout;
+    int refCount;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/BlockingLink.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/BlockingLink.cpp b/proton-c/bindings/cpp/src/BlockingLink.cpp
new file mode 100644
index 0000000..afc5f35
--- /dev/null
+++ b/proton-c/bindings/cpp/src/BlockingLink.cpp
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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/BlockingLink.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/WaitCondition.hpp"
+#include "proton/Error.hpp"
+#include "Msg.hpp"
+
+
+namespace proton {
+namespace reactor {
+
+namespace {
+struct LinkOpened : public WaitCondition {
+    LinkOpened(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_UNINIT); }
+    pn_link_t *pnLink;
+};
+
+struct LinkClosed : public WaitCondition {
+    LinkClosed(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return (pn_link_state(pnLink) & PN_REMOTE_CLOSED); }
+    pn_link_t *pnLink;
+};
+
+struct LinkNotOpen : public WaitCondition {
+    LinkNotOpen(pn_link_t *l) : pnLink(l) {}
+    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_ACTIVE); }
+    pn_link_t *pnLink;
+};
+
+
+} // namespace
+
+
+BlockingLink::BlockingLink(BlockingConnection *c, pn_link_t *pnl) : connection(*c), link(pnl) {
+    std::string msg = "Opening link " + link.getName();
+    LinkOpened linkOpened(link.getPnLink());
+    connection.wait(linkOpened, msg);
+}
+
+BlockingLink::~BlockingLink() {}
+
+void BlockingLink::waitForClosed(Duration timeout) {
+    std::string msg = "Closing link " + link.getName();
+    LinkClosed linkClosed(link.getPnLink());
+    connection.wait(linkClosed, msg);
+    checkClosed();
+}
+
+void BlockingLink::checkClosed() {
+    pn_link_t * pnLink = link.getPnLink();
+    if (pn_link_state(pnLink) & PN_REMOTE_CLOSED) {
+        link.close();
+        // TODO: LinkDetached exception
+        throw Error(MSG("Link detached"));
+    }
+}
+
+void BlockingLink::close() {
+    link.close();
+    std::string msg = "Closing link " + link.getName();
+    LinkNotOpen linkNotOpen(link.getPnLink());
+    connection.wait(linkNotOpen, msg);
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/BlockingSender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/BlockingSender.cpp b/proton-c/bindings/cpp/src/BlockingSender.cpp
new file mode 100644
index 0000000..7a24324
--- /dev/null
+++ b/proton-c/bindings/cpp/src/BlockingSender.cpp
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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/BlockingSender.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/WaitCondition.hpp"
+#include "proton/Error.hpp"
+#include "Msg.hpp"
+
+
+namespace proton {
+namespace reactor {
+
+namespace {
+struct DeliverySettled : public WaitCondition {
+    DeliverySettled(pn_delivery_t *d) : pnDelivery(d) {}
+    bool achieved() { return pn_delivery_settled(pnDelivery); }
+    pn_delivery_t *pnDelivery;
+};
+
+} // namespace
+
+
+BlockingSender::BlockingSender(BlockingConnection &c, Sender &l) : BlockingLink(&c, l.getPnLink()) {
+    std::string ta = link.getTarget().getAddress();
+    std::string rta = link.getRemoteTarget().getAddress();
+    if (ta.empty() || ta.compare(rta) != 0) {
+        waitForClosed();
+        link.close();
+        std::string txt = "Failed to open sender " + link.getName() + ", target does not match";
+        throw Error(MSG("Container not started"));
+    }
+}
+
+Delivery BlockingSender::send(Message &msg, Duration timeout) {
+    Sender snd = link;
+    Delivery dlv = snd.send(msg);
+    std::string txt = "Sending on sender " + link.getName();
+    DeliverySettled cond(dlv.getPnDelivery());
+    connection.wait(cond, txt, timeout);
+    return dlv;
+}
+
+Delivery BlockingSender::send(Message &msg) {
+    // Use default timeout
+    return send(msg, connection.getTimeout());
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/ConnectionImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.hpp b/proton-c/bindings/cpp/src/ConnectionImpl.hpp
index e20d614..442998e 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.hpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/Endpoint.hpp"
 #include "proton/Container.hpp"
 #include "proton/types.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/ContainerImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.hpp b/proton-c/bindings/cpp/src/ContainerImpl.hpp
index 80df83a..72cbefa 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.hpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/MessagingHandler.hpp"
 #include "proton/Connection.hpp"
 #include "proton/Link.hpp"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Decoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Decoder.cpp b/proton-c/bindings/cpp/src/Decoder.cpp
index 50e6a12..707bcea 100644
--- a/proton-c/bindings/cpp/src/Decoder.cpp
+++ b/proton-c/bindings/cpp/src/Decoder.cpp
@@ -36,7 +36,8 @@ Decoder::Decoder(const char* buffer, size_t size) { decode(buffer, size); }
 Decoder::Decoder(const std::string& buffer) { decode(buffer); }
 Decoder::~Decoder() {}
 
-DecodeError::DecodeError(const std::string& msg) throw() : Error("decode: "+msg) {}
+static const std::string prefix("decode: ");
+DecodeError::DecodeError(const std::string& msg) throw() : Error(prefix+msg) {}
 
 namespace {
 struct SaveState {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Duration.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Duration.cpp b/proton-c/bindings/cpp/src/Duration.cpp
index 7a11819..b14be50 100644
--- a/proton-c/bindings/cpp/src/Duration.cpp
+++ b/proton-c/bindings/cpp/src/Duration.cpp
@@ -23,7 +23,7 @@
 
 namespace proton {
 
-const Duration Duration::FOREVER(std::numeric_limits<uint64_t>::max());
+const Duration Duration::FOREVER(std::numeric_limits<std::uint64_t>::max());
 const Duration Duration::IMMEDIATE(0);
 const Duration Duration::SECOND(1000);
 const Duration Duration::MINUTE(SECOND * 60);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Encoder.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Encoder.cpp b/proton-c/bindings/cpp/src/Encoder.cpp
index 892c338..551a21a 100644
--- a/proton-c/bindings/cpp/src/Encoder.cpp
+++ b/proton-c/bindings/cpp/src/Encoder.cpp
@@ -28,7 +28,8 @@ namespace proton {
 Encoder::Encoder() {}
 Encoder::~Encoder() {}
 
-EncodeError::EncodeError(const std::string& msg) throw() : Error("encode: "+msg) {}
+static const std::string prefix("encode: ");
+EncodeError::EncodeError(const std::string& msg) throw() : Error(prefix+msg) {}
 
 namespace {
 struct SaveState {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Error.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Error.cpp b/proton-c/bindings/cpp/src/Error.cpp
index e97bf5f..4fd7f43 100644
--- a/proton-c/bindings/cpp/src/Error.cpp
+++ b/proton-c/bindings/cpp/src/Error.cpp
@@ -21,7 +21,9 @@
 
 namespace proton {
 
-Error::Error(const std::string& msg) throw() : std::runtime_error("proton: "+msg) {}
+static const std::string prefix("proton: ");
+
+Error::Error(const std::string& msg) throw() : std::runtime_error(prefix+msg) {}
 
 MessageReject::MessageReject(const std::string& msg) throw() : Error(msg) {}
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index 3b4152d..90ad510 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -121,7 +121,7 @@ void MessagingAdapter::onDelivery(Event &e) {
         } else {
             // Sender
             if (pn_delivery_updated(dlv)) {
-                uint64_t rstate = pn_delivery_remote_state(dlv);
+                std::uint64_t rstate = pn_delivery_remote_state(dlv);
                 if (rstate == PN_ACCEPTED) {
                     MessagingEvent mevent(PN_MESSAGING_ACCEPTED, *pe);
                     delegate.onAccepted(mevent);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/PrivateImplRef.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/PrivateImplRef.hpp b/proton-c/bindings/cpp/src/PrivateImplRef.hpp
index 494fef0..560e740 100644
--- a/proton-c/bindings/cpp/src/PrivateImplRef.hpp
+++ b/proton-c/bindings/cpp/src/PrivateImplRef.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/ProtonImplRef.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ProtonImplRef.hpp b/proton-c/bindings/cpp/src/ProtonImplRef.hpp
index 8621dc8..426fb6d 100644
--- a/proton-c/bindings/cpp/src/ProtonImplRef.hpp
+++ b/proton-c/bindings/cpp/src/ProtonImplRef.hpp
@@ -22,7 +22,7 @@
  *
  */
 
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/object.h"
 
 namespace proton {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
index 11fa3c8..3998d62 100644
--- a/proton-c/bindings/cpp/src/Sender.cpp
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -38,8 +38,7 @@ namespace proton {
 namespace reactor {
 
 
-Sender::Sender(pn_link_t *lnk = 0) : Link(lnk) {}
-Sender::Sender() : Link(0) {}
+Sender::Sender(pn_link_t *lnk) : Link(lnk) {}
 
 void Sender::verifyType(pn_link_t *lnk) {
     if (lnk && pn_link_is_receiver(lnk))
@@ -51,14 +50,14 @@ Sender::Sender(const Link& c) : Link(c.getPnLink()) {}
 
 namespace{
 // revisit if thread safety required
-uint64_t tagCounter = 0;
+std::uint64_t tagCounter = 0;
 }
 
 Delivery Sender::send(Message &message) {
     char tag[8];
     void *ptr = &tag;
-    uint64_t id = ++tagCounter;
-    *((uint64_t *) ptr) = id;
+    std::uint64_t id = ++tagCounter;
+    *((std::uint64_t *) ptr) = id;
     pn_delivery_t *dlv = pn_delivery(getPnLink(), pn_dtag(tag, 8));
     std::string buf;
     message.encode(buf);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Session.cpp b/proton-c/bindings/cpp/src/Session.cpp
index 57f788e..594d192 100644
--- a/proton-c/bindings/cpp/src/Session.cpp
+++ b/proton-c/bindings/cpp/src/Session.cpp
@@ -26,6 +26,7 @@
 #include "proton/Session.hpp"
 #include "proton/Connection.hpp"
 #include "ConnectionImpl.hpp"
+#include "ProtonImplRef.hpp"
 
 namespace proton {
 namespace reactor {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/Url.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Url.hpp b/proton-c/bindings/cpp/src/Url.hpp
index 5dfb79e..3c2e450 100644
--- a/proton-c/bindings/cpp/src/Url.hpp
+++ b/proton-c/bindings/cpp/src/Url.hpp
@@ -21,7 +21,7 @@
  * under the License.
  *
  */
-#include "proton/ImportExport.hpp"
+#include "proton/export.hpp"
 #include "proton/ProtonHandle.hpp"
 #include "proton/url.h"
 #include <string>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
deleted file mode 100644
index 3e57b91..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnection.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * 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/BlockingConnection.hpp"
-#include "proton/BlockingSender.hpp"
-#include "proton/MessagingHandler.hpp"
-#include "proton/Error.hpp"
-#include "Msg.hpp"
-#include "BlockingConnectionImpl.hpp"
-#include "PrivateImplRef.hpp"
-
-namespace proton {
-namespace reactor {
-
-template class Handle<BlockingConnectionImpl>;
-typedef PrivateImplRef<BlockingConnection> PI;
-
-BlockingConnection::BlockingConnection() {PI::ctor(*this, 0); }
-
-BlockingConnection::BlockingConnection(const BlockingConnection& c) : Handle<BlockingConnectionImpl>() { PI::copy(*this, c); }
-
-BlockingConnection& BlockingConnection::operator=(const BlockingConnection& c) { return PI::assign(*this, c); }
-BlockingConnection::~BlockingConnection() { PI::dtor(*this); }
-
-BlockingConnection::BlockingConnection(std::string &url, Duration d, SslDomain *ssld, Container *c) {
-    BlockingConnectionImpl *cimpl = new BlockingConnectionImpl(url, d,ssld, c);
-    PI::ctor(*this, cimpl);
-}
-
-void BlockingConnection::close() { impl->close(); }
-
-void BlockingConnection::wait(WaitCondition &cond) { return impl->wait(cond); }
-void BlockingConnection::wait(WaitCondition &cond, std::string &msg, Duration timeout) {
-    return impl->wait(cond, msg, timeout);
-}
-
-BlockingSender BlockingConnection::createSender(std::string &address, Handler *h) {
-    Sender sender = impl->container.createSender(impl->connection, address, h);
-    return BlockingSender(*this, sender);
-}
-
-Duration BlockingConnection::getTimeout() { return impl->getTimeout(); }
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
deleted file mode 100644
index 912f11f..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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/MessagingHandler.hpp"
-#include "proton/Duration.hpp"
-#include "proton/Error.hpp"
-#include "proton/WaitCondition.hpp"
-#include "BlockingConnectionImpl.hpp"
-#include "Msg.hpp"
-#include "contexts.hpp"
-
-#include "proton/connection.h"
-
-namespace proton {
-namespace reactor {
-
-WaitCondition::~WaitCondition() {}
-
-
-void BlockingConnectionImpl::incref(BlockingConnectionImpl *impl) {
-    impl->refCount++;
-}
-
-void BlockingConnectionImpl::decref(BlockingConnectionImpl *impl) {
-    impl->refCount--;
-    if (impl->refCount == 0)
-        delete impl;
-}
-
-namespace {
-struct ConnectionOpening : public WaitCondition {
-    ConnectionOpening(pn_connection_t *c) : pnConnection(c) {}
-    bool achieved() { return (pn_connection_state(pnConnection) & PN_REMOTE_UNINIT); }
-    pn_connection_t *pnConnection;
-};
-
-struct ConnectionClosed : public WaitCondition {
-    ConnectionClosed(pn_connection_t *c) : pnConnection(c) {}
-    bool achieved() { return !(pn_connection_state(pnConnection) & PN_REMOTE_ACTIVE); }
-    pn_connection_t *pnConnection;
-};
-
-}
-
-
-BlockingConnectionImpl::BlockingConnectionImpl(std::string &u, Duration timeout0, SslDomain *ssld, Container *c)
-    : url(u), timeout(timeout0), refCount(0)
-{
-    if (c)
-        container = *c;
-    container.start();
-    container.setTimeout(timeout);
-    // Create connection and send the connection events here
-    connection = container.connect(url, static_cast<Handler *>(this));
-    ConnectionOpening cond(connection.getPnConnection());
-    wait(cond);
-}
-
-BlockingConnectionImpl::~BlockingConnectionImpl() {
-    container = Container();
-}
-
-void BlockingConnectionImpl::close() {
-    connection.close();
-    ConnectionClosed cond(connection.getPnConnection());
-    wait(cond);
-}
-
-void BlockingConnectionImpl::wait(WaitCondition &condition) {
-    std::string empty;
-    wait(condition, empty, timeout);
-}
-
-void BlockingConnectionImpl::wait(WaitCondition &condition, std::string &msg, Duration waitTimeout) {
-    if (waitTimeout == Duration::FOREVER) {
-        while (!condition.achieved()) {
-            container.process();
-        }
-    }
-
-    pn_reactor_t *reactor = container.getReactor();
-    pn_millis_t origTimeout = pn_reactor_get_timeout(reactor);
-    pn_reactor_set_timeout(reactor, waitTimeout.milliseconds);
-    try {
-        pn_timestamp_t now = pn_reactor_mark(reactor);
-        pn_timestamp_t deadline = now + waitTimeout.milliseconds;
-        while (!condition.achieved()) {
-            container.process();
-            if (deadline < pn_reactor_mark(reactor)) {
-                std::string txt = "Connection timed out";
-                if (!msg.empty())
-                    txt += ": " + msg;
-                // TODO: proper Timeout exception
-                throw Error(MSG(txt));
-            }
-        }
-    } catch (...) {
-        pn_reactor_set_timeout(reactor, origTimeout);
-        throw;
-    }
-    pn_reactor_set_timeout(reactor, origTimeout);
-}
-
-
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp b/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
deleted file mode 100644
index 989a317..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingConnectionImpl.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef PROTON_CPP_CONNECTIONIMPL_H
-#define PROTON_CPP_CONNECTIONIMPL_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/ImportExport.hpp"
-#include "proton/Endpoint.hpp"
-#include "proton/Container.hpp"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-namespace reactor {
-
-class Handler;
-class Container;
-class SslDomain;
-
- class BlockingConnectionImpl : public MessagingHandler
-{
-  public:
-    PN_CPP_EXTERN BlockingConnectionImpl(std::string &url, Duration d, SslDomain *ssld, Container *c);
-    PN_CPP_EXTERN ~BlockingConnectionImpl();
-    PN_CPP_EXTERN void close();
-    PN_CPP_EXTERN void wait(WaitCondition &condition);
-    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout);
-    PN_CPP_EXTERN pn_connection_t *getPnBlockingConnection();
-    Duration getTimeout() { return timeout; }
-    static void incref(BlockingConnectionImpl *);
-    static void decref(BlockingConnectionImpl *);
-  private:
-    friend class BlockingConnection;
-    Container container;
-    Connection connection;
-    std::string url;
-    Duration timeout;
-    int refCount;
-};
-
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_CONNECTIONIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp b/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
deleted file mode 100644
index afc5f35..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingLink.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * 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/BlockingLink.hpp"
-#include "proton/BlockingConnection.hpp"
-#include "proton/MessagingHandler.hpp"
-#include "proton/WaitCondition.hpp"
-#include "proton/Error.hpp"
-#include "Msg.hpp"
-
-
-namespace proton {
-namespace reactor {
-
-namespace {
-struct LinkOpened : public WaitCondition {
-    LinkOpened(pn_link_t *l) : pnLink(l) {}
-    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_UNINIT); }
-    pn_link_t *pnLink;
-};
-
-struct LinkClosed : public WaitCondition {
-    LinkClosed(pn_link_t *l) : pnLink(l) {}
-    bool achieved() { return (pn_link_state(pnLink) & PN_REMOTE_CLOSED); }
-    pn_link_t *pnLink;
-};
-
-struct LinkNotOpen : public WaitCondition {
-    LinkNotOpen(pn_link_t *l) : pnLink(l) {}
-    bool achieved() { return !(pn_link_state(pnLink) & PN_REMOTE_ACTIVE); }
-    pn_link_t *pnLink;
-};
-
-
-} // namespace
-
-
-BlockingLink::BlockingLink(BlockingConnection *c, pn_link_t *pnl) : connection(*c), link(pnl) {
-    std::string msg = "Opening link " + link.getName();
-    LinkOpened linkOpened(link.getPnLink());
-    connection.wait(linkOpened, msg);
-}
-
-BlockingLink::~BlockingLink() {}
-
-void BlockingLink::waitForClosed(Duration timeout) {
-    std::string msg = "Closing link " + link.getName();
-    LinkClosed linkClosed(link.getPnLink());
-    connection.wait(linkClosed, msg);
-    checkClosed();
-}
-
-void BlockingLink::checkClosed() {
-    pn_link_t * pnLink = link.getPnLink();
-    if (pn_link_state(pnLink) & PN_REMOTE_CLOSED) {
-        link.close();
-        // TODO: LinkDetached exception
-        throw Error(MSG("Link detached"));
-    }
-}
-
-void BlockingLink::close() {
-    link.close();
-    std::string msg = "Closing link " + link.getName();
-    LinkNotOpen linkNotOpen(link.getPnLink());
-    connection.wait(linkNotOpen, msg);
-}
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp b/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
deleted file mode 100644
index 7a24324..0000000
--- a/proton-c/bindings/cpp/src/blocking/BlockingSender.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * 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/BlockingSender.hpp"
-#include "proton/BlockingConnection.hpp"
-#include "proton/WaitCondition.hpp"
-#include "proton/Error.hpp"
-#include "Msg.hpp"
-
-
-namespace proton {
-namespace reactor {
-
-namespace {
-struct DeliverySettled : public WaitCondition {
-    DeliverySettled(pn_delivery_t *d) : pnDelivery(d) {}
-    bool achieved() { return pn_delivery_settled(pnDelivery); }
-    pn_delivery_t *pnDelivery;
-};
-
-} // namespace
-
-
-BlockingSender::BlockingSender(BlockingConnection &c, Sender &l) : BlockingLink(&c, l.getPnLink()) {
-    std::string ta = link.getTarget().getAddress();
-    std::string rta = link.getRemoteTarget().getAddress();
-    if (ta.empty() || ta.compare(rta) != 0) {
-        waitForClosed();
-        link.close();
-        std::string txt = "Failed to open sender " + link.getName() + ", target does not match";
-        throw Error(MSG("Container not started"));
-    }
-}
-
-Delivery BlockingSender::send(Message &msg, Duration timeout) {
-    Sender snd = link;
-    Delivery dlv = snd.send(msg);
-    std::string txt = "Sending on sender " + link.getName();
-    DeliverySettled cond(dlv.getPnDelivery());
-    connection.wait(cond, txt, timeout);
-    return dlv;
-}
-
-Delivery BlockingSender::send(Message &msg) {
-    // Use default timeout
-    return send(msg, connection.getTimeout());
-}
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp
index db309f7..0b05566 100644
--- a/proton-c/bindings/cpp/src/interop_test.cpp
+++ b/proton-c/bindings/cpp/src/interop_test.cpp
@@ -27,7 +27,6 @@
 #include <fstream>
 #include <streambuf>
 #include <iosfwd>
-#include <unistd.h>
 
 using namespace std;
 using namespace proton;
@@ -43,7 +42,7 @@ struct Fail : public logic_error { Fail(const string& what) : logic_error(what)
 
 
 string read(string filename) {
-    filename = testsDir+"/interop/"+filename+".amqp";
+    filename = testsDir+string("/interop/")+filename+string(".amqp");
     ifstream ifs(filename.c_str());
     if (!ifs.good()) FAIL("Can't open " << filename);
     return string(istreambuf_iterator<char>(ifs), istreambuf_iterator<char>());
@@ -67,19 +66,19 @@ void testDataOstream() {
 void testDecoderPrimitvesExact() {
     Decoder d(read("primitives"));
     ASSERT(d.more());
-    try { get<int8_t>(d); FAIL("got bool as byte"); } catch(DecodeError){}
+    try { get<std::int8_t>(d); FAIL("got bool as byte"); } catch(DecodeError){}
     ASSERT_EQUAL(true, get<bool>(d));
     ASSERT_EQUAL(false, get<bool>(d));
-    try { get<int8_t>(d); FAIL("got ubyte as byte"); } catch(DecodeError){}
-    ASSERT_EQUAL(42, get<uint8_t>(d));
-    try { get<int32_t>(d); FAIL("got uint as ushort"); } catch(DecodeError){}
-    ASSERT_EQUAL(42, get<uint16_t>(d));
-    try { get<uint16_t>(d); FAIL("got short as ushort"); } catch(DecodeError){}
-    ASSERT_EQUAL(-42, get<int16_t>(d));
-    ASSERT_EQUAL(12345, get<uint32_t>(d));
-    ASSERT_EQUAL(-12345, get<int32_t>(d));
-    ASSERT_EQUAL(12345, get<uint64_t>(d));
-    ASSERT_EQUAL(-12345, get<int64_t>(d));
+    try { get<std::int8_t>(d); FAIL("got ubyte as byte"); } catch(DecodeError){}
+    ASSERT_EQUAL(42, get<std::uint8_t>(d));
+    try { get<std::int32_t>(d); FAIL("got uint as ushort"); } catch(DecodeError){}
+    ASSERT_EQUAL(42, get<std::uint16_t>(d));
+    try { get<std::uint16_t>(d); FAIL("got short as ushort"); } catch(DecodeError){}
+    ASSERT_EQUAL(-42, get<std::int16_t>(d));
+    ASSERT_EQUAL(12345, get<std::uint32_t>(d));
+    ASSERT_EQUAL(-12345, get<std::int32_t>(d));
+    ASSERT_EQUAL(12345, get<std::uint64_t>(d));
+    ASSERT_EQUAL(-12345, get<std::int64_t>(d));
     try { get<double>(d); FAIL("got float as double"); } catch(DecodeError){}
     ASSERT_EQUAL(0.125, get<float>(d));
     try { get<float>(d); FAIL("got double as float"); } catch(DecodeError){}
@@ -91,10 +90,10 @@ void testDecoderPrimitvesExact() {
 void testEncoderPrimitives() {
     Encoder e;
     e << true << false;
-    e << uint8_t(42);
-    e << uint16_t(42) << int16_t(-42);
-    e << uint32_t(12345) << int32_t(-12345);
-    e << uint64_t(12345) << int64_t(-12345);
+    e << std::uint8_t(42);
+    e << std::uint16_t(42) << std::int16_t(-42);
+    e << std::uint32_t(12345) << std::int32_t(-12345);
+    e << std::uint64_t(12345) << std::int64_t(-12345);
     e << float(0.125) << double(0.125);
     ASSERT_EQUAL("true, false, 42, 42, -42, 12345, -12345, 12345, -12345, 0.125, 0.125", str(e));
     std::string data = e.encode();
@@ -132,8 +131,7 @@ int run_test(void (*testfn)(), const char* name) {
 
 int main(int argc, char** argv) {
     int failed = 0;
-    char buf[1024];
-    if (argc != 2) FAIL("Usage: " << argv[0] << " tests-dir" << " IN " << getcwd(buf, sizeof(buf)));
+    if (argc != 2) FAIL("Usage: " << argv[0] << " tests-dir");
     testsDir = argv[1];
 
     failed += RUN_TEST(testDataOstream);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
index 55c6473..803dae1 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+#include <string>
 #include <iosfwd>
 #include <proton/error.h>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
index 593d052..b34567b 100644
--- a/proton-c/bindings/cpp/src/types.cpp
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -20,9 +20,46 @@
 #include "proton/types.hpp"
 #include <proton/codec.h>
 #include <ostream>
+#include <algorithm>
 
 namespace proton {
 
+Uuid::Uuid() { std::fill(bytes, bytes+SIZE, 0); }
+Uuid::Uuid(const pn_uuid_t& u) { std::copy(u.bytes, u.bytes+SIZE, bytes); }
+
+Uuid::operator pn_uuid_t() const {
+    pn_uuid_t u;
+    std::copy(begin(), end(), u.bytes);
+    return u;
+}
+
+bool Uuid::operator==(const Uuid& x) const {
+    return std::equal(begin(), end(), x.begin());
+}
+
+bool Uuid::operator<(const Uuid& x) const {
+    return std::lexicographical_compare(begin(), end(), x.begin(), x.end()) < 0;
+}
+
+namespace {
+inline std::ostream& printSegment(std::ostream& o, const Uuid& u, size_t begin, size_t end, const char* sep="") {
+    for (const char* p = &u[begin]; p < &u[end]; ++p) o << *p;
+    return o << sep;
+}
+}
+
+std::ostream& operator<<(std::ostream& o, const Uuid& u) {
+    std::ios_base::fmtflags ff = o.flags();
+    o.flags(std::ios_base::hex);
+    printSegment(o, u, 0, 4, "-");
+    printSegment(o, u, 4, 6, "-");
+    printSegment(o, u, 6, 8, "-");
+    printSegment(o, u, 8, 10, "-");
+    printSegment(o, u, 10, 16);
+    o.flags(ff);
+    return o;
+}
+
 std::string typeName(TypeId t) {
     switch (t) {
       case NULL_: return "null";
@@ -67,12 +104,6 @@ pn_bytes_t pn_bytes(const std::string& s) {
 
 std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
 
-pn_uuid_t pn_uuid(const std::string& s) {
-    pn_uuid_t u = {0};          // Zero initialized.
-    std::copy(s.begin(), s.begin() + std::max(s.size(), sizeof(pn_uuid_t::bytes)), &u.bytes[0]);
-    return u;
-}
-
 Start::Start(TypeId t, TypeId e, bool d, size_t s) : type(t), element(e), isDescribed(d), size(s) {}
 Start Start::array(TypeId element, bool described) { return Start(ARRAY, element, described); }
 Start Start::list() { return Start(LIST); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9f7e3462/proton-c/include/proton/codec.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/codec.h b/proton-c/include/proton/codec.h
index 3ab7f8e..05b8f6f 100644
--- a/proton-c/include/proton/codec.h
+++ b/proton-c/include/proton/codec.h
@@ -178,7 +178,7 @@ typedef enum {
 } pn_type_t;
 
 /** A special invalid type value that is returned when no valid type is available. */
-extern const pn_type_t PN_INVALID;
+PN_EXTERN extern const pn_type_t PN_INVALID;
 
 /**
  * Return a string name for an AMQP type.


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


[18/50] [abbrv] qpid-proton git commit: PROTON-781: Added Backoff to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added Backoff to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 7bb1b71160ef78aad448568794991b5c2674bedf
Parents: bee80bd
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Mar 4 16:39:13 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb     |  1 +
 proton-c/bindings/ruby/lib/reactor/backoff.rb | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7bb1b711/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 6047613..661927e 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -104,6 +104,7 @@ require "reactor/ssl_config"
 require "reactor/global_overrides"
 require "reactor/urls"
 require "reactor/connector"
+require "reactor/backoff"
 
 module Qpid::Proton
   # @private

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7bb1b711/proton-c/bindings/ruby/lib/reactor/backoff.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/backoff.rb b/proton-c/bindings/ruby/lib/reactor/backoff.rb
new file mode 100644
index 0000000..99682e5
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/backoff.rb
@@ -0,0 +1,41 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Reactor
+
+  class Backoff
+
+    def initialize
+      @delay = 0
+    end
+
+    def reset
+      @delay = 0
+    end
+
+    def next
+      current = @delay
+      current = 0.1 if current.zero?
+      @delay = [10, 2 * current].min
+      return current
+    end
+
+  end
+
+end


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


[34/50] [abbrv] qpid-proton git commit: PROTON-865: Use .hpp extension for C++ headers.

Posted by ac...@apache.org.
PROTON-865: Use .hpp extension for C++ headers.

The common convention of using the same ".h" extension for C and C++ headers is insane.
The standard C++ library convention of using no extension at all for C++ headers is even worse.

Adopting the boost convention of ".hpp" for the proton C++ binding.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 38f57e9d93426ffdbb9781f91906dfc44453bddd
Parents: 693752d
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Jun 16 20:20:12 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 examples/cpp/broker.cpp                         |   4 +-
 examples/cpp/encode_decode.cpp                  |   4 +-
 examples/cpp/helloworld.cpp                     |   4 +-
 examples/cpp/helloworld_blocking.cpp            |   6 +-
 examples/cpp/helloworld_direct.cpp              |   6 +-
 examples/cpp/simple_recv.cpp                    |   6 +-
 examples/cpp/simple_send.cpp                    |   6 +-
 proton-c/bindings/cpp/CMakeLists.txt            |   1 -
 .../bindings/cpp/include/proton/Acceptor.hpp    |  50 ++++
 proton-c/bindings/cpp/include/proton/Acking.hpp |  44 ++++
 .../cpp/include/proton/BlockingConnection.hpp   |  67 +++++
 .../cpp/include/proton/BlockingLink.hpp         |  59 +++++
 .../cpp/include/proton/BlockingSender.hpp       |  54 ++++
 .../bindings/cpp/include/proton/Connection.hpp  |  70 ++++++
 .../bindings/cpp/include/proton/Container.hpp   |  77 ++++++
 proton-c/bindings/cpp/include/proton/Data.hpp   |  59 +++++
 .../bindings/cpp/include/proton/Decoder.hpp     | 219 ++++++++++++++++
 .../bindings/cpp/include/proton/Delivery.hpp    |  61 +++++
 .../bindings/cpp/include/proton/Duration.hpp    |  56 +++++
 .../bindings/cpp/include/proton/Encoder.hpp     | 184 ++++++++++++++
 .../bindings/cpp/include/proton/Endpoint.hpp    |  58 +++++
 proton-c/bindings/cpp/include/proton/Event.hpp  |  60 +++++
 proton-c/bindings/cpp/include/proton/Handle.hpp |  79 ++++++
 .../bindings/cpp/include/proton/Handler.hpp     |  50 ++++
 .../cpp/include/proton/ImportExport.hpp         |  50 ++++
 proton-c/bindings/cpp/include/proton/Link.hpp   |  70 ++++++
 .../bindings/cpp/include/proton/Message.hpp     | 116 +++++++++
 .../cpp/include/proton/MessagingAdapter.hpp     |  79 ++++++
 .../cpp/include/proton/MessagingEvent.hpp       | 100 ++++++++
 .../cpp/include/proton/MessagingHandler.hpp     |  97 +++++++
 .../bindings/cpp/include/proton/ProtonEvent.hpp |  57 +++++
 .../cpp/include/proton/ProtonHandle.hpp         |  68 +++++
 .../cpp/include/proton/ProtonHandler.hpp        |  83 ++++++
 .../bindings/cpp/include/proton/Receiver.hpp    |  48 ++++
 proton-c/bindings/cpp/include/proton/Sender.hpp |  52 ++++
 .../bindings/cpp/include/proton/Session.hpp     |  63 +++++
 .../bindings/cpp/include/proton/Terminus.hpp    |  81 ++++++
 .../bindings/cpp/include/proton/Transport.hpp   |  48 ++++
 proton-c/bindings/cpp/include/proton/Value.hpp  |  98 ++++++++
 proton-c/bindings/cpp/include/proton/Values.hpp |  56 +++++
 .../cpp/include/proton/WaitCondition.hpp        |  45 ++++
 .../bindings/cpp/include/proton/cpp/Acceptor.h  |  50 ----
 .../bindings/cpp/include/proton/cpp/Acking.h    |  44 ----
 .../cpp/include/proton/cpp/BlockingConnection.h |  67 -----
 .../cpp/include/proton/cpp/BlockingLink.h       |  59 -----
 .../cpp/include/proton/cpp/BlockingSender.h     |  54 ----
 .../cpp/include/proton/cpp/Connection.h         |  70 ------
 .../bindings/cpp/include/proton/cpp/Container.h |  77 ------
 proton-c/bindings/cpp/include/proton/cpp/Data.h |  59 -----
 .../bindings/cpp/include/proton/cpp/Decoder.h   | 219 ----------------
 .../bindings/cpp/include/proton/cpp/Delivery.h  |  61 -----
 .../bindings/cpp/include/proton/cpp/Duration.h  |  56 -----
 .../bindings/cpp/include/proton/cpp/Encoder.h   | 184 --------------
 .../bindings/cpp/include/proton/cpp/Endpoint.h  |  58 -----
 .../bindings/cpp/include/proton/cpp/Event.h     |  60 -----
 .../bindings/cpp/include/proton/cpp/Handle.h    |  79 ------
 .../bindings/cpp/include/proton/cpp/Handler.h   |  50 ----
 .../cpp/include/proton/cpp/ImportExport.h       |  50 ----
 proton-c/bindings/cpp/include/proton/cpp/Link.h |  70 ------
 .../bindings/cpp/include/proton/cpp/Message.h   | 116 ---------
 .../cpp/include/proton/cpp/MessagingAdapter.h   |  79 ------
 .../cpp/include/proton/cpp/MessagingEvent.h     | 100 --------
 .../cpp/include/proton/cpp/MessagingHandler.h   |  97 -------
 .../cpp/include/proton/cpp/ProtonEvent.h        |  57 -----
 .../cpp/include/proton/cpp/ProtonHandle.h       |  68 -----
 .../cpp/include/proton/cpp/ProtonHandler.h      |  83 ------
 .../bindings/cpp/include/proton/cpp/Receiver.h  |  48 ----
 .../bindings/cpp/include/proton/cpp/Sender.h    |  52 ----
 .../bindings/cpp/include/proton/cpp/Session.h   |  63 -----
 .../bindings/cpp/include/proton/cpp/Terminus.h  |  81 ------
 .../bindings/cpp/include/proton/cpp/Transport.h |  48 ----
 .../bindings/cpp/include/proton/cpp/Value.h     |  98 --------
 .../bindings/cpp/include/proton/cpp/Values.h    |  56 -----
 .../cpp/include/proton/cpp/WaitCondition.h      |  45 ----
 .../cpp/include/proton/cpp/exceptions.h         |  49 ----
 .../bindings/cpp/include/proton/cpp/types.h     | 250 -------------------
 .../bindings/cpp/include/proton/exceptions.hpp  |  49 ++++
 proton-c/bindings/cpp/include/proton/types.hpp  | 250 +++++++++++++++++++
 proton-c/bindings/cpp/src/Acceptor.cpp          |   8 +-
 proton-c/bindings/cpp/src/Acking.cpp            |   2 +-
 proton-c/bindings/cpp/src/Connection.cpp        |  16 +-
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    |  18 +-
 proton-c/bindings/cpp/src/ConnectionImpl.h      |  75 ------
 proton-c/bindings/cpp/src/ConnectionImpl.hpp    |  75 ++++++
 proton-c/bindings/cpp/src/Connector.cpp         |  14 +-
 proton-c/bindings/cpp/src/Connector.h           |  59 -----
 proton-c/bindings/cpp/src/Connector.hpp         |  59 +++++
 proton-c/bindings/cpp/src/Container.cpp         |  26 +-
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |  30 +--
 proton-c/bindings/cpp/src/ContainerImpl.h       |  82 ------
 proton-c/bindings/cpp/src/ContainerImpl.hpp     |  82 ++++++
 proton-c/bindings/cpp/src/Data.cpp              |   4 +-
 proton-c/bindings/cpp/src/Decoder.cpp           |   8 +-
 proton-c/bindings/cpp/src/Delivery.cpp          |   4 +-
 proton-c/bindings/cpp/src/Duration.cpp          |   2 +-
 proton-c/bindings/cpp/src/Encoder.cpp           |   8 +-
 proton-c/bindings/cpp/src/Endpoint.cpp          |   6 +-
 proton-c/bindings/cpp/src/Event.cpp             |  10 +-
 proton-c/bindings/cpp/src/Handler.cpp           |   4 +-
 proton-c/bindings/cpp/src/Link.cpp              |  14 +-
 proton-c/bindings/cpp/src/Message.cpp           |   8 +-
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |  10 +-
 proton-c/bindings/cpp/src/MessagingEvent.cpp    |  14 +-
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |   6 +-
 proton-c/bindings/cpp/src/Msg.h                 |  59 -----
 proton-c/bindings/cpp/src/Msg.hpp               |  59 +++++
 proton-c/bindings/cpp/src/PrivateImplRef.h      |  97 -------
 proton-c/bindings/cpp/src/PrivateImplRef.hpp    |  97 +++++++
 proton-c/bindings/cpp/src/ProtonEvent.cpp       |  16 +-
 proton-c/bindings/cpp/src/ProtonHandler.cpp     |   4 +-
 proton-c/bindings/cpp/src/ProtonImplRef.h       |  66 -----
 proton-c/bindings/cpp/src/ProtonImplRef.hpp     |  66 +++++
 proton-c/bindings/cpp/src/Receiver.cpp          |   8 +-
 proton-c/bindings/cpp/src/Sender.cpp            |  10 +-
 proton-c/bindings/cpp/src/Session.cpp           |  10 +-
 proton-c/bindings/cpp/src/Terminus.cpp          |   2 +-
 proton-c/bindings/cpp/src/Transport.cpp         |   4 +-
 proton-c/bindings/cpp/src/Url.cpp               |   8 +-
 proton-c/bindings/cpp/src/Url.h                 |  49 ----
 proton-c/bindings/cpp/src/Url.hpp               |  49 ++++
 proton-c/bindings/cpp/src/Value.cpp             |   4 +-
 proton-c/bindings/cpp/src/Values.cpp            |   4 +-
 .../cpp/src/blocking/BlockingConnection.cpp     |  16 +-
 .../cpp/src/blocking/BlockingConnectionImpl.cpp |  16 +-
 .../cpp/src/blocking/BlockingConnectionImpl.h   |  63 -----
 .../cpp/src/blocking/BlockingConnectionImpl.hpp |  63 +++++
 .../bindings/cpp/src/blocking/BlockingLink.cpp  |  12 +-
 .../cpp/src/blocking/BlockingSender.cpp         |  10 +-
 proton-c/bindings/cpp/src/contexts.cpp          |   6 +-
 proton-c/bindings/cpp/src/contexts.h            |  52 ----
 proton-c/bindings/cpp/src/contexts.hpp          |  52 ++++
 proton-c/bindings/cpp/src/interop_test.cpp      |   8 +-
 proton-c/bindings/cpp/src/proton_bits.cpp       |   2 +-
 proton-c/bindings/cpp/src/proton_bits.h         |  44 ----
 proton-c/bindings/cpp/src/proton_bits.hpp       |  44 ++++
 proton-c/bindings/cpp/src/types.cpp             |   2 +-
 136 files changed, 3598 insertions(+), 3599 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index 01160a7..ccecefa 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
 
 #include <iostream>
 #include <deque>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/encode_decode.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp
index 5096c40..bf1dba9 100644
--- a/examples/cpp/encode_decode.cpp
+++ b/examples/cpp/encode_decode.cpp
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#include <proton/cpp/Values.h>
-#include <proton/cpp/Value.h>
+#include <proton/Values.hpp>
+#include <proton/Value.hpp>
 #include <algorithm>
 #include <iostream>
 #include <iterator>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index 6b58eb7..5ac73da 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
 
 #include <iostream>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld_blocking.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_blocking.cpp b/examples/cpp/helloworld_blocking.cpp
index 5f443b6..c0ef4c5 100644
--- a/examples/cpp/helloworld_blocking.cpp
+++ b/examples/cpp/helloworld_blocking.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/BlockingSender.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingSender.hpp"
 
 #include <iostream>
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 12617cd..965ba04 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Container.h"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Container.hpp"
 
-//#include "proton/cpp/Acceptor.h"
+//#include "proton/Acceptor.hpp"
 #include <iostream>
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 6612b16..48ba8a4 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Link.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Link.hpp"
 
 #include <iostream>
 #include <stdlib.h>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index eb87c8a..59222e4 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Connection.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Connection.hpp"
 
 #include <iostream>
 #include <string.h>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 18533ec..b7e198f 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -28,7 +28,6 @@ set(qpid-proton-cpp-source
   src/Connection.cpp
   src/ConnectionImpl.cpp
   src/Connector.cpp
-  src/Connector.h
   src/Container.cpp
   src/ContainerImpl.cpp
   src/Data.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acceptor.hpp b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
new file mode 100644
index 0000000..5fd0004
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_ACCEPTOR_H
+#define PROTON_CPP_ACCEPTOR_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/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/reactor.h"
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Acceptor : public ProtonHandle<pn_acceptor_t>
+{
+  public:
+    PN_CPP_EXTERN Acceptor();
+    PN_CPP_EXTERN Acceptor(pn_acceptor_t *);
+    PN_CPP_EXTERN Acceptor(const Acceptor&);
+    PN_CPP_EXTERN Acceptor& operator=(const Acceptor&);
+    PN_CPP_EXTERN ~Acceptor();
+
+    PN_CPP_EXTERN void close();
+  private:
+    friend class ProtonImplRef<Acceptor>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ACCEPTOR_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Acking.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acking.hpp b/proton-c/bindings/cpp/include/proton/Acking.hpp
new file mode 100644
index 0000000..f9f079f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Acking.hpp
@@ -0,0 +1,44 @@
+#ifndef PROTON_CPP_ACKING_H
+#define PROTON_CPP_ACKING_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/ImportExport.hpp"
+#include "proton/Delivery.hpp"
+
+namespace proton {
+namespace reactor {
+
+
+class Acking
+{
+  public:
+    PN_CPP_EXTERN virtual void accept(Delivery &d);
+    PN_CPP_EXTERN virtual void reject(Delivery &d);
+    PN_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
+    PN_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ACKING_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
new file mode 100644
index 0000000..138b239
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
@@ -0,0 +1,67 @@
+#ifndef PROTON_CPP_BLOCKINGCONNECTION_H
+#define PROTON_CPP_BLOCKINGCONNECTION_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/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Container;
+class BlockingConnectionImpl;
+class SslDomain;
+class BlockingSender;
+class WaitCondition;
+
+class BlockingConnection : public Handle<BlockingConnectionImpl>
+{
+  public:
+    PN_CPP_EXTERN BlockingConnection();
+    PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
+    PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
+    PN_CPP_EXTERN ~BlockingConnection();
+
+    PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
+                                         SslDomain *ssld=0, Container *c=0);
+    PN_CPP_EXTERN void close();
+
+    PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
+    PN_CPP_EXTERN void wait(WaitCondition &condition);
+    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
+    PN_CPP_EXTERN Duration getTimeout();
+  private:
+    friend class PrivateImplRef<BlockingConnection>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGCONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
new file mode 100644
index 0000000..3eec755
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
@@ -0,0 +1,59 @@
+#ifndef PROTON_CPP_BLOCKINGLINK_H
+#define PROTON_CPP_BLOCKINGLINK_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/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/types.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+
+class BlockingLink
+{
+  public:
+    PN_CPP_EXTERN void close();
+    ~BlockingLink();
+  protected:
+    PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
+    PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
+  private:
+    BlockingConnection connection;
+    Link link;
+    void checkClosed();
+    friend class BlockingConnection;
+    friend class BlockingSender;
+    friend class BlockingReceiver;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGLINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
new file mode 100644
index 0000000..64cbdfd
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
@@ -0,0 +1,54 @@
+#ifndef PROTON_CPP_BLOCKINGSENDER_H
+#define PROTON_CPP_BLOCKINGSENDER_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/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingLink.hpp"
+#include "proton/types.h"
+#include "proton/delivery.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+class BlockingLink;
+
+class BlockingSender : public BlockingLink
+{
+  public:
+    PN_CPP_EXTERN Delivery send(Message &msg);
+    PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
+  private:
+    PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
+    friend class BlockingConnection;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_BLOCKINGSENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Connection.hpp b/proton-c/bindings/cpp/include/proton/Connection.hpp
new file mode 100644
index 0000000..e72b091
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Connection.hpp
@@ -0,0 +1,70 @@
+#ifndef PROTON_CPP_CONNECTION_H
+#define PROTON_CPP_CONNECTION_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/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Transport;
+class Container;
+class ConnectionImpl;
+
+class Connection : public Endpoint, public Handle<ConnectionImpl>
+{
+  public:
+    PN_CPP_EXTERN Connection();
+    PN_CPP_EXTERN Connection(ConnectionImpl *);
+    PN_CPP_EXTERN Connection(const Connection& c);
+    PN_CPP_EXTERN Connection& operator=(const Connection& c);
+    PN_CPP_EXTERN ~Connection();
+
+    PN_CPP_EXTERN Connection(Container &c, Handler *h = 0);
+    PN_CPP_EXTERN Transport &getTransport();
+    PN_CPP_EXTERN Handler *getOverride();
+    PN_CPP_EXTERN void setOverride(Handler *h);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_connection_t *getPnConnection();
+    PN_CPP_EXTERN Container &getContainer();
+    PN_CPP_EXTERN std::string getHostname();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+  private:
+   friend class PrivateImplRef<Connection>;
+   friend class Connector;
+   friend class ConnectionImpl;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Container.hpp b/proton-c/bindings/cpp/include/proton/Container.hpp
new file mode 100644
index 0000000..0f61599
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Container.hpp
@@ -0,0 +1,77 @@
+#ifndef PROTON_CPP_CONTAINER_H
+#define PROTON_CPP_CONTAINER_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/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Acceptor.hpp"
+#include "proton/Duration.hpp"
+#include <proton/reactor.h>
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class DispatchHelper;
+class Connection;
+class Connector;
+class Acceptor;
+class ContainerImpl;
+class MessagingHandler;
+class Sender;
+class Receiver;
+class Link;
+ class Handler;
+
+class Container : public Handle<ContainerImpl>
+{
+  public:
+    PN_CPP_EXTERN Container(ContainerImpl *);
+    PN_CPP_EXTERN Container(const Container& c);
+    PN_CPP_EXTERN Container& operator=(const Container& c);
+    PN_CPP_EXTERN ~Container();
+
+    PN_CPP_EXTERN Container();
+    PN_CPP_EXTERN Container(MessagingHandler &mhandler);
+    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
+    PN_CPP_EXTERN void run();
+    PN_CPP_EXTERN void start();
+    PN_CPP_EXTERN bool process();
+    PN_CPP_EXTERN void stop();
+    PN_CPP_EXTERN void wakeup();
+    PN_CPP_EXTERN bool isQuiesced();
+    PN_CPP_EXTERN pn_reactor_t *getReactor();
+    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
+    PN_CPP_EXTERN Sender createSender(std::string &url);
+    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+    PN_CPP_EXTERN Acceptor listen(const std::string &url);
+    PN_CPP_EXTERN std::string getContainerId();
+    PN_CPP_EXTERN Duration getTimeout();
+    PN_CPP_EXTERN void setTimeout(Duration timeout);
+  private:
+   friend class PrivateImplRef<Container>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_CONTAINER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Data.hpp b/proton-c/bindings/cpp/include/proton/Data.hpp
new file mode 100644
index 0000000..7f9dad0
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Data.hpp
@@ -0,0 +1,59 @@
+#ifndef DATA_H
+#define DATA_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/ImportExport.hpp"
+#include <iosfwd>
+
+/**@file
+ * Base for classes that hold AMQP data.
+ * @internal
+ */
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+/** Base for classes that hold AMQP data. */
+class Data {
+  public:
+    virtual ~Data();
+
+    /** Copies the data */
+    Data& operator=(const Data&);
+
+    /** Clear the data. */
+    PN_CPP_EXTERN void clear();
+
+    /** True if there are no values. */
+    PN_CPP_EXTERN bool empty() const;
+
+    /** Human readable representation of data. */
+    friend std::ostream& operator<<(std::ostream&, const Data&);
+
+  protected:
+    /** Takes ownership of pd */
+    explicit Data(pn_data_t* pd=0);
+    mutable pn_data_t* data;
+};
+
+
+}}
+#endif // DATA_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Decoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Decoder.hpp b/proton-c/bindings/cpp/include/proton/Decoder.hpp
new file mode 100644
index 0000000..814fb05
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Decoder.hpp
@@ -0,0 +1,219 @@
+#ifndef DECODER_H
+#define DECODER_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/Data.hpp"
+#include "proton/types.hpp"
+#include "proton/exceptions.hpp"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**@file
+ * Stream-like decoder from AMQP bytes to C++ values.
+ * @ingroup cpp
+ */
+
+/**
+@ingroup cpp
+
+Stream-like decoder from AMQP bytes to a stream of C++ values.
+
+types.h defines C++ types corresponding to AMQP types.
+
+Decoder operator>> will extract AMQP types into corresponding C++ types, and do
+simple conversions, e.g. from AMQP integer types to corresponding or larger C++
+integer types.
+
+You can require an exact AMQP type using the `as<type>(value)` helper. E.g.
+
+    Int i;
+    decoder >> as<INT>(i):       // Will throw if decoder does not contain an INT
+
+You can also use the `as` helper to extract an AMQP list, array or map into C++ containers.
+
+    std::vector<Int> v;
+    decoder >> as<LIST>(v);     // Extract a list of INT.
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also extract container values element-by-element, see the Start class.
+*/
+PN_CPP_EXTERN class Decoder : public virtual Data {
+  public:
+    /** Raised if a Decoder operation fails  */
+    struct Error : public ProtonException {
+        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+    };
+
+    PN_CPP_EXTERN Decoder();
+    PN_CPP_EXTERN ~Decoder();
+
+    /** Copy AMQP data from a byte buffer into the Decoder. */
+    PN_CPP_EXTERN Decoder(const char* buffer, size_t size);
+
+    /** Copy AMQP data from a std::string into the Decoder. */
+    PN_CPP_EXTERN Decoder(const std::string&);
+
+    /** Decode AMQP data from a byte buffer onto the end of the value stream. */
+    PN_CPP_EXTERN void decode(const char* buffer, size_t size);
+
+    /** Decode AMQP data from bytes in std::string onto the end of the value stream. */
+    PN_CPP_EXTERN void decode(const std::string&);
+
+    /** Return true if there are more values to read at the current level. */
+    PN_CPP_EXTERN bool more() const;
+
+    /** Type of the next value that will be read by operator>>
+     *@throw Error if empty().
+     */
+    PN_CPP_EXTERN TypeId type() const;
+
+    /** @name Extract simple types
+     * Overloads to extract simple types.
+     * @throw Error if the Decoder is empty or the current value has an incompatible type.
+     * @{
+     */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Null);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+    ///@}
+
+    /** Extract and return a value of type T. */
+    template <class T> T get() { T value; *this >> value; return value; }
+
+    /** Extract and return a value of type T, as AMQP type. */
+    template <class T, TypeId A> T getAs() { T value; *this >> as<A>(value); return value; }
+
+    /** Call Decoder::start() in constructor, Decoder::finish in destructor() */
+    struct Scope : public Start {
+        Decoder& decoder;
+        Scope(Decoder& d) : decoder(d) { d >> *this; }
+        ~Scope() { decoder >> finish(); }
+    };
+
+    template <TypeId A, class T> friend Decoder& operator>>(Decoder& d, Ref<T, A> ref) {
+        d.checkType(A);
+        d >> ref.value;
+        return d;
+    }
+
+    /** start extracting a container value, one of array, list, map, described.
+     * The basic pattern is:
+     *
+     *     Start s;
+     *     decoder >> s;
+     *     // check s.type() to see if this is an ARRAY, LIST, MAP or DESCRIBED type.
+     *     if (s.described) extract the descriptor...
+     *     for (size_t i = 0; i < s.size(); ++i) Extract each element...
+     *     decoder >> finish();
+     *
+     * The first value of an ARRAY is a descriptor if Start::descriptor is true,
+     * followed by Start::size elemets of type Start::element.
+     *
+     * A LIST has Start::size elements which may be of mixed type.
+     *
+     * A MAP has Start::size elements which alternate key, value, key, value...
+     * and may be of mixed type.
+     *
+     * A DESCRIBED contains a descriptor and a single element, so it always has
+     * Start::described=true and Start::size=1.
+     *
+     * Note Scope automatically calls finish() in its destructor.
+     *
+     *@throw decoder::error if the curent value is not a container type.
+     */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Start&);
+
+    /** Finish extracting a container value. */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Finish);
+
+    /** Skip a value */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Skip);
+
+  private:
+    template <class T> Decoder& extract(T& value);
+    void checkType(TypeId);
+
+    // Not implemented
+    Decoder(const Decoder&);
+    Decoder& operator=(const Decoder&);
+
+  friend class Value;
+  friend class Encoder;
+};
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref)  {
+    Decoder::Scope s(d);
+    if (s.isDescribed) d >> skip();
+    ref.value.clear();
+    ref.value.resize(s.size);
+    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) {
+        d >> *i;
+    }
+    return d;
+}
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, LIST> ref)  {
+    Decoder::Scope s(d);
+    ref.value.clear();
+    ref.value.resize(s.size);
+    for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i)
+        d >> *i;
+    return d;
+}
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref)  {
+    Decoder::Scope m(d);
+    ref.value.clear();
+    for (size_t i = 0; i < m.size/2; ++i) {
+        typename T::key_type k;
+        typename T::mapped_type v;
+        d >> k >> v;
+        ref.value[k] = v;
+    }
+    return d;
+}
+
+}} // namespace proton::reactor
+#endif // DECODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Delivery.hpp b/proton-c/bindings/cpp/include/proton/Delivery.hpp
new file mode 100644
index 0000000..63ecfcd
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Delivery.hpp
@@ -0,0 +1,61 @@
+#ifndef PROTON_CPP_DELIVERY_H
+#define PROTON_CPP_DELIVERY_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/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+
+#include "proton/delivery.h"
+#include "proton/disposition.h"
+
+namespace proton {
+namespace reactor {
+
+class Delivery : public ProtonHandle<pn_delivery_t>
+{
+  public:
+
+    enum state {
+        NONE = 0,
+        RECEIVED = PN_RECEIVED,
+        ACCEPTED = PN_ACCEPTED,
+        REJECTED = PN_REJECTED,
+        RELEASED = PN_RELEASED,
+        MODIFIED = PN_MODIFIED
+    };  // AMQP spec 3.4 Delivery State
+
+    PN_CPP_EXTERN Delivery(pn_delivery_t *d);
+    PN_CPP_EXTERN Delivery();
+    PN_CPP_EXTERN ~Delivery();
+    PN_CPP_EXTERN Delivery(const Delivery&);
+    PN_CPP_EXTERN Delivery& operator=(const Delivery&);
+    PN_CPP_EXTERN bool settled();
+    PN_CPP_EXTERN void settle();
+    PN_CPP_EXTERN pn_delivery_t *getPnDelivery();
+  private:
+    friend class ProtonImplRef<Delivery>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_DELIVERY_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Duration.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Duration.hpp b/proton-c/bindings/cpp/include/proton/Duration.hpp
new file mode 100644
index 0000000..0265e73
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Duration.hpp
@@ -0,0 +1,56 @@
+#ifndef PROTON_CPP_DURATION_H
+#define PROTON_CPP_DURATION_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/ImportExport.hpp"
+#include "proton/types.h"
+
+namespace proton {
+namespace reactor {
+
+/** @ingroup cpp
+ * A duration is a time in milliseconds.
+ */
+class Duration
+{
+  public:
+    PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
+    PN_CPP_EXTERN uint64_t getMilliseconds() const;
+    PN_CPP_EXTERN static const Duration FOREVER;
+    PN_CPP_EXTERN static const Duration IMMEDIATE;
+    PN_CPP_EXTERN static const Duration SECOND;
+    PN_CPP_EXTERN static const Duration MINUTE;
+  private:
+    uint64_t milliseconds;
+};
+
+PN_CPP_EXTERN Duration operator*(const Duration& duration,
+                                         uint64_t multiplier);
+PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
+                                         const Duration& duration);
+PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_DURATION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Encoder.hpp b/proton-c/bindings/cpp/include/proton/Encoder.hpp
new file mode 100644
index 0000000..e32fce5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Encoder.hpp
@@ -0,0 +1,184 @@
+#ifndef ENCODER_H
+#define ENCODER_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/Data.hpp"
+#include "proton/types.hpp"
+#include "proton/exceptions.hpp"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**@file
+ * Stream-like encoder from C++ values to AMQP bytes.
+ * @ingroup cpp
+*/
+
+/**
+@ingroup cpp
+
+types.h defines C++ typedefs and types for AMQP each type. These types
+insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
+insert any other type.
+
+C++ containers can be inserted as AMQP containers with the as() helper functions. E.g.
+
+   std::vector<Symbol> v; encoder << as<List>(v);
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also insert containers element-by-element, see the Start class.
+*/
+class Encoder : public virtual Data {
+  public:
+    /** Raised if a Encoder operation fails  */
+    struct Error : public ProtonException {
+        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+    };
+
+    PN_CPP_EXTERN Encoder();
+    PN_CPP_EXTERN ~Encoder();
+
+    /**
+     * Encode the current values into buffer and update size to reflect the number of bytes encoded.
+     *
+     * Clears the encoder.
+     *
+     *@return if buffer==0 or size is too small then return false and  size to the required size.
+     *Otherwise return true and set size to the number of bytes encoded.
+     */
+    PN_CPP_EXTERN bool encode(char* buffer, size_t& size);
+
+    /** Encode the current values into a std::string, resize the string if necessary.
+     *
+     * Clears the encoder.
+     */
+    PN_CPP_EXTERN void encode(std::string&);
+
+    /** Encode the current values into a std::string. Clears the encoder. */
+    PN_CPP_EXTERN std::string encode();
+
+    /** @name Insert simple types.
+     *@{
+     */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+    ///@}
+
+    /** Start a container type. See the Start class. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&);
+
+    /** Finish a container type. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish);
+
+
+    /**@name Insert values returned by the as<TypeId> helper.
+     *@{
+     */
+  template <class T, TypeId A> friend Encoder& operator<<(Encoder&, CRef<T, A>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>);
+  template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>);
+    // TODO aconway 2015-06-16: DESCRIBED.
+    ///@}
+
+  private:
+    PN_CPP_EXTERN Encoder(pn_data_t* pd);
+
+    // Not implemented
+    Encoder(const Encoder&);
+    Encoder& operator=(const Encoder&);
+
+  friend class Value;
+};
+
+/** Encode const char* as string */
+inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
+
+/** Encode char* as string */
+inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); }
+
+/** Encode std::string as string */
+inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); }
+
+//@internal Convert a Ref to a CRef.
+template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
+    return e << CRef<T,A>(ref);
+}
+
+// TODO aconway 2015-06-16: described array insertion.
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, ARRAY> a) {
+    e << Start::array(TypeIdOf<typename T::value_type>::value);
+    for (typename T::const_iterator i = a.value.begin(); i != a.value.end(); ++i)
+        e << *i;
+    e << finish();
+    return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, LIST> l) {
+    e << Start::list();
+    for (typename T::const_iterator i = l.value.begin(); i != l.value.end(); ++i)
+        e << *i;
+    e << finish();
+    return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
+    e << Start::map();
+    for (typename T::const_iterator i = m.value.begin(); i != m.value.end(); ++i) {
+        e << i->first;
+        e << i->second;
+    }
+    e << finish();
+    return e;
+}
+
+
+}}
+#endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Endpoint.hpp b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
new file mode 100644
index 0000000..e68ffbf
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
@@ -0,0 +1,58 @@
+#ifndef PROTON_CPP_ENDPOINT_H
+#define PROTON_CPP_ENDPOINT_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/ImportExport.hpp"
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Connection;
+class Transport;
+
+class Endpoint
+{
+  public:
+    enum {
+        LOCAL_UNINIT = PN_LOCAL_UNINIT,
+        REMOTE_UNINIT = PN_REMOTE_UNINIT,
+        LOCAL_ACTIVE = PN_LOCAL_ACTIVE,
+        REMOTE_ACTIVE = PN_REMOTE_ACTIVE,
+        LOCAL_CLOSED = PN_LOCAL_CLOSED,
+        REMOTE_CLOSED  = PN_REMOTE_CLOSED
+    };
+    typedef int State;
+
+    // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
+    virtual PN_CPP_EXTERN Connection &getConnection() = 0;
+    Transport PN_CPP_EXTERN &getTransport();
+  protected:
+    Endpoint();
+    ~Endpoint();
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ENDPOINT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Event.hpp b/proton-c/bindings/cpp/include/proton/Event.hpp
new file mode 100644
index 0000000..f808dd1
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Event.hpp
@@ -0,0 +1,60 @@
+#ifndef PROTON_CPP_EVENT_H
+#define PROTON_CPP_EVENT_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/ImportExport.hpp"
+#include "proton/Link.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Message.hpp"
+#include <vector>
+
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+class Event
+{
+  public:
+    virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0;
+    virtual PN_CPP_EXTERN Container &getContainer();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    virtual PN_CPP_EXTERN Message getMessage();
+    virtual PN_CPP_EXTERN void setMessage(Message &);
+    virtual PN_CPP_EXTERN ~Event();
+  protected:
+    PN_CPP_EXTERN PN_CPP_EXTERN Event();
+  private:
+    PN_CPP_EXTERN Event(const Event&);
+    PN_CPP_EXTERN Event& operator=(const Event&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_EVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Handle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handle.hpp b/proton-c/bindings/cpp/include/proton/Handle.hpp
new file mode 100644
index 0000000..f8fc81b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Handle.hpp
@@ -0,0 +1,79 @@
+#ifndef PROTON_CPP_HANDLE_H
+#define PROTON_CPP_HANDLE_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/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+template <class> class PrivateImplRef;
+template <class> class ProtonImplRef;
+
+// FIXME aconway 2015-06-09: don't need handle, get rid of it.
+
+/**
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null,  like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+  public:
+
+    /**@return true if handle is valid,  i.e. not null. */
+    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+    /**@return true if handle is null. It is an error to call any function on a null handle. */
+    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+    /** Conversion to bool supports idiom if (handle) { handle->... } */
+    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+    /** Operator ==  equal if they point to same non-null object*/
+    PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
+    PROTON_CPP_INLINE_EXTERN bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
+
+    void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+  private:
+    // Not implemented, subclasses must implement.
+    Handle(const Handle&);
+    Handle& operator=(const Handle&);
+
+  protected:
+    typedef T Impl;
+    PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
+
+    Impl* impl;
+
+  friend class PrivateImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_HANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handler.hpp b/proton-c/bindings/cpp/include/proton/Handler.hpp
new file mode 100644
index 0000000..d20fbeb
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Handler.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_HANDLER_H
+#define PROTON_CPP_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/ImportExport.hpp"
+#include "proton/Event.hpp"
+#include "proton/event.h"
+#include <vector>
+
+namespace proton {
+namespace reactor {
+
+class PN_CPP_EXTERN Handler
+{
+  public:
+    PN_CPP_EXTERN Handler();
+    PN_CPP_EXTERN virtual ~Handler();
+
+    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+
+    PN_CPP_EXTERN virtual void addChildHandler(Handler &e);
+    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
+    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
+  protected:
+    std::vector<Handler *>childHandlers;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ImportExport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ImportExport.hpp b/proton-c/bindings/cpp/include/proton/ImportExport.hpp
new file mode 100644
index 0000000..cbc0626
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ImportExport.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_IMPORTEXPORT_H
+#define PROTON_CPP_IMPORTEXPORT_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.
+ *
+ */
+#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC)
+  //
+  // Import and Export definitions for Windows:
+  //
+#  define PROTON_CPP_EXPORT __declspec(dllexport)
+#  define PROTON_CPP_IMPORT __declspec(dllimport)
+#else
+  //
+  // Non-Windows (Linux, etc.) definitions:
+  //
+#  define PROTON_CPP_EXPORT
+#  define PROTON_CPP_IMPORT
+#endif
+
+
+// For c++ library symbols
+
+#ifdef protoncpp_EXPORTS
+#  define PN_CPP_EXTERN PROTON_CPP_EXPORT
+#else
+#  define PN_CPP_EXTERN PROTON_CPP_IMPORT
+#endif
+
+// TODO:
+#define PROTON_CPP_INLINE_EXTERN
+
+#endif  /*!PROTON_CPP_IMPORTEXPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Link.hpp b/proton-c/bindings/cpp/include/proton/Link.hpp
new file mode 100644
index 0000000..bf5a9a7
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Link.hpp
@@ -0,0 +1,70 @@
+#ifndef PROTON_CPP_LINK_H
+#define PROTON_CPP_LINK_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/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Terminus.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Link : public Endpoint, public ProtonHandle<pn_link_t>
+{
+  public:
+    PN_CPP_EXTERN Link(pn_link_t *);
+    PN_CPP_EXTERN Link();
+    PN_CPP_EXTERN ~Link();
+    PN_CPP_EXTERN Link(const Link&);
+    PN_CPP_EXTERN Link& operator=(const Link&);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN bool isSender();
+    PN_CPP_EXTERN bool isReceiver();
+    PN_CPP_EXTERN int getCredit();
+    PN_CPP_EXTERN Terminus getSource();
+    PN_CPP_EXTERN Terminus getTarget();
+    PN_CPP_EXTERN Terminus getRemoteSource();
+    PN_CPP_EXTERN Terminus getRemoteTarget();
+    PN_CPP_EXTERN std::string getName();
+    PN_CPP_EXTERN pn_link_t *getPnLink() const;
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN Link getNext(Endpoint::State mask);
+  protected:
+    virtual void verifyType(pn_link_t *l);
+  private:
+    friend class ProtonImplRef<Link>;
+    bool senderLink;
+};
+
+
+}} // namespace proton::reactor
+
+#include "proton/Sender.hpp"
+#include "proton/Receiver.hpp"
+
+#endif  /*!PROTON_CPP_LINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Message.hpp b/proton-c/bindings/cpp/include/proton/Message.hpp
new file mode 100644
index 0000000..f94f58b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Message.hpp
@@ -0,0 +1,116 @@
+#ifndef PROTON_CPP_MESSAGE_H
+#define PROTON_CPP_MESSAGE_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/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/message.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+class Message : public ProtonHandle<pn_message_t>
+{
+  public:
+    PN_CPP_EXTERN Message();
+    PN_CPP_EXTERN Message(pn_message_t *);
+    PN_CPP_EXTERN Message(const Message&);
+    PN_CPP_EXTERN Message& operator=(const Message&);
+    PN_CPP_EXTERN ~Message();
+
+    PN_CPP_EXTERN pn_message_t *getPnMessage() const;
+
+    // FIXME aconway 2015-06-11: get rid of get/set prefixes
+
+    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+    PN_CPP_EXTERN void setId(uint64_t id);
+    PN_CPP_EXTERN uint64_t getId();
+    PN_CPP_EXTERN void setId(const std::string &id);
+    PN_CPP_EXTERN std::string getStringId();
+    PN_CPP_EXTERN void setId(const char *p, size_t len);
+    PN_CPP_EXTERN size_t getId(const char **p);
+    PN_CPP_EXTERN pn_type_t getIdType();
+
+    PN_CPP_EXTERN void setUserId(const std::string &id);
+    PN_CPP_EXTERN std::string getUserId();
+
+    PN_CPP_EXTERN void setAddress(const std::string &addr);
+    PN_CPP_EXTERN std::string getAddress();
+
+    PN_CPP_EXTERN void setSubject(const std::string &s);
+    PN_CPP_EXTERN std::string getSubject();
+
+    PN_CPP_EXTERN void setReplyTo(const std::string &s);
+    PN_CPP_EXTERN std::string getReplyTo();
+
+    PN_CPP_EXTERN void setCorrelationId(uint64_t id);
+    PN_CPP_EXTERN uint64_t getCorrelationId();
+    PN_CPP_EXTERN void setCorrelationId(const std::string &id);
+    PN_CPP_EXTERN std::string getStringCorrelationId();
+    PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
+    PN_CPP_EXTERN size_t getCorrelationId(const char **p);
+
+    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+    PN_CPP_EXTERN pn_type_t getCorrelationIdType();
+
+    PN_CPP_EXTERN void setContentType(const std::string &s);
+    PN_CPP_EXTERN std::string getContentType();
+
+    PN_CPP_EXTERN void setContentEncoding(const std::string &s);
+    PN_CPP_EXTERN std::string getContentEncoding();
+
+    PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
+    PN_CPP_EXTERN pn_timestamp_t getExpiry();
+
+    PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
+    PN_CPP_EXTERN pn_timestamp_t getCreationTime();
+
+    PN_CPP_EXTERN void setGroupId(const std::string &s);
+    PN_CPP_EXTERN std::string getGroupId();
+
+    PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
+    PN_CPP_EXTERN std::string getReplyToGroupId();
+
+    // FIXME aconway 2015-06-11: use Values for body.
+    PN_CPP_EXTERN void setBody(const std::string &data);
+    PN_CPP_EXTERN std::string getBody();
+
+    PN_CPP_EXTERN void getBody(std::string &str);
+
+    PN_CPP_EXTERN void setBody(const char *, size_t len);
+    PN_CPP_EXTERN size_t getBody(char *, size_t len);
+    PN_CPP_EXTERN size_t getBinaryBodySize();
+
+
+    PN_CPP_EXTERN void encode(std::string &data);
+    PN_CPP_EXTERN void decode(const std::string &data);
+
+  private:
+    friend class ProtonImplRef<Message>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
new file mode 100644
index 0000000..7c6fa79
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
@@ -0,0 +1,79 @@
+#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/ProtonHandler.hpp"
+#include "proton/MessagingHandler.hpp"
+
+#include "proton/MessagingEvent.hpp"
+#include "proton/event.h"
+#include "proton/reactor.h"
+
+namespace proton {
+namespace reactor {
+
+// Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
+
+
+class MessagingAdapter : public MessagingHandler
+{
+  public:
+    PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
+    PN_CPP_EXTERN virtual ~MessagingAdapter();
+    PN_CPP_EXTERN virtual void onReactorInit(Event &e);
+    PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
+    PN_CPP_EXTERN virtual void onDelivery(Event &e);
+    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionError(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onSessionError(Event &e);
+    PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
+    PN_CPP_EXTERN virtual void onLinkError(Event &e);
+    PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
+    PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
+  private:
+    MessagingHandler &delegate;  // The handler for generated MessagingEvent's
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
new file mode 100644
index 0000000..a73a7ad
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
@@ -0,0 +1,100 @@
+#ifndef PROTON_CPP_MESSAGINGEVENT_H
+#define PROTON_CPP_MESSAGINGEVENT_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/ProtonEvent.hpp"
+#include "proton/Link.hpp"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+typedef enum {
+    PN_MESSAGING_PROTON = 0,  // Wrapped pn_event_t
+    // Covenience events for C++ MessagingHandlers
+    PN_MESSAGING_ABORT,
+    PN_MESSAGING_ACCEPTED,
+    PN_MESSAGING_COMMIT,
+    PN_MESSAGING_CONNECTION_CLOSED,
+    PN_MESSAGING_CONNECTION_CLOSING,
+    PN_MESSAGING_CONNECTION_ERROR,
+    PN_MESSAGING_CONNECTION_OPENED,
+    PN_MESSAGING_CONNECTION_OPENING,
+    PN_MESSAGING_DISCONNECTED,
+    PN_MESSAGING_FETCH,
+    PN_MESSAGING_ID_LOADED,
+    PN_MESSAGING_LINK_CLOSED,
+    PN_MESSAGING_LINK_CLOSING,
+    PN_MESSAGING_LINK_OPENED,
+    PN_MESSAGING_LINK_OPENING,
+    PN_MESSAGING_LINK_ERROR,
+    PN_MESSAGING_MESSAGE,
+    PN_MESSAGING_QUIT,
+    PN_MESSAGING_RECORD_INSERTED,
+    PN_MESSAGING_RECORDS_LOADED,
+    PN_MESSAGING_REJECTED,
+    PN_MESSAGING_RELEASED,
+    PN_MESSAGING_REQUEST,
+    PN_MESSAGING_RESPONSE,
+    PN_MESSAGING_SENDABLE,
+    PN_MESSAGING_SESSION_CLOSED,
+    PN_MESSAGING_SESSION_CLOSING,
+    PN_MESSAGING_SESSION_OPENED,
+    PN_MESSAGING_SESSION_OPENING,
+    PN_MESSAGING_SESSION_ERROR,
+    PN_MESSAGING_SETTLED,
+    PN_MESSAGING_START,
+    PN_MESSAGING_TIMER,
+    PN_MESSAGING_TRANSACTION_ABORTED,
+    PN_MESSAGING_TRANSACTION_COMMITTED,
+    PN_MESSAGING_TRANSACTION_DECLARED,
+    PN_MESSAGING_TRANSPORT_CLOSED
+} MessagingEventType_t;
+
+class MessagingEvent : public ProtonEvent
+{
+  public:
+    MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+    MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
+    ~MessagingEvent();
+    virtual PN_CPP_EXTERN void dispatch(Handler &h);
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    virtual PN_CPP_EXTERN Message getMessage();
+    virtual PN_CPP_EXTERN void setMessage(Message &);
+  private:
+    MessagingEventType_t messagingType;
+    ProtonEvent *parentEvent;
+    Message *message;
+    MessagingEvent operator=(const MessagingEvent&);
+    MessagingEvent(const MessagingEvent&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGINGEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
new file mode 100644
index 0000000..ea712a6
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
@@ -0,0 +1,97 @@
+#ifndef PROTON_CPP_MESSAGING_HANDLER_H
+#define PROTON_CPP_MESSAGING_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/ProtonHandler.hpp"
+#include "proton/Acking.hpp"
+#include "proton/event.h"
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class MessagingAdapter;
+
+class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
+{
+  public:
+    PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+                                       bool peerCloseIsError=false);
+    virtual ~MessagingHandler();
+
+    virtual void onAbort(Event &e);
+    virtual void onAccepted(Event &e);
+    virtual void onCommit(Event &e);
+    virtual void onConnectionClosed(Event &e);
+    virtual void onConnectionClosing(Event &e);
+    virtual void onConnectionError(Event &e);
+    virtual void onConnectionOpening(Event &e);
+    virtual void onConnectionOpened(Event &e);
+    virtual void onDisconnected(Event &e);
+    virtual void onFetch(Event &e);
+    virtual void onIdLoaded(Event &e);
+    virtual void onLinkClosed(Event &e);
+    virtual void onLinkClosing(Event &e);
+    virtual void onLinkError(Event &e);
+    virtual void onLinkOpened(Event &e);
+    virtual void onLinkOpening(Event &e);
+    virtual void onMessage(Event &e);
+    virtual void onQuit(Event &e);
+    virtual void onRecordInserted(Event &e);
+    virtual void onRecordsLoaded(Event &e);
+    virtual void onRejected(Event &e);
+    virtual void onReleased(Event &e);
+    virtual void onRequest(Event &e);
+    virtual void onResponse(Event &e);
+    virtual void onSendable(Event &e);
+    virtual void onSessionClosed(Event &e);
+    virtual void onSessionClosing(Event &e);
+    virtual void onSessionError(Event &e);
+    virtual void onSessionOpened(Event &e);
+    virtual void onSessionOpening(Event &e);
+    virtual void onSettled(Event &e);
+    virtual void onStart(Event &e);
+    virtual void onTimer(Event &e);
+    virtual void onTransactionAborted(Event &e);
+    virtual void onTransactionCommitted(Event &e);
+    virtual void onTransactionDeclared(Event &e);
+    virtual void onTransportClosed(Event &e);
+  protected:
+    int prefetch;
+    bool autoAccept;
+    bool autoSettle;
+    bool peerCloseIsError;
+    MessagingAdapter *messagingAdapter;
+    Handler *flowController;
+    PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+                                       bool peerCloseIsError=false);
+  private:
+    friend class ContainerImpl;
+    friend class MessagingAdapter;
+    void createHelpers();
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_MESSAGING_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
new file mode 100644
index 0000000..88358c9
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
@@ -0,0 +1,57 @@
+#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/Event.hpp"
+#include "proton/Link.hpp"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+class Container;
+
+class ProtonEvent : public Event
+{
+  public:
+    virtual PN_CPP_EXTERN void dispatch(Handler &h);
+    virtual PN_CPP_EXTERN Container &getContainer();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    PN_CPP_EXTERN int getType();
+    PN_CPP_EXTERN pn_event_t* getPnEvent();
+  protected:
+    PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+  private:
+    pn_event_t *pnEvent;
+    int type;
+    Container &container;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
new file mode 100644
index 0000000..1170753
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
@@ -0,0 +1,68 @@
+#ifndef PROTON_CPP_PROTONHANDLE_H
+#define PROTON_CPP_PROTONHANDLE_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/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+template <class> class ProtonImplRef;
+
+/**
+ * See Handle.h.  Similar but for lightly wrapped Proton pn_object_t targets.
+ */
+template <class T> class ProtonHandle {
+  public:
+
+    /**@return true if handle is valid,  i.e. not null. */
+    PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+    /**@return true if handle is null. It is an error to call any function on a null handle. */
+    PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+    /** Conversion to bool supports idiom if (handle) { handle->... } */
+    PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+    PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+    void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+  private:
+    // Not implemented, subclasses must implement.
+    ProtonHandle(const ProtonHandle&);
+    ProtonHandle& operator=(const ProtonHandle&);
+
+  protected:
+    typedef T Impl;
+    PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
+
+    Impl* impl;
+
+  friend class ProtonImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_PROTONHANDLE_H*/


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


[45/50] [abbrv] qpid-proton git commit: PROTON-865: Added basic Terminus, Broker.cpp example

Posted by ac...@apache.org.
PROTON-865: Added basic Terminus, Broker.cpp example


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

Branch: refs/heads/cjansen-cpp-client
Commit: ab4b7b3c10c95980e5c0987591348b66ef977e3a
Parents: 183578d
Author: Clifford Jansen <cl...@apache.org>
Authored: Mon May 11 19:29:53 2015 -0700
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   4 +
 proton-c/bindings/cpp/examples/Broker.cpp       | 193 +++++++++++++++++++
 .../cpp/include/proton/cpp/Connection.h         |   1 +
 .../bindings/cpp/include/proton/cpp/Endpoint.h  |  11 ++
 .../bindings/cpp/include/proton/cpp/Handle.h    |   4 +
 proton-c/bindings/cpp/include/proton/cpp/Link.h |   6 +
 .../bindings/cpp/include/proton/cpp/Receiver.h  |   1 +
 .../bindings/cpp/include/proton/cpp/Sender.h    |   1 +
 .../bindings/cpp/include/proton/cpp/Terminus.h  |  81 ++++++++
 proton-c/bindings/cpp/src/Connection.cpp        |   4 +
 proton-c/bindings/cpp/src/ConnectionImpl.cpp    |  16 +-
 proton-c/bindings/cpp/src/ConnectionImpl.h      |   3 +-
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |   2 +
 proton-c/bindings/cpp/src/Link.cpp              |  31 ++-
 proton-c/bindings/cpp/src/Receiver.cpp          |   2 +
 proton-c/bindings/cpp/src/Sender.cpp            |   3 +
 proton-c/bindings/cpp/src/Terminus.cpp          | 102 ++++++++++
 17 files changed, 448 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index ba35cb1..54d8ddd 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -37,6 +37,7 @@ set (qpid-proton-cpp-core
     src/Event.cpp
     src/Handler.cpp
     src/Link.cpp
+    src/Terminus.cpp
     src/Acceptor.cpp
     src/Url.cpp
     src/Message.cpp
@@ -99,6 +100,9 @@ add_executable (SimpleRecv examples/SimpleRecv.cpp)
 target_link_libraries (SimpleRecv qpid-proton-cpp)
 add_executable (SimpleSend examples/SimpleSend.cpp)
 target_link_libraries (SimpleSend qpid-proton-cpp)
+add_executable (Broker examples/Broker.cpp)
+target_link_libraries (Broker qpid-proton-cpp)
+
 
 install (TARGETS qpid-proton-cpp
   EXPORT  proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/examples/Broker.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/examples/Broker.cpp b/proton-c/bindings/cpp/examples/Broker.cpp
new file mode 100644
index 0000000..7d5214d
--- /dev/null
+++ b/proton-c/bindings/cpp/examples/Broker.cpp
@@ -0,0 +1,193 @@
+/*
+ *
+ * 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/cpp/Container.h"
+#include "proton/cpp/MessagingHandler.h"
+
+#include <iostream>
+#include <deque>
+#include <map>
+#include <list>
+
+
+using namespace proton::reactor;
+
+std::string generateUuid(){
+    throw "TODO: platform neutral uuid";
+}
+
+class Queue {
+  public:
+    bool dynamic;
+    typedef std::deque<Message> MsgQ;
+    typedef std::list<Sender> List;
+    MsgQ queue;
+    List consumers;
+
+    Queue(bool dyn = false) : dynamic(dyn), queue(MsgQ()), consumers(List()) {}
+
+    void subscribe(Sender &c) {
+        consumers.push_back(c);
+    }
+
+    bool unsubscribe(Sender &c) {
+        consumers.remove(c);
+        return (consumers.size() == 0 && (dynamic || queue.size() == 0));
+    }
+
+    void publish(Message &m) {
+        queue.push_back(m);
+        dispatch(0);
+    }
+
+    void dispatch(Sender *s) {
+        while (deliverTo(s)) {
+        }
+    }
+
+    bool deliverTo(Sender *consumer) {
+        // deliver to single consumer if supplied, else all consumers
+        int count = consumer ? 1 : consumers.size();
+        if (!count) return false;
+        bool result = false;
+        List::iterator it = consumers.begin();
+        if (!consumer && count) consumer = &*it;
+
+        while (queue.size()) {
+            if (consumer->getCredit()) {
+                consumer->send(queue.front());
+                queue.pop_front();
+                result = true;
+            }
+            if (--count)
+                it++;
+            else
+                return result;
+        }
+        return false;
+    }
+};
+
+class Broker : public MessagingHandler {
+  private:
+    std::string url;
+    typedef std::map<std::string, Queue *> QMap;
+    QMap queues;
+  public:
+
+    Broker(const std::string &s) : url(s), queues(QMap()) {}
+
+    void onStart(Event &e) {
+        e.getContainer().listen(url);
+    }
+
+    Queue &queue(std::string &address) {
+        QMap::iterator it = queues.find(address);
+        if (it == queues.end()) {
+            queues[address] = new Queue();
+            return *queues[address];
+        }
+        else {
+            return *it->second;
+        }
+    }
+
+    void onLinkOpening(Event &e) {
+        Link lnk = e.getLink();
+        if (lnk.isSender()) {
+            Sender sender(lnk);
+            Terminus remoteSource(lnk.getRemoteSource());
+            if (remoteSource.isDynamic()) {
+                std::string address = generateUuid();
+                lnk.getSource().setAddress(address);
+                Queue *q = new Queue(true);
+                queues[address] = q;
+                q->subscribe(sender);
+            }
+            else {
+                std::string address = remoteSource.getAddress();
+                if (!address.empty()) {
+                    lnk.getSource().setAddress(address);
+                    queue(address).subscribe(sender);
+                }
+            }
+        }
+        else {
+            std::string address = lnk.getRemoteTarget().getAddress();
+            if (!address.empty())
+                lnk.getTarget().setAddress(address);
+        }
+    }
+
+    void unsubscribe (Sender &lnk) {
+        std::string address = lnk.getSource().getAddress();
+        QMap::iterator it = queues.find(address);
+        if (it != queues.end() && it->second->unsubscribe(lnk)) {
+            delete it->second;
+            queues.erase(it);
+        }
+    }
+
+    void onLinkClosing(Event &e) {
+        Link lnk = e.getLink();
+        if (lnk.isSender()) {
+            Sender s(lnk);
+            unsubscribe(s);
+        }
+    }
+
+    void onConnectionClosing(Event &e) {
+        removeStaleConsumers(e.getConnection());
+    }
+
+    void onDisconnected(Event &e) {
+        removeStaleConsumers(e.getConnection());
+    }
+
+    void removeStaleConsumers(Connection &connection) {
+        Link l = connection.getLinkHead(Endpoint::REMOTE_ACTIVE);
+        while (l) {
+            if (l.isSender()) {
+                Sender s(l);
+                unsubscribe(s);
+            }
+            l = l.getNext(Endpoint::REMOTE_ACTIVE);
+        }
+    }
+
+    void onSendable(Event &e) {
+        Link lnk = e.getLink();
+        Sender sender(lnk);
+        std::string addr = lnk.getSource().getAddress();
+        queue(addr).dispatch(&sender);
+    }
+
+    void onMessage(Event &e) {
+        std::string addr = e.getLink().getTarget().getAddress();
+        Message msg = e.getMessage();
+        queue(addr).publish(msg);
+    }
+};
+
+int main(int argc, char **argv) {
+    Broker hw("localhost:5672");
+    Container(hw).run();
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
index 7d97ebb..86abbe6 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
@@ -57,6 +57,7 @@ class Connection : public Endpoint, public Handle<ConnectionImpl>
     PROTON_CPP_EXTERN Container &getContainer();
     PROTON_CPP_EXTERN std::string getHostname();
     virtual PROTON_CPP_EXTERN Connection &getConnection();
+    PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
   private:
    friend class PrivateImplRef<Connection>;
    friend class Connector;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
index 9992eff..fc1a712 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
@@ -22,6 +22,7 @@
  *
  */
 #include "proton/cpp/ImportExport.h"
+#include "proton/connection.h"
 
 namespace proton {
 namespace reactor {
@@ -33,6 +34,16 @@ class Transport;
 class Endpoint
 {
   public:
+    enum {
+        LOCAL_UNINIT = PN_LOCAL_UNINIT,
+        REMOTE_UNINIT = PN_REMOTE_UNINIT,
+        LOCAL_ACTIVE = PN_LOCAL_ACTIVE,
+        REMOTE_ACTIVE = PN_REMOTE_ACTIVE,
+        LOCAL_CLOSED = PN_LOCAL_CLOSED,
+        REMOTE_CLOSED  = PN_REMOTE_CLOSED
+    };
+    typedef int State;
+
     // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
     virtual PROTON_CPP_EXTERN Connection &getConnection() = 0;
     Transport PROTON_CPP_EXTERN &getTransport();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
index 632e30e..77b7814 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
@@ -51,6 +51,10 @@ template <class T> class Handle {
     /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
     PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
 
+    /** Operator ==  equal if they point to same non-null object*/
+    PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
+    PROTON_CPP_INLINE_EXTERN bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
+
     void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
 
   private:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
index 21b1ca2..265d80d 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Link.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Link.h
@@ -24,6 +24,7 @@
 #include "proton/cpp/ImportExport.h"
 #include "proton/cpp/ProtonHandle.h"
 #include "proton/cpp/Endpoint.h"
+#include "proton/cpp/Terminus.h"
 #include "proton/types.h"
 #include <string>
 
@@ -45,8 +46,13 @@ class Link : public Endpoint, public ProtonHandle<pn_link_t>
     PROTON_CPP_EXTERN bool isSender();
     PROTON_CPP_EXTERN bool isReceiver();
     PROTON_CPP_EXTERN int getCredit();
+    PROTON_CPP_EXTERN Terminus getSource();
+    PROTON_CPP_EXTERN Terminus getTarget();
+    PROTON_CPP_EXTERN Terminus getRemoteSource();
+    PROTON_CPP_EXTERN Terminus getRemoteTarget();
     PROTON_CPP_EXTERN pn_link_t *getPnLink() const;
     virtual PROTON_CPP_EXTERN Connection &getConnection();
+    PROTON_CPP_EXTERN Link getNext(Endpoint::State mask);
   protected:
     virtual void verifyType(pn_link_t *l);
   private:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
index 197cfb1..c904dc9 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
@@ -37,6 +37,7 @@ class Receiver : public Link
   public:
     PROTON_CPP_EXTERN Receiver(pn_link_t *lnk);
     PROTON_CPP_EXTERN Receiver();
+    PROTON_CPP_EXTERN Receiver(const Link& c);
   protected:
     virtual void verifyType(pn_link_t *l);
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
index fa8cce8..9b8683d 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
@@ -39,6 +39,7 @@ class Sender : public Link
   public:
     PROTON_CPP_EXTERN Sender(pn_link_t *lnk);
     PROTON_CPP_EXTERN Sender();
+    PROTON_CPP_EXTERN Sender(const Link& c);
     PROTON_CPP_EXTERN void send(Message &m);
   protected:
     virtual void verifyType(pn_link_t *l);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
new file mode 100644
index 0000000..092fcc1
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
@@ -0,0 +1,81 @@
+#ifndef PROTON_CPP_TERMINUS_H
+#define PROTON_CPP_TERMINUS_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/cpp/ImportExport.h"
+#include "proton/cpp/Link.h"
+
+#include "proton/link.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class Link;
+
+class Terminus : public ProtonHandle<pn_terminus_t>
+{
+    enum Type {
+        TYPE_UNSPECIFIED = PN_UNSPECIFIED,
+        SOURCE = PN_SOURCE,
+        TARGET = PN_TARGET,
+        COORDINATOR = PN_COORDINATOR
+    };
+    enum ExpiryPolicy {
+        NONDURABLE = PN_NONDURABLE,
+        CONFIGURATION = PN_CONFIGURATION,
+        DELIVERIES = PN_DELIVERIES
+    };
+    enum DistributionMode {
+        MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED,
+        COPY = PN_DIST_MODE_COPY,
+        MOVE = PN_DIST_MODE_MOVE
+    };
+
+  public:
+    PROTON_CPP_EXTERN Terminus();
+    PROTON_CPP_EXTERN ~Terminus();
+    PROTON_CPP_EXTERN Terminus(const Terminus&);
+    PROTON_CPP_EXTERN Terminus& operator=(const Terminus&);
+    PROTON_CPP_EXTERN pn_terminus_t *getPnTerminus();
+    PROTON_CPP_EXTERN Type getType();
+    PROTON_CPP_EXTERN void setType(Type);
+    PROTON_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
+    PROTON_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
+    PROTON_CPP_EXTERN DistributionMode getDistributionMode();
+    PROTON_CPP_EXTERN void setDistributionMode(DistributionMode);
+    PROTON_CPP_EXTERN std::string getAddress();
+    PROTON_CPP_EXTERN void setAddress(std::string &);
+    PROTON_CPP_EXTERN bool isDynamic();
+    PROTON_CPP_EXTERN void setDynamic(bool);
+
+  private:
+    Link *link;
+    PROTON_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
+    friend class Link;
+    friend class ProtonImplRef<Terminus>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_TERMINUS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Connection.cpp b/proton-c/bindings/cpp/src/Connection.cpp
index 49d171e..1db8fbc 100644
--- a/proton-c/bindings/cpp/src/Connection.cpp
+++ b/proton-c/bindings/cpp/src/Connection.cpp
@@ -66,4 +66,8 @@ Connection &Connection::getConnection() {
 
 Container &Connection::getContainer() { return impl->getContainer(); }
 
+Link Connection::getLinkHead(Endpoint::State mask) {
+    return impl->getLinkHead(mask);
+}
+
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/ConnectionImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.cpp b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
index be01f8d..9cadffe 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.cpp
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.cpp
@@ -41,10 +41,12 @@ void ConnectionImpl::decref(ConnectionImpl *impl) {
         delete impl;
 }
 
-ConnectionImpl::ConnectionImpl(Container &c) : container(c), refCount(0), override(0), transport(0), defaultSession(0),
-                                               pnConnection(pn_reactor_connection(container.getReactor(), NULL)),
+ConnectionImpl::ConnectionImpl(Container &c, pn_connection_t *pnConn) : container(c), refCount(0), override(0), transport(0), defaultSession(0),
+                                               pnConnection(pnConn),
                                                reactorReference(this)
 {
+    if (!pnConnection)
+        pnConnection = pn_reactor_connection(container.getReactor(), NULL);
     setConnectionContext(pnConnection, this);
 }
 
@@ -110,12 +112,14 @@ Connection &ConnectionImpl::getReactorReference(pn_connection_t *conn) {
         Container container(getContainerContext(reactor));
         if (!container)  // can't be one created by our container
             throw ProtonException(MSG("Unknown Proton connection specifier"));
-        Connection connection(container);
-        impl = connection.impl;
-        setConnectionContext(conn, impl);
-        impl->reactorReference = connection;
+        impl = new ConnectionImpl(container, conn);
     }
     return impl->reactorReference;
 }
 
+Link ConnectionImpl::getLinkHead(Endpoint::State mask) {
+    return Link(pn_link_head(pnConnection, mask));
+}
+
+
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
index ad8d71e..11b5765 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -39,7 +39,7 @@ class Container;
 class ConnectionImpl : public Endpoint
 {
   public:
-    PROTON_CPP_EXTERN ConnectionImpl(Container &c);
+    PROTON_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t *pnConn = 0);
     PROTON_CPP_EXTERN ~ConnectionImpl();
     PROTON_CPP_EXTERN Transport &getTransport();
     PROTON_CPP_EXTERN Handler *getOverride();
@@ -49,6 +49,7 @@ class ConnectionImpl : public Endpoint
     PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
     PROTON_CPP_EXTERN Container &getContainer();
     PROTON_CPP_EXTERN std::string getHostname();
+    PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
     virtual PROTON_CPP_EXTERN Connection &getConnection();
     static Connection &getReactorReference(pn_connection_t *);
     static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index d1339f0..1cabf6c 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -122,6 +122,8 @@ class OverrideHandler : public Handler
             ConnectionImpl *cimpl = getConnectionContext(conn);
             if (cimpl)
                 cimpl->reactorDetach();
+            // TODO: remember all connections and do reactorDetach of zombies connections
+            // not pn_connection_release'd at PN_REACTOR_FINAL.
         }
     }
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/Link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Link.cpp b/proton-c/bindings/cpp/src/Link.cpp
index 3356b38..aab01d9 100644
--- a/proton-c/bindings/cpp/src/Link.cpp
+++ b/proton-c/bindings/cpp/src/Link.cpp
@@ -33,12 +33,6 @@
 namespace proton {
 namespace reactor {
 
-namespace {
-
-static inline void throwIfNull(pn_link_t *l) { if (!l) throw ProtonException(MSG("Disassociated link")); }
-
-}
-
 template class ProtonHandle<pn_link_t>;
 typedef ProtonImplRef<Link> PI;
 
@@ -67,12 +61,10 @@ void Link::verifyType(pn_link_t *l) {} // Generic link can be sender or receiver
 pn_link_t *Link::getPnLink() const { return impl; }
 
 void Link::open() {
-    throwIfNull(impl);
     pn_link_open(impl);
 }
 
 void Link::close() {
-    throwIfNull(impl);
     pn_link_close(impl);
 }
 
@@ -85,15 +77,34 @@ bool Link::isReceiver() {
 }
 
 int Link::getCredit() {
-    throwIfNull(impl);
     return pn_link_credit(impl);
 }
 
+Terminus Link::getSource() {
+    return Terminus(pn_link_source(impl), this);
+}
+
+Terminus Link::getTarget() {
+    return Terminus(pn_link_target(impl), this);
+}
+
+Terminus Link::getRemoteSource() {
+    return Terminus(pn_link_remote_source(impl), this);
+}
+
+Terminus Link::getRemoteTarget() {
+    return Terminus(pn_link_remote_target(impl), this);
+}
+
 Connection &Link::getConnection() {
-    throwIfNull(impl);
     pn_session_t *s = pn_link_session(impl);
     pn_connection_t *c = pn_session_connection(s);
     return ConnectionImpl::getReactorReference(c);
 }
 
+Link Link::getNext(Endpoint::State mask) {
+
+    return Link(pn_link_next(impl, (pn_state_t) mask));
+}
+
 }} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/Receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Receiver.cpp b/proton-c/bindings/cpp/src/Receiver.cpp
index 557e736..ad9a6d1 100644
--- a/proton-c/bindings/cpp/src/Receiver.cpp
+++ b/proton-c/bindings/cpp/src/Receiver.cpp
@@ -34,6 +34,8 @@ namespace reactor {
 Receiver::Receiver(pn_link_t *lnk) : Link(lnk) {}
 Receiver::Receiver() : Link(0) {}
 
+Receiver::Receiver(const Link& c) : Link(c.getPnLink()) {}
+
 void Receiver::verifyType(pn_link_t *lnk) {
     if (lnk && pn_link_is_sender(lnk))
         throw ProtonException(MSG("Creating receiver with sender context"));

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/Sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Sender.cpp b/proton-c/bindings/cpp/src/Sender.cpp
index 74d4b0f..c521ad1 100644
--- a/proton-c/bindings/cpp/src/Sender.cpp
+++ b/proton-c/bindings/cpp/src/Sender.cpp
@@ -46,6 +46,9 @@ void Sender::verifyType(pn_link_t *lnk) {
         throw ProtonException(MSG("Creating sender with receiver context"));
 }
 
+Sender::Sender(const Link& c) : Link(c.getPnLink()) {}
+
+
 namespace{
 // revisit if thread safety required
 uint64_t tagCounter = 0;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ab4b7b3c/proton-c/bindings/cpp/src/Terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Terminus.cpp b/proton-c/bindings/cpp/src/Terminus.cpp
new file mode 100644
index 0000000..f66979e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Terminus.cpp
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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/cpp/Link.h"
+#include "proton/link.h"
+
+namespace proton {
+namespace reactor {
+
+template class ProtonHandle<pn_terminus_t>;
+typedef ProtonImplRef<Terminus> PI;
+
+// Note: the pn_terminus_t is not ref counted.  We count the parent link.
+
+Terminus::Terminus() : link(0) {
+    impl = 0;
+}
+
+Terminus::Terminus(pn_terminus_t *p, Link *l) : link(l) {
+    impl = p;
+    pn_incref(link->getPnLink());
+}
+Terminus::Terminus(const Terminus& c) : ProtonHandle<pn_terminus_t>() {
+    impl = c.impl;
+    link = c.link;
+    pn_incref(link->getPnLink());
+}
+Terminus& Terminus::operator=(const Terminus& c) {
+    if (impl == c.impl) return *this;
+    if (impl) pn_decref(link->getPnLink());
+    impl = c.impl;
+    link = c.link;
+    pn_incref(link->getPnLink());
+    return *this;
+}
+Terminus::~Terminus() {
+    if (impl)
+        pn_decref(link->getPnLink());
+}
+
+pn_terminus_t *Terminus::getPnTerminus() { return impl; }
+
+Terminus::Type Terminus::getType() {
+    return (Type) pn_terminus_get_type(impl);
+}
+
+void Terminus::setType(Type type) {
+    pn_terminus_set_type(impl, (pn_terminus_type_t) type);
+}
+
+Terminus::ExpiryPolicy Terminus::getExpiryPolicy() {
+    return (ExpiryPolicy) pn_terminus_get_type(impl);
+}
+
+void Terminus::setExpiryPolicy(ExpiryPolicy policy) {
+    pn_terminus_set_expiry_policy(impl, (pn_expiry_policy_t) policy);
+}
+
+Terminus::DistributionMode Terminus::getDistributionMode() {
+    return (DistributionMode) pn_terminus_get_type(impl);
+}
+
+void Terminus::setDistributionMode(DistributionMode mode) {
+    pn_terminus_set_distribution_mode(impl, (pn_distribution_mode_t) mode);
+}
+
+std::string Terminus::getAddress() {
+    const char *addr = pn_terminus_get_address(impl);
+    return addr ? std::string(addr) : std::string();
+}
+
+void Terminus::setAddress(std::string &addr) {
+    pn_terminus_set_address(impl, addr.c_str());
+}
+
+bool Terminus::isDynamic() {
+    return (Type) pn_terminus_is_dynamic(impl);
+}
+
+void Terminus::setDynamic(bool d) {
+    pn_terminus_set_dynamic(impl, d);
+}
+
+}} // namespace proton::reactor


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


[42/50] [abbrv] qpid-proton git commit: PROTON-865: Remove duplicate UUID code.

Posted by ac...@apache.org.
PROTON-865: Remove duplicate UUID code.

There's no need UUID generation in the binding now (container-id is not required.)
If it arises later we should use proton's UUID code, not duplicate it in the binding.


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

Branch: refs/heads/cjansen-cpp-client
Commit: c99be7a2ba0cbf2966f4c995803808a103345bfe
Parents: ea25883
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Jun 11 18:49:01 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt        | 99 ++++++++++--------------
 proton-c/bindings/cpp/src/Container.cpp     |  1 -
 proton-c/bindings/cpp/src/ContainerImpl.cpp |  5 +-
 proton-c/bindings/cpp/src/grep              |  3 -
 proton-c/bindings/cpp/src/platform.cpp      | 81 -------------------
 proton-c/bindings/cpp/src/platform.h        | 39 ----------
 proton-c/bindings/cpp/src/pn_data.h         | 30 -------
 7 files changed, 42 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 6cad69f..cc1c74a 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -22,64 +22,45 @@
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
 
-set (qpid-proton-cpp-platform
-  "src/platform"
-  )
-
-set (qpid-proton-cpp-core
-    src/Acceptor.cpp
-    src/Acking.cpp
-    src/Connection.cpp
-    src/ConnectionImpl.cpp
-    src/Connector.cpp
-    src/Connector.h
-    src/Container.cpp
-    src/ContainerImpl.cpp
-    src/Data.cpp
-    src/Decoder.cpp
-    src/Delivery.cpp
-    src/Duration.cpp
-    src/Encoder.cpp
-    src/Endpoint.cpp
-    src/Event.cpp
-    src/Handler.cpp
-    src/Link.cpp
-    src/Message.cpp
-    src/MessagingAdapter.cpp
-    src/MessagingEvent.cpp
-    src/MessagingHandler.cpp
-    src/ProtonEvent.cpp
-    src/ProtonHandler.cpp
-    src/Receiver.cpp
-    src/Sender.cpp
-    src/Session.cpp
-    src/Terminus.cpp
-    src/Transport.cpp
-    src/Url.cpp
-    src/Value.cpp
-    src/proton_bits.cpp
-    src/blocking/BlockingConnection.cpp
-    src/blocking/BlockingConnectionImpl.cpp
-    src/blocking/BlockingLink.cpp
-    src/blocking/BlockingSender.cpp
-    src/contexts.cpp
-    src/types.cpp
-  )
-
-set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX)
-set_source_files_properties (
-  ${qpid-proton-cpp-platform}
-  PROPERTIES
-  COMPILE_FLAGS "${COMPILE_PLATFORM_FLAGS}"
-  COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
-  )
-
 add_library (
   qpid-proton-cpp SHARED
-
-  ${qpid-proton-cpp-core}
-  ${qpid-proton-cpp-platform}
-
+  src/Acceptor.cpp
+  src/Acking.cpp
+  src/Connection.cpp
+  src/ConnectionImpl.cpp
+  src/Connector.cpp
+  src/Connector.h
+  src/Container.cpp
+  src/ContainerImpl.cpp
+  src/Data.cpp
+  src/Decoder.cpp
+  src/Delivery.cpp
+  src/Duration.cpp
+  src/Encoder.cpp
+  src/Endpoint.cpp
+  src/Event.cpp
+  src/Handler.cpp
+  src/Link.cpp
+  src/Message.cpp
+  src/MessagingAdapter.cpp
+  src/MessagingEvent.cpp
+  src/MessagingHandler.cpp
+  src/ProtonEvent.cpp
+  src/ProtonHandler.cpp
+  src/Receiver.cpp
+  src/Sender.cpp
+  src/Session.cpp
+  src/Terminus.cpp
+  src/Transport.cpp
+  src/Url.cpp
+  src/Value.cpp
+  src/proton_bits.cpp
+  src/blocking/BlockingConnection.cpp
+  src/blocking/BlockingConnectionImpl.cpp
+  src/blocking/BlockingLink.cpp
+  src/blocking/BlockingSender.cpp
+  src/contexts.cpp
+  src/types.cpp
   )
 
 target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
@@ -103,9 +84,9 @@ macro(add_cpp_test test)
   target_link_libraries (${test} qpid-proton qpid-proton-cpp)
   if (CMAKE_SYSTEM_NAME STREQUAL Windows)
     add_test (NAME cpp_${test}
-              COMMAND ${env_py}
-                "PATH=$<TARGET_FILE_DIR:qpid-proton>"
-                ${test}> ${ARGN})
+      COMMAND ${env_py}
+      "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+      ${test}> ${ARGN})
   else ()
     add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${test} ${ARGN})
   endif ()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/Container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Container.cpp b/proton-c/bindings/cpp/src/Container.cpp
index 5a551a1..3ae1963 100644
--- a/proton-c/bindings/cpp/src/Container.cpp
+++ b/proton-c/bindings/cpp/src/Container.cpp
@@ -31,7 +31,6 @@
 #include "Connector.h"
 #include "contexts.h"
 #include "Url.h"
-#include "platform.h"
 
 #include "proton/connection.h"
 #include "proton/session.h"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index ce69928..61fc860 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -32,7 +32,6 @@
 #include "Connector.h"
 #include "contexts.h"
 #include "Url.h"
-#include "platform.h"
 #include "PrivateImplRef.h"
 
 #include "proton/connection.h"
@@ -192,13 +191,13 @@ void ContainerImpl::decref(ContainerImpl *impl) {
 
 ContainerImpl::ContainerImpl(Handler &h) :
     reactor(0), handler(&h), messagingAdapter(0),
-    overrideHandler(0), flowController(0), containerId(generateUuid()),
+    overrideHandler(0), flowController(0), containerId(),
     refCount(0)
 {}
 
 ContainerImpl::ContainerImpl() :
     reactor(0), handler(0), messagingAdapter(0),
-    overrideHandler(0), flowController(0), containerId(generateUuid()),
+    overrideHandler(0), flowController(0), containerId(),
     refCount(0)
 {}
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/grep
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/grep b/proton-c/bindings/cpp/src/grep
index a53cfb8..6be6b10 100644
--- a/proton-c/bindings/cpp/src/grep
+++ b/proton-c/bindings/cpp/src/grep
@@ -32,9 +32,6 @@
   -rw-rw-r--. 1 aconway aconway  5864 Jun 10 08:40 MessagingEvent.cpp
   -rw-rw-r--. 1 aconway aconway  5230 Jun 10 08:40 MessagingHandler.cpp
   -rw-rw-r--. 1 aconway aconway  2587 Jun 10 08:40 Msg.h
-  -rw-rw-r--. 1 aconway aconway  2208 Jun 10 08:40 platform.cpp
-  -rw-rw-r--. 1 aconway aconway  1145 Jun 10 08:40 platform.h
-  -rw-rw-r--. 1 aconway aconway  1072 Jun 11 11:49 pn_data.h
   -rw-rw-r--. 1 aconway aconway  3000 Jun 10 08:40 PrivateImplRef.h
   -rw-rw-r--. 1 aconway aconway  6032 Jun 10 08:40 ProtonEvent.cpp
   -rw-rw-r--. 1 aconway aconway  3818 Jun 10 08:40 ProtonHandler.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/platform.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/platform.cpp b/proton-c/bindings/cpp/src/platform.cpp
deleted file mode 100644
index 80e3d51..0000000
--- a/proton-c/bindings/cpp/src/platform.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * 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 "platform.h"
-#include <string>
-
-// FIXME aconway 2015-06-09: probably don't need UUIDs in the binding.
-
-// Copy neccesary platform neutral functionality from Proton-C
-// TODO: make this sensibly maintainable (even though it is mostly static)
-
-#ifdef USE_UUID_GENERATE
-#include <uuid/uuid.h>
-#include <stdlib.h>
-char* pn_i_genuuid(void) {
-    char *generated = (char *) malloc(37*sizeof(char));
-    uuid_t uuid;
-    uuid_generate(uuid);
-    uuid_unparse(uuid, generated);
-    return generated;
-}
-#elif USE_UUID_CREATE
-#include <uuid.h>
-char* pn_i_genuuid(void) {
-    char *generated;
-    uuid_t uuid;
-    uint32_t rc;
-    uuid_create(&uuid, &rc);
-    // Under FreeBSD the returned string is newly allocated from the heap
-    uuid_to_string(&uuid, &generated, &rc);
-    return generated;
-}
-#elif USE_WIN_UUID
-#include <rpc.h>
-char* pn_i_genuuid(void) {
-    unsigned char *generated;
-    UUID uuid;
-    UuidCreate(&uuid);
-    UuidToString(&uuid, &generated);
-    char* r = pn_strdup((const char*)generated);
-    RpcStringFree(&generated);
-    return r;
-}
-#else
-#error "Don't know how to generate uuid strings on this platform"
-#endif
-
-
-
-namespace proton {
-namespace reactor {
-
-// include Proton-c platform routines into a local namespace
-
-
-std::string generateUuid() {
-    char *s = pn_i_genuuid();
-    std::string url(s);
-    free(s);
-    return url;
-}
-
-}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/platform.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/platform.h b/proton-c/bindings/cpp/src/platform.h
deleted file mode 100644
index 5e5b726..0000000
--- a/proton-c/bindings/cpp/src/platform.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef PROTON_CPP_PLATFORM_H
-#define PROTON_CPP_PLATFORM_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/cpp/ProtonHandler.h"
-#include "proton/event.h"
-#include "proton/reactor.h"
-#include <string>
-
-
-namespace proton {
-namespace reactor {
-
-std::string generateUuid();
-// Todo: TimeNow();
-
-}} // namespace proton::reactor
-
-#endif  /*!PROTON_CPP_PLATFORM_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c99be7a2/proton-c/bindings/cpp/src/pn_data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/pn_data.h b/proton-c/bindings/cpp/src/pn_data.h
deleted file mode 100644
index 371d82c..0000000
--- a/proton-c/bindings/cpp/src/pn_data.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef PN_DATA_H
-#define PN_DATA_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.
- */
-
-// Some routines for handling pn_data_t
-
-std::ostream& operator<<(std::ostream& o, const Value& v) {
-    pn_string_t* str = pn_string("");
-    pn_inspect(v.data, str);
-    return o << pn_string_get(str);
-}
-
-#endif // PN_DATA_H


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


[11/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Timeout mixin to the Ruby APIs.

Posted by ac...@apache.org.
PROTON-781: Added the Timeout mixin to the Ruby APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 44ad0ffba6cc17456a966c38ea196f65fd7ec0d7
Parents: 2fea22a
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Mar 2 15:42:20 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb  |  1 +
 proton-c/bindings/ruby/lib/util/timeout.rb | 50 +++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/44ad0ffb/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 5b0d23f..0c84f20 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -40,6 +40,7 @@ require "util/wrapper"
 require "util/class_wrapper"
 require "util/engine"
 require "util/uuid"
+require "util/timeout"
 
 # Types
 require "types/strings"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/44ad0ffb/proton-c/bindings/ruby/lib/util/timeout.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/timeout.rb b/proton-c/bindings/ruby/lib/util/timeout.rb
new file mode 100644
index 0000000..f4647f5
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/util/timeout.rb
@@ -0,0 +1,50 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Util
+
+  # Provides methods for converting between milliseconds, seconds
+  # and timeout values.
+  #
+  # @private
+  module Timeout
+
+    def sec_to_millis(s)
+      return (s * 1000).to_int
+    end
+
+    def millis_to_sec(ms)
+      return (ms.to_f / 1000.0).to_int
+    end
+
+    def timeout_to_millis(s)
+      return Cproton::PN_MILLIS_MAX if s.nil?
+
+      return sec_to_millis(s)
+    end
+
+    def millis_to_timeout(ms)
+      return nil if ms == Cproton::PN_MILLIS_MAX
+
+      return millis_to_sec(ms)
+    end
+
+  end
+
+end


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


[29/50] [abbrv] qpid-proton git commit: PROTON-865: Message properties, Acking and Delivery

Posted by ac...@apache.org.
PROTON-865: Message properties, Acking and Delivery


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

Branch: refs/heads/cjansen-cpp-client
Commit: 183578d71c35081c6588c843b207f0c86f74ba4d
Parents: 40b63a1
Author: Clifford Jansen <cl...@apache.org>
Authored: Thu May 7 07:06:43 2015 -0700
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   2 +
 .../bindings/cpp/include/proton/cpp/Acking.h    |  44 ++++
 .../bindings/cpp/include/proton/cpp/Delivery.h  |  61 +++++
 .../bindings/cpp/include/proton/cpp/Message.h   |  44 ++++
 .../cpp/include/proton/cpp/MessagingAdapter.h   |   3 +-
 .../cpp/include/proton/cpp/MessagingHandler.h   |  15 +-
 proton-c/bindings/cpp/src/Acking.cpp            |  49 ++++
 proton-c/bindings/cpp/src/ContainerImpl.cpp     |   5 +-
 proton-c/bindings/cpp/src/ContainerImpl.h       |   2 +-
 proton-c/bindings/cpp/src/Delivery.cpp          |  57 +++++
 proton-c/bindings/cpp/src/Message.cpp           | 234 ++++++++++++++++++-
 proton-c/bindings/cpp/src/MessagingAdapter.cpp  |  15 +-
 proton-c/bindings/cpp/src/MessagingHandler.cpp  |   9 +-
 13 files changed, 521 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 68baad7..ba35cb1 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -48,6 +48,8 @@ set (qpid-proton-cpp-core
     src/Receiver.cpp
     src/Sender.cpp
     src/Session.cpp
+    src/Delivery.cpp
+    src/Acking.cpp
     src/Transport.cpp
     src/Logger.cpp
     src/contexts.cpp

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/include/proton/cpp/Acking.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acking.h b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
new file mode 100644
index 0000000..d40d7d4
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
@@ -0,0 +1,44 @@
+#ifndef PROTON_CPP_ACKING_H
+#define PROTON_CPP_ACKING_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/cpp/ImportExport.h"
+#include "proton/cpp/Delivery.h"
+
+namespace proton {
+namespace reactor {
+
+
+class Acking
+{
+  public:
+    PROTON_CPP_EXTERN virtual void accept(Delivery &d);
+    PROTON_CPP_EXTERN virtual void reject(Delivery &d);
+    PROTON_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
+    PROTON_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_ACKING_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
new file mode 100644
index 0000000..a1965f6
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
@@ -0,0 +1,61 @@
+#ifndef PROTON_CPP_DELIVERY_H
+#define PROTON_CPP_DELIVERY_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/cpp/ImportExport.h"
+#include "proton/cpp/Link.h"
+
+#include "ProtonImplRef.h"
+#include "proton/disposition.h"
+
+namespace proton {
+namespace reactor {
+
+class Delivery : public ProtonHandle<pn_delivery_t>
+{
+  public:
+
+    enum state {
+        NONE = 0,
+        RECEIVED = PN_RECEIVED,
+        ACCEPTED = PN_ACCEPTED,
+        REJECTED = PN_REJECTED,
+        RELEASED = PN_RELEASED,
+        MODIFIED = PN_MODIFIED
+    };  // AMQP spec 3.4 Delivery State
+
+    PROTON_CPP_EXTERN Delivery(pn_delivery_t *d);
+    PROTON_CPP_EXTERN Delivery();
+    PROTON_CPP_EXTERN ~Delivery();
+    PROTON_CPP_EXTERN Delivery(const Delivery&);
+    PROTON_CPP_EXTERN Delivery& operator=(const Delivery&);
+    PROTON_CPP_EXTERN bool settled();
+    PROTON_CPP_EXTERN void settle();
+    PROTON_CPP_EXTERN pn_delivery_t *getPnDelivery();
+  private:
+    friend class ProtonImplRef<Delivery>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_DELIVERY_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
index ae29ca2..590fdd8 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Message.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Message.h
@@ -43,8 +43,52 @@ class Message : public ProtonHandle<pn_message_t>
 
     PROTON_CPP_EXTERN void setId(uint64_t id);
     PROTON_CPP_EXTERN uint64_t getId();
+    PROTON_CPP_EXTERN void setId(const std::string &id);
+    PROTON_CPP_EXTERN std::string getStringId();
+    PROTON_CPP_EXTERN void setId(const char *p, size_t len);
+    PROTON_CPP_EXTERN size_t getId(const char **p);
+    // TODO: UUID version
     PROTON_CPP_EXTERN pn_type_t getIdType();
 
+    PROTON_CPP_EXTERN void setUserId(const std::string &id);
+    PROTON_CPP_EXTERN std::string getUserId();
+
+    PROTON_CPP_EXTERN void setAddress(const std::string &addr);
+    PROTON_CPP_EXTERN std::string getAddress();
+
+    PROTON_CPP_EXTERN void setSubject(const std::string &s);
+    PROTON_CPP_EXTERN std::string getSubject();
+
+    PROTON_CPP_EXTERN void setReplyTo(const std::string &s);
+    PROTON_CPP_EXTERN std::string getReplyTo();
+
+    PROTON_CPP_EXTERN void setCorrelationId(uint64_t id);
+    PROTON_CPP_EXTERN uint64_t getCorrelationId();
+    PROTON_CPP_EXTERN void setCorrelationId(const std::string &id);
+    PROTON_CPP_EXTERN std::string getStringCorrelationId();
+    PROTON_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
+    PROTON_CPP_EXTERN size_t getCorrelationId(const char **p);
+    // TODO: UUID version
+    PROTON_CPP_EXTERN pn_type_t getCorrelationIdType();
+
+    PROTON_CPP_EXTERN void setContentType(const std::string &s);
+    PROTON_CPP_EXTERN std::string getContentType();
+
+    PROTON_CPP_EXTERN void setContentEncoding(const std::string &s);
+    PROTON_CPP_EXTERN std::string getContentEncoding();
+
+    PROTON_CPP_EXTERN void setExpiry(pn_timestamp_t t);
+    PROTON_CPP_EXTERN pn_timestamp_t getExpiry();
+
+    PROTON_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
+    PROTON_CPP_EXTERN pn_timestamp_t getCreationTime();
+
+    PROTON_CPP_EXTERN void setGroupId(const std::string &s);
+    PROTON_CPP_EXTERN std::string getGroupId();
+
+    PROTON_CPP_EXTERN void setReplyToGroupId(const std::string &s);
+    PROTON_CPP_EXTERN std::string getReplyToGroupId();
+
     PROTON_CPP_EXTERN void setBody(const std::string &data);
     PROTON_CPP_EXTERN std::string getBody();
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
index ac8b483..36a92e4 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -70,8 +70,7 @@ class MessagingAdapter : public MessagingHandler
     PROTON_CPP_EXTERN virtual void onLinkOpening(Event &e);
     PROTON_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
   private:
-    MessagingHandler &delegate;  // The actual MessagingHandler
-    pn_handler_t *handshaker;
+    MessagingHandler &delegate;  // The handler for generated MessagingEvent's
     bool autoSettle;
     bool autoAccept;
     bool peerCloseIsError;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index 51f679a..4f00681 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -23,6 +23,7 @@
  */
 
 #include "proton/cpp/ProtonHandler.h"
+#include "proton/cpp/Acking.h"
 #include "proton/event.h"
 
 namespace proton {
@@ -30,11 +31,11 @@ namespace reactor {
 
 class Event;
 
-class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler
+class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
 {
   public:
-    PROTON_CPP_EXTERN MessagingHandler();
-//ZZZ    PROTON_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, autoSettle=true, peerCloseIsError=false);
+    PROTON_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+                                       bool peerCloseIsError=false);
     virtual ~MessagingHandler();
 
     virtual void onAbort(Event &e);
@@ -74,6 +75,14 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler
     virtual void onTransactionCommitted(Event &e);
     virtual void onTransactionDeclared(Event &e);
     virtual void onTransportClosed(Event &e);
+  protected:
+    int prefetch;
+    bool autoSettle;
+    bool autoAccept;
+    bool peerCloseIsError;
+  private:
+    friend class ContainerImpl;
+    friend class MessagingAdapter;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/Acking.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Acking.cpp b/proton-c/bindings/cpp/src/Acking.cpp
new file mode 100644
index 0000000..62eca98
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Acking.cpp
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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/cpp/Acking.h"
+#include "proton/delivery.h"
+
+namespace proton {
+namespace reactor {
+
+void Acking::accept(Delivery &d) {
+    settle(d, Delivery::ACCEPTED);
+}
+
+void Acking::reject(Delivery &d) {
+    settle(d, Delivery::REJECTED);
+}
+
+void Acking::release(Delivery &d, bool delivered) {
+    if (delivered)
+        settle(d, Delivery::MODIFIED);
+    else
+        settle(d, Delivery::RELEASED);
+}
+
+void Acking::settle(Delivery &d, Delivery::state state) {
+    if (state)
+        pn_delivery_update(d.getPnDelivery(), state);
+    d.settle();
+}
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/ContainerImpl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.cpp b/proton-c/bindings/cpp/src/ContainerImpl.cpp
index df8c716..d1339f0 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.cpp
+++ b/proton-c/bindings/cpp/src/ContainerImpl.cpp
@@ -308,16 +308,15 @@ void ContainerImpl::run() {
     // Set our context on the reactor
     setContainerContext(reactor, this);
 
-    int prefetch = 10; // TODO: configurable
+    int prefetch = messagingHandler.prefetch;
     Handler *flowController = 0;
 
-
     // Set the reactor's main/default handler (see note below)
-    MessagingAdapter messagingAdapter(messagingHandler);
     if (prefetch) {
         flowController = new CFlowController(prefetch);
         messagingHandler.addChildHandler(*flowController);
     }
+    MessagingAdapter messagingAdapter(messagingHandler);
     messagingHandler.addChildHandler(messagingAdapter);
     pn_handler_t *cppHandler = cpp_handler(this, &messagingHandler);
     pn_reactor_set_handler(reactor, cppHandler);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/ContainerImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ContainerImpl.h b/proton-c/bindings/cpp/src/ContainerImpl.h
index 8a6faba..f7b5b9e 100644
--- a/proton-c/bindings/cpp/src/ContainerImpl.h
+++ b/proton-c/bindings/cpp/src/ContainerImpl.h
@@ -49,7 +49,7 @@ class ContainerImpl
     PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr);
     PROTON_CPP_EXTERN Sender createSender(std::string &url);
     PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
-    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url); //ZZZ
+    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
     PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
     PROTON_CPP_EXTERN std::string getContainerId();
     static void incref(ContainerImpl *);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/Delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/Delivery.cpp b/proton-c/bindings/cpp/src/Delivery.cpp
new file mode 100644
index 0000000..990e394
--- /dev/null
+++ b/proton-c/bindings/cpp/src/Delivery.cpp
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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/cpp/Delivery.h"
+#include "proton/delivery.h"
+
+namespace proton {
+namespace reactor {
+
+template class ProtonHandle<pn_delivery_t>;
+typedef ProtonImplRef<Delivery> PI;
+
+Delivery::Delivery(pn_delivery_t *p) {
+    PI::ctor(*this, p);
+}
+Delivery::Delivery() {
+    PI::ctor(*this, 0);
+}
+Delivery::Delivery(const Delivery& c) : ProtonHandle<pn_delivery_t>() {
+    PI::copy(*this, c);
+}
+Delivery& Delivery::operator=(const Delivery& c) {
+    return PI::assign(*this, c);
+}
+Delivery::~Delivery() {
+    PI::dtor(*this);
+}
+
+bool Delivery::settled() {
+    return pn_delivery_settled(impl);
+}
+
+void Delivery::settle() {
+    pn_delivery_settle(impl);
+}
+
+pn_delivery_t *Delivery::getPnDelivery() { return impl; }
+
+}} // namespace proton::reactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/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 ead6eb1..bdc8c0c 100644
--- a/proton-c/bindings/cpp/src/Message.cpp
+++ b/proton-c/bindings/cpp/src/Message.cpp
@@ -93,6 +93,45 @@ uint64_t Message::getId() {
     throw ProtonException(MSG("Message ID is not a ULONG"));
 }
 
+void Message::setId(const std::string &id) {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_string(data, pn_bytes(id.size(), id.data())))
+        throw ProtonException(MSG("setId error " << err));
+}
+
+std::string Message::getStringId() {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_STRING) {
+        pn_bytes_t bytes = pn_data_get_string(data);
+        return (std::string(bytes.start, bytes.size));
+    }
+    throw ProtonException(MSG("Message ID is not a string value"));
+}
+
+void Message::setId(const char *p, size_t len) {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_binary(data, pn_bytes(len, p)))
+        throw ProtonException(MSG("setId error " << err));
+}
+
+size_t Message::getId(const char **p) {
+    confirm(impl);
+    pn_data_t *data = pn_message_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_BINARY) {
+        pn_bytes_t pnb = pn_data_get_binary(data);
+        *p = pnb.start;
+        return pnb.size;
+    }
+    throw ProtonException(MSG("Message ID is not a binary value"));
+}
+
 pn_type_t Message::getIdType() {
     confirm(impl);
     pn_data_t *data = pn_message_id(impl);
@@ -113,6 +152,199 @@ pn_type_t Message::getIdType() {
     return PN_NULL;
 }
 
+void Message::setUserId(const std::string &id) {
+    confirm(impl);
+    if (int err = pn_message_set_user_id(impl, pn_bytes(id.size(), id.data())))
+        throw ProtonException(MSG("setUserId error " << err));
+}
+
+std::string Message::getUserId() {
+    confirm(impl);
+    pn_bytes_t bytes = pn_message_get_user_id(impl);
+    return (std::string(bytes.start, bytes.size));
+}
+
+void Message::setAddress(const std::string &addr) {
+    confirm(impl);
+    if (int err = pn_message_set_address(impl, addr.c_str()))
+        throw ProtonException(MSG("setAddress error " << err));
+}
+
+std::string Message::getAddress() {
+    confirm(impl);
+    const char* addr = pn_message_get_address(impl);
+    return addr ? std::string(addr) : std::string();
+}
+
+void Message::setSubject(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_subject(impl, s.c_str()))
+        throw ProtonException(MSG("setSubject error " << err));
+}
+
+std::string Message::getSubject() {
+    confirm(impl);
+    const char* s = pn_message_get_subject(impl);
+    return s ? std::string(s) : std::string();
+}
+
+void Message::setReplyTo(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_reply_to(impl, s.c_str()))
+        throw ProtonException(MSG("setReplyTo error " << err));
+}
+
+std::string Message::getReplyTo() {
+    confirm(impl);
+    const char* s = pn_message_get_reply_to(impl);
+    return s ? std::string(s) : std::string();
+}
+
+void Message::setCorrelationId(uint64_t id) {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_ulong(data, id))
+        throw ProtonException(MSG("setCorrelationId error " << err));
+}
+
+uint64_t Message::getCorrelationId() {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_ULONG) {
+        return pn_data_get_ulong(data);
+    }
+    throw ProtonException(MSG("Correlation ID is not a ULONG"));
+}
+
+void Message::setCorrelationId(const std::string &id) {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_string(data, pn_bytes(id.size(), id.data())))
+        throw ProtonException(MSG("setCorrelationId error " << err));
+}
+
+std::string Message::getStringCorrelationId() {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_STRING) {
+        pn_bytes_t bytes = pn_data_get_string(data);
+        return (std::string(bytes.start, bytes.size));
+    }
+    throw ProtonException(MSG("Message ID is not a string value"));
+}
+
+void Message::setCorrelationId(const char *p, size_t len) {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_clear(data);
+    if (int err = pn_data_put_binary(data, pn_bytes(len, p)))
+        throw ProtonException(MSG("setCorrelationId error " << err));
+}
+
+size_t Message::getCorrelationId(const char **p) {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data) && pn_data_type(data) == PN_BINARY) {
+        pn_bytes_t pnb = pn_data_get_binary(data);
+        *p = pnb.start;
+        return pnb.size;
+    }
+    throw ProtonException(MSG("Message ID is not a binary value"));
+}
+
+pn_type_t Message::getCorrelationIdType() {
+    confirm(impl);
+    pn_data_t *data = pn_message_correlation_id(impl);
+    pn_data_rewind(data);
+    if (pn_data_size(data) == 1 && pn_data_next(data)) {
+        pn_type_t type = pn_data_type(data);
+        switch (type) {
+        case PN_ULONG:
+        case PN_STRING:
+        case PN_BINARY:
+        case PN_UUID:
+            return type;
+            break;
+        default:
+            break;
+        }
+    }
+    return PN_NULL;
+}
+
+void Message::setContentType(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_content_type(impl, s.c_str()))
+        throw ProtonException(MSG("setContentType error " << err));
+}
+
+std::string Message::getContentType() {
+    confirm(impl);
+    const char* s = pn_message_get_content_type(impl);
+    return s ? std::string(s) : std::string();
+}
+
+void Message::setContentEncoding(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_content_encoding(impl, s.c_str()))
+        throw ProtonException(MSG("setContentEncoding error " << err));
+}
+
+std::string Message::getContentEncoding() {
+    confirm(impl);
+    const char* s = pn_message_get_content_encoding(impl);
+    return s ? std::string(s) : std::string();
+}
+
+void Message::setExpiry(pn_timestamp_t t) {
+    confirm(impl);
+    pn_message_set_expiry_time(impl, t);
+}
+pn_timestamp_t Message::getExpiry() {
+    confirm(impl);
+    return pn_message_get_expiry_time(impl);
+}
+
+void Message::setCreationTime(pn_timestamp_t t) {
+    confirm(impl);
+    pn_message_set_creation_time(impl, t);
+}
+pn_timestamp_t Message::getCreationTime() {
+    confirm(impl);
+    return pn_message_get_creation_time(impl);
+}
+
+
+void Message::setGroupId(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_group_id(impl, s.c_str()))
+        throw ProtonException(MSG("setGroupId error " << err));
+}
+
+std::string Message::getGroupId() {
+    confirm(impl);
+    const char* s = pn_message_get_group_id(impl);
+    return s ? std::string(s) : std::string();
+}
+
+void Message::setReplyToGroupId(const std::string &s) {
+    confirm(impl);
+    if (int err = pn_message_set_reply_to_group_id(impl, s.c_str()))
+        throw ProtonException(MSG("setReplyToGroupId error " << err));
+}
+
+std::string Message::getReplyToGroupId() {
+    confirm(impl);
+    const char* s = pn_message_get_reply_to_group_id(impl);
+    return s ? std::string(s) : std::string();
+}
+
+
 void Message::setBody(const std::string &buf) {
     confirm(impl);
     pn_data_t *body = pn_message_body(impl);
@@ -127,7 +359,7 @@ void Message::getBody(std::string &str) {
     pn_data_rewind(body);
 
     if (pn_data_next(body) && pn_data_type(body) == PN_STRING) {
-        pn_bytes_t bytes= pn_data_get_string(body);
+        pn_bytes_t bytes = pn_data_get_string(body);
         if (!pn_data_next(body)) {
             // String data and nothing else
             str.resize(bytes.size);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/MessagingAdapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingAdapter.cpp b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
index 1097305..f2916db 100644
--- a/proton-c/bindings/cpp/src/MessagingAdapter.cpp
+++ b/proton-c/bindings/cpp/src/MessagingAdapter.cpp
@@ -33,13 +33,14 @@
 namespace proton {
 namespace reactor {
 
-MessagingAdapter::MessagingAdapter(MessagingHandler &d) : delegate(d), handshaker(pn_handshaker()),
-                                                          autoSettle(true), autoAccept(true),
-                                                          peerCloseIsError(false) {
-};
-MessagingAdapter::~MessagingAdapter(){
-    pn_decref(handshaker);
-};
+MessagingAdapter::MessagingAdapter(MessagingHandler &delegate_) :
+    autoSettle(delegate_.autoSettle),
+    autoAccept(delegate_.autoAccept),
+    peerCloseIsError(delegate_.peerCloseIsError),
+    delegate(delegate_)
+{};
+
+MessagingAdapter::~MessagingAdapter(){};
 
 
 void MessagingAdapter::onReactorInit(Event &e) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/183578d7/proton-c/bindings/cpp/src/MessagingHandler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/MessagingHandler.cpp b/proton-c/bindings/cpp/src/MessagingHandler.cpp
index 6066b07..7a4a5cb 100644
--- a/proton-c/bindings/cpp/src/MessagingHandler.cpp
+++ b/proton-c/bindings/cpp/src/MessagingHandler.cpp
@@ -19,12 +19,17 @@
  *
  */
 #include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Event.h"
+#include "proton/cpp/ProtonEvent.h"
+#include "proton/cpp/MessagingAdapter.h"
+#include "proton/handlers.h"
 
 namespace proton {
 namespace reactor {
 
-MessagingHandler::MessagingHandler(){};
+MessagingHandler::MessagingHandler(int prefetch0, bool autoAccept0, bool autoSettle0, bool peerCloseIsError0) :
+    prefetch(prefetch0), autoAccept(autoAccept0), autoSettle(autoSettle0), peerCloseIsError(peerCloseIsError0)
+{}
+
 MessagingHandler::~MessagingHandler(){};
 
 void MessagingHandler::onAbort(Event &e) { onUnhandled(e); }


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


[10/50] [abbrv] qpid-proton git commit: PROTON-781: Added MessagingHandler to the Ruby reactive APIs.

Posted by ac...@apache.org.
PROTON-781: Added MessagingHandler to the Ruby reactive APIs.


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

Branch: refs/heads/cjansen-cpp-client
Commit: 803d5e8dd4dde26d0d533fc2891722f12425e431
Parents: 480b536
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Feb 25 13:32:09 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:44 2015 -0400

----------------------------------------------------------------------
 .../ruby/lib/handler/messaging_handler.rb       | 218 +++++++++++++++++++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |   1 +
 2 files changed, 219 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/803d5e8d/proton-c/bindings/ruby/lib/handler/messaging_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/messaging_handler.rb b/proton-c/bindings/ruby/lib/handler/messaging_handler.rb
new file mode 100644
index 0000000..b4a0bcf
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/messaging_handler.rb
@@ -0,0 +1,218 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton::Handler
+
+  # A general purpose handler that simplifies processing events.
+  #
+  # @example
+  #
+  class MessagingHandler < Qpid::Proton::BaseHandler
+
+    attr_reader :handlers
+
+    # Creates a new instance.
+    #
+    # @param [Fixnum] prefetch
+    # @param [Boolean] auto_accept
+    # @param [Boolean] auto_settle
+    # @param [Boolean] peer_close_is_error
+    #
+    def initialize(prefetch = 10, auto_accept = true, auto_settle = true, peer_close_is_error = false)
+      @handlers = Array.new
+      @handlers << CFlowController.new(prefetch) unless prefetch.zero?
+      @handlers << EndpointStateHandler.new(peer_close_is_error, self)
+      @handlers << IncomingMessageHandler.new(auto_accept, self)
+      @handlers << OutgoingMessageHandler.new(auto_settle,self)
+    end
+
+    # Called when the peer closes the connection with an error condition.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_connection_error(event)
+      EndpointStateHandler.print_error(event.connection, "connection")
+    end
+
+      # Called when the peer closes the session with an error condition.
+      #
+      # @param event [Qpid:Proton::Event::Event] The event.
+      #
+    def on_session_error(event)
+      EndpointStateHandler.print_error(event.session, "session")
+      event.connection.close
+    end
+
+    # Called when the peer closes the link with an error condition.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_link_error(event)
+      EndpointStateHandler.print_error(event.link, "link")
+      event.connection.close
+    end
+
+    # Called when the event loop starts.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_reactor_init(event)
+      self.on_start(event)
+    end
+
+    # Called when the event loop starts.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_start(event)
+    end
+
+    # Called when the connection is closed.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_connection_closed(event)
+    end
+
+    # Called when the session is closed.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_session_closed(event)
+    end
+
+    # Called when the link is closed.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_link_closed(event)
+    end
+
+    # Called when the peer initiates the closing of the connection.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_connection_closing(event)
+    end
+
+    # Called when the peer initiates the closing of the session.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_session_closing(event)
+    end
+
+    # Called when the peer initiates the closing of the link.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_link_closing(event)
+    end
+
+    # Called when the socket is disconnected.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_disconnected(event)
+    end
+
+    # Called when the sender link has credit and messages can therefore
+    # be transferred.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_sendable(event)
+    end
+
+    # Called when the remote peer accepts an outgoing message.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_accepted(event)
+    end
+
+    # Called when the remote peer rejects an outgoing message.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_rejected(event)
+    end
+
+    # Called when the remote peer releases an outgoing message.
+    #
+    # Note that this may be in response to either the RELEASE or
+    # MODIFIED state as defined by the AMPQ specification.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_released(event)
+    end
+
+    # Called when the remote peer has settled hte outgoing message.
+    #
+    # This is the point at which it should never be retransmitted.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_settled(event)
+    end
+
+    # Called when a message is received.
+    #
+    # The message itself can be obtained as a property on the event. For
+    # the purpose of referring to this message in further actions, such as
+    # explicitly accepting it) the delivery should be used. This is also
+    # obtainable vi a property on the event.
+    #
+    # This method needs to be overridden.
+    #
+    # @param event [Qpid::Proton::Event::Event] The event.
+    #
+    def on_message(event)
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/803d5e8d/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 5c2e1bc..a60a028 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -90,6 +90,7 @@ require "handler/endpoint_state_handler"
 require "handler/incoming_message_handler"
 require "handler/outgoing_message_handler"
 require "handler/c_flow_controller"
+require "handler/messaging_handler"
 
 module Qpid::Proton
   # @private


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


[05/50] [abbrv] qpid-proton git commit: PROTON-781: Refactored the Ruby Selectable class.

Posted by ac...@apache.org.
PROTON-781: Refactored the Ruby Selectable class.

It now more closely matches the Python version.


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

Branch: refs/heads/cjansen-cpp-client
Commit: ddd8c451f4eb896947f4023271294bc1b5aeb5f3
Parents: ff348d0
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Jun 4 13:56:49 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/selectable.rb | 124 +++++++++++----------
 1 file changed, 68 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ddd8c451/proton-c/bindings/ruby/lib/core/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/selectable.rb b/proton-c/bindings/ruby/lib/core/selectable.rb
index 8a5b223..0ae2efe 100644
--- a/proton-c/bindings/ruby/lib/core/selectable.rb
+++ b/proton-c/bindings/ruby/lib/core/selectable.rb
@@ -25,13 +25,11 @@ module Qpid::Proton
   # @private
   class Selectable
 
+    # @private
+    include Util::SwigHelper
 
-    def initialize(messenger, impl) # :nodoc:
-      @messenger = messenger
-      @impl = impl
-      @io = nil
-      @freed = false
-    end
+    # @private
+    PROTON_METHOD_PREFIX = "pn_selectable"
 
     # Returns the underlying file descriptor.
     #
@@ -41,76 +39,90 @@ module Qpid::Proton
       Cproton.pn_selectable_get_fd(@impl)
     end
 
-    def to_io
-      @io ||= IO.new(fileno)
-    end
+    proton_reader :reading, :is_or_get => :is
 
-    # The number of bytes the selectable is capable of consuming.
-    #
-    #def capacity
-    #  Cproton.pn_selectable_capacity(@impl)
-    #end
+    proton_reader :writing, :is_or_get => :is
 
-    # The number of bytes waiting to be written to the file descriptor.
-    #
-    def pending
-      Cproton.pn_selectable_pending(@impl)
-    end
+    proton_caller :readable
 
-    # The future expiry time at which control will be returned to the
-    # selectable.
-    #
-    def deadline
-      tstamp = Cproton.pn_selectable_deadline(@impl)
-      tstamp.nil? ? nil : tstamp / 1000
-    end
+    proton_caller :writable
 
-    def readable
-      Cproton.pn_selectable_readable(@impl)
-    end
+    proton_caller :expired
 
-    def writable
-      Cproton.pn_selectable_writable(@impl)
-    end
+    proton_accessor :registered, :is_or_get => :is
 
-    def expired?
-      Cproton.pn_selectable_expired(@impl)
-    end
+    proton_accessor :terminal, :is_or_get => :is
 
-    def registered=(registered)
-      Cproton.pn_selectable_set_registered(@impl, registered)
+    proton_caller :terminate
+
+    proton_caller :release
+
+    # @private
+    def self.wrap(impl)
+      return nil if impl.nil?
+
+      self.fetch_instance(impl, :pn_selectable_attachments) || Selectable.new(impl)
     end
 
-    def registered?
-      Cproton.pn_selectable_is_registered(@impl)
+    # @private
+    include Util::Wrapper
+
+    # @private
+    def initialize(impl)
+      @impl = impl
+      self.class.store_instance(self, :pn_selectable_attachments)
     end
 
-    def terminal?
-      return true if @impl.nil?
-      Cproton.pn_selectable_is_terminal(@impl)
+    private
+
+    DEFAULT = Object.new
+
+    public
+
+    def fileno(fd = DEFAULT)
+      if fd == DEFAULT
+        Cproton.pn_selectable_get_fd(@impl)
+      elsif fd.nil?
+        Cproton.pn_selectable_set_fd(@impl, Cproton::PN_INVALID_SOCKET)
+      else
+        Cproton.pn_selectable_set_fd(@impl, fd)
+      end
     end
 
-    def to_s
-      "fileno=#{self.fileno} registered=#{self.registered?} terminal=#{self.terminal?}"
+    def reading=(reading)
+      if reading.nil?
+        reading = false
+      elsif reading == "0"
+        reading = false
+      else
+        reading = true
+      end
+      Cproton.pn_selectable_set_reading(@impl, reading ? true : false)
     end
 
-    def free
-      return if @freed
-      @freed = true
-      @messenger.unregister_selectable(fileno)
-      @io.close unless @io.nil?
-      Cproton.pn_selectable_free(@impl)
-      @impl = nil
+    def writing=(writing)
+      if writing.nil?
+        writing = false
+      elsif writing == "0"
+        writing = false
+      else
+        writing = true
+      end
+      Cproton.pn_selectable_set_writing(@impl, writing ? true : false)
     end
 
-    def freed? # :nodoc:
-      @freed
+    def deadline
+      tstamp = Cproton.pn_selectable_get_deadline(@impl)
+      return nil if tstamp.nil?
+      mills_to_sec(tstamp)
     end
 
-    private
+    def deadline=(deadline)
+      Cproton.pn_selectable_set_deadline(sec_to_millis(deadline))
+    end
 
-    def check_is_initialized
-      raise RuntimeError.new("selectable freed") if @impl.nil?
+    def to_io
+      @io ||= IO.new(fileno)
     end
 
   end


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


[39/50] [abbrv] qpid-proton git commit: PROTON-865: Stream like Encoder/Decoder and AMQP Value type for C++ binding.

Posted by ac...@apache.org.
PROTON-865: Stream like Encoder/Decoder and AMQP Value type for C++ binding.

See Encoder.h, Decoder.h, Value.h for details.
Encoder/Decoder use operator << and >> to encode/decode AMQP values.
Value is a variant-like type that can hold an arbitrary AMQP value.

Simple types are implemented, complex types coming next.


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

Branch: refs/heads/cjansen-cpp-client
Commit: ea2588316da215ce7c1b8fe336e97ab9e94ad30c
Parents: f6d6dc7
Author: Alan Conway <ac...@redhat.com>
Authored: Fri Jun 5 14:56:17 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt                         |   5 +-
 proton-c/bindings/CMakeLists.txt                | 170 +++++-----
 proton-c/bindings/cpp/CMakeLists.txt            |  44 ++-
 proton-c/bindings/cpp/README.md                 |  10 +-
 .../bindings/cpp/include/proton/cpp/Acceptor.h  |  12 +-
 .../bindings/cpp/include/proton/cpp/Acking.h    |   8 +-
 .../cpp/include/proton/cpp/BlockingConnection.h |  20 +-
 .../cpp/include/proton/cpp/BlockingLink.h       |   6 +-
 .../cpp/include/proton/cpp/BlockingSender.h     |   6 +-
 .../cpp/include/proton/cpp/Connection.h         |  32 +-
 .../bindings/cpp/include/proton/cpp/Container.h |  44 +--
 proton-c/bindings/cpp/include/proton/cpp/Data.h |  55 ++++
 .../bindings/cpp/include/proton/cpp/Decoder.h   | 165 ++++++++++
 .../bindings/cpp/include/proton/cpp/Delivery.h  |  16 +-
 .../bindings/cpp/include/proton/cpp/Duration.h  |  20 +-
 .../bindings/cpp/include/proton/cpp/Encoder.h   | 108 +++++++
 .../bindings/cpp/include/proton/cpp/Endpoint.h  |   4 +-
 .../bindings/cpp/include/proton/cpp/Event.h     |  24 +-
 .../bindings/cpp/include/proton/cpp/Exception.h |  49 +++
 .../bindings/cpp/include/proton/cpp/Handle.h    |   2 +
 .../bindings/cpp/include/proton/cpp/Handler.h   |  14 +-
 .../cpp/include/proton/cpp/ImportExport.h       |   4 +-
 proton-c/bindings/cpp/include/proton/cpp/Link.h |  36 +--
 .../bindings/cpp/include/proton/cpp/Message.h   | 104 ++++---
 .../cpp/include/proton/cpp/MessagingAdapter.h   |  62 ++--
 .../cpp/include/proton/cpp/MessagingEvent.h     |  14 +-
 .../cpp/include/proton/cpp/MessagingHandler.h   |   6 +-
 .../cpp/include/proton/cpp/ProtonEvent.h        |  18 +-
 .../cpp/include/proton/cpp/ProtonHandler.h      |   2 +-
 .../bindings/cpp/include/proton/cpp/Receiver.h  |   6 +-
 .../bindings/cpp/include/proton/cpp/Sender.h    |   8 +-
 .../bindings/cpp/include/proton/cpp/Session.h   |  18 +-
 .../bindings/cpp/include/proton/cpp/Terminus.h  |  32 +-
 .../bindings/cpp/include/proton/cpp/Transport.h |   6 +-
 .../bindings/cpp/include/proton/cpp/Value.h     | 103 +++++++
 .../cpp/include/proton/cpp/WaitCondition.h      |   2 +-
 .../bindings/cpp/include/proton/cpp/types.h     | 162 ++++++++++
 proton-c/bindings/cpp/src/ConnectionImpl.h      |  26 +-
 proton-c/bindings/cpp/src/ContainerImpl.h       |  28 +-
 proton-c/bindings/cpp/src/Data.cpp              |  48 +++
 proton-c/bindings/cpp/src/Decoder.cpp           | 265 ++++++++++++++++
 proton-c/bindings/cpp/src/Encoder.cpp           | 104 +++++++
 proton-c/bindings/cpp/src/Msg.h                 |   2 +-
 proton-c/bindings/cpp/src/Url.h                 |  14 +-
 proton-c/bindings/cpp/src/Value.cpp             |  71 +++++
 .../cpp/src/blocking/BlockingConnectionImpl.h   |  12 +-
 proton-c/bindings/cpp/src/grep                  |  50 +++
 proton-c/bindings/cpp/src/interop_test.cpp      | 147 +++++++++
 proton-c/bindings/cpp/src/platform.cpp          |   2 +
 proton-c/bindings/cpp/src/pn_data.h             |  30 ++
 proton-c/bindings/cpp/src/proton_bits.cpp       |  48 +++
 proton-c/bindings/cpp/src/proton_bits.h         |  39 +++
 proton-c/bindings/cpp/src/types.cpp             |  82 +++++
 .../proton/go/amqp/interop_test.go              | 308 +++++++++++++++++++
 54 files changed, 2277 insertions(+), 396 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 288e694..049755e 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -258,10 +258,7 @@ macro (pn_absolute_install_dir NAME VALUE PREFIX)
   get_filename_component(${NAME} ${${NAME}} ABSOLUTE)
 endmacro()
 
-if (SWIG_FOUND)
-  add_subdirectory(bindings)
-endif (SWIG_FOUND)
-
+add_subdirectory(bindings)
 add_subdirectory(docs/api)
 add_subdirectory(docs/man)
 add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
index e976bc7..c735ea0 100644
--- a/proton-c/bindings/CMakeLists.txt
+++ b/proton-c/bindings/CMakeLists.txt
@@ -17,91 +17,13 @@
 # under the License.
 #
 
-include(UseSWIG)
+# Add bindings that do not require swig here - the directory name must be the same as the binding name
+# See below for swig bindings
+set(BINDINGS javascript cpp)
 
-# Add any new bindings here - the directory name must be the same as the binding name
-set (BINDINGS python ruby php perl javascript cpp)
-
-# All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
-file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/proton-c/include/proton/*.h")
-
-# If swig version is 3.0 or greater then we can build some additional bindings
-if (${SWIG_VERSION} VERSION_GREATER 3.0 OR ${SWIG_VERSION} VERSION_EQUAL 3.0)
-  set (BINDINGS
-    ${BINDINGS}
-    node
-    )
-endif()
-
-set (BINDING_DEPS qpid-proton)
-
-# Add a block here to detect the prerequisites to build each language binding:
+# Prerequisites for javascript.
 #
-# If the prerequisites for the binding are present set a variable called
-# DEFAULT_{uppercase name of binding} to ON
-
-# Prerequisites for Python wrapper:
-find_package (PythonLibs)
-if (PYTHONLIBS_FOUND)
-  set (DEFAULT_PYTHON ON)
-endif (PYTHONLIBS_FOUND)
-
-# Prerequisites for Ruby:
-find_program(GEM_EXE "gem")
-mark_as_advanced(GEM_EXE)
-macro(CheckRubyGem varname gemname)
-  execute_process(COMMAND ${GEM_EXE} list --local ${gemname}
-    OUTPUT_VARIABLE CHECK_OUTPUT)
-
-  set (${varname} OFF)
-
-  if (CHECK_OUTPUT MATCHES "${gemname}[ ]+\(.*\)")
-    message(STATUS "Found Ruby gem: ${gemname}")
-    set (${varname} ON)
-  else()
-    message(STATUS "Missing Ruby gem dependency: ${gemname}")
-    set (${varname} OFF)
-  endif()
-endmacro()
-
-find_package(Ruby)
-if (RUBY_FOUND)
-  set (DEFAULT_RUBY ON)
-
-  CheckRubyGem("HAS_RUBY_GEM_RSPEC"     "rspec")
-  CheckRubyGem("HAS_RUBY_GEM_SIMPLECOV" "simplecov")
-
-  if (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
-    set (DEFAULT_RUBY_TESTING ON CACHE INTERNAL "")
-  else()
-    message(STATUS "Skipping Ruby bindings due to missing dependencies...")
-    set (DEFAULT_RUBY_TESTING OFF CACHE INTERNAL "")
-    set (DEFAULT_RUBY OFF)
-  endif (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
-endif (RUBY_FOUND)
-
-# Prerequites for PHP:
-# For now, assume PHP support if the 'php-config' tool is present.
-# @todo: allow user to specify which php-config if multiple PHP sources installed!
-find_program(PHP_CONFIG_EXE php-config)
-if (PHP_CONFIG_EXE)
-  find_program(PHP_EXE php)
-  mark_as_advanced (PHP_EXE)
-  if (PHP_EXE)
-    set (DEFAULT_PHP ON)
-  endif (PHP_EXE)
-endif (PHP_CONFIG_EXE)
-mark_as_advanced (PHP_CONFIG_EXE)
-
-# Prerequisites for Perl:
-include(ProtonFindPerl)
-if (PERLLIBS_FOUND)
-  set (DEFAULT_PERL ON)
-endif (PERLLIBS_FOUND)
-
-# Prerequisites for the javascript "binding":
-# This is somewhat different to the other language bindings in that it does not use swig. It uses a C/C++ to
-# JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
+# It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
 # and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be
 # aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++).
 find_package(Emscripten)
@@ -114,6 +36,88 @@ if (CMAKE_CXX_COMPILER)
   set (DEFAULT_CPP ON)
 endif (CMAKE_CXX_COMPILER)
 
+if(SWIG_FOUND)
+  # Add any new swig bindings here - the directory name must be the same as the binding name
+  list(APPEND BINDINGS python ruby php perl)
+
+  include(UseSWIG)
+
+  # All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
+  file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/proton-c/include/proton/*.h")
+  # All swig modules should include ${BINDING_DEPS} in swig_link_libraries
+  set (BINDING_DEPS qpid-proton)
+
+  # If swig version is 3.0 or greater then we can build some additional bindings
+  if (${SWIG_VERSION} VERSION_GREATER 3.0 OR ${SWIG_VERSION} VERSION_EQUAL 3.0)
+    list(APPEND SWIG_BINDINGS node)
+  endif()
+
+  # Add a block here to detect the prerequisites to build each language binding:
+  #
+  # If the prerequisites for the binding are present set a variable called
+  # DEFAULT_{uppercase name of binding} to ON
+
+  # Prerequisites for Python wrapper:
+  find_package (PythonLibs)
+  if (PYTHONLIBS_FOUND)
+    set (DEFAULT_PYTHON ON)
+  endif (PYTHONLIBS_FOUND)
+
+  # Prerequisites for Ruby:
+  find_program(GEM_EXE "gem")
+  mark_as_advanced(GEM_EXE)
+  macro(CheckRubyGem varname gemname)
+    execute_process(COMMAND ${GEM_EXE} list --local ${gemname}
+      OUTPUT_VARIABLE CHECK_OUTPUT)
+
+    set (${varname} OFF)
+
+    if (CHECK_OUTPUT MATCHES "${gemname}[ ]+\(.*\)")
+      message(STATUS "Found Ruby gem: ${gemname}")
+      set (${varname} ON)
+    else()
+      message(STATUS "Missing Ruby gem dependency: ${gemname}")
+      set (${varname} OFF)
+    endif()
+  endmacro()
+
+  find_package(Ruby)
+  if (RUBY_FOUND)
+    set (DEFAULT_RUBY ON)
+
+    CheckRubyGem("HAS_RUBY_GEM_RSPEC"     "rspec")
+    CheckRubyGem("HAS_RUBY_GEM_SIMPLECOV" "simplecov")
+
+    if (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
+      set (DEFAULT_RUBY_TESTING ON CACHE INTERNAL "")
+    else()
+      message(STATUS "Skipping Ruby bindings due to missing dependencies...")
+      set (DEFAULT_RUBY_TESTING OFF CACHE INTERNAL "")
+      set (DEFAULT_RUBY OFF)
+    endif (HAS_RUBY_GEM_RSPEC AND HAS_RUBY_GEM_SIMPLECOV)
+  endif (RUBY_FOUND)
+
+  # Prerequites for PHP:
+  # For now, assume PHP support if the 'php-config' tool is present.
+  # @todo: allow user to specify which php-config if multiple PHP sources installed!
+  find_program(PHP_CONFIG_EXE php-config)
+  if (PHP_CONFIG_EXE)
+    find_program(PHP_EXE php)
+    mark_as_advanced (PHP_EXE)
+    if (PHP_EXE)
+      set (DEFAULT_PHP ON)
+    endif (PHP_EXE)
+  endif (PHP_CONFIG_EXE)
+  mark_as_advanced (PHP_CONFIG_EXE)
+
+  # Prerequisites for Perl:
+  include(ProtonFindPerl)
+  if (PERLLIBS_FOUND)
+    set (DEFAULT_PERL ON)
+  endif (PERLLIBS_FOUND)
+
+endif()
+
 # Shouldn't need to modify below here when adding new language binding
 foreach(BINDING ${BINDINGS})
   string(TOUPPER ${BINDING} UBINDING)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index f9e747c..6cad69f 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+## Build
+
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
 
@@ -25,20 +27,23 @@ set (qpid-proton-cpp-platform
   )
 
 set (qpid-proton-cpp-core
+    src/Acceptor.cpp
+    src/Acking.cpp
     src/Connection.cpp
     src/ConnectionImpl.cpp
     src/Connector.cpp
     src/Connector.h
     src/Container.cpp
     src/ContainerImpl.cpp
+    src/Data.cpp
+    src/Decoder.cpp
+    src/Delivery.cpp
+    src/Duration.cpp
+    src/Encoder.cpp
     src/Endpoint.cpp
     src/Event.cpp
     src/Handler.cpp
     src/Link.cpp
-    src/Terminus.cpp
-    src/Acceptor.cpp
-    src/Url.cpp
-    src/Duration.cpp
     src/Message.cpp
     src/MessagingAdapter.cpp
     src/MessagingEvent.cpp
@@ -48,14 +53,17 @@ set (qpid-proton-cpp-core
     src/Receiver.cpp
     src/Sender.cpp
     src/Session.cpp
-    src/Delivery.cpp
-    src/Acking.cpp
+    src/Terminus.cpp
     src/Transport.cpp
-    src/contexts.cpp
+    src/Url.cpp
+    src/Value.cpp
+    src/proton_bits.cpp
     src/blocking/BlockingConnection.cpp
     src/blocking/BlockingConnectionImpl.cpp
     src/blocking/BlockingLink.cpp
     src/blocking/BlockingSender.cpp
+    src/contexts.cpp
+    src/types.cpp
   )
 
 set_source_files_properties (${qpid-proton-cpp-platform} PROPERTIES LANGUAGE CXX)
@@ -85,6 +93,28 @@ set_target_properties (
   LINK_FLAGS "${CATCH_UNDEFINED}"
   )
 
+## Test
+if (ENABLE_VALGRIND AND VALGRIND_EXE)
+  set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=1 --quiet --leak-check=full --trace-children=yes)
+endif ()
+
+macro(add_cpp_test test)
+  add_executable (${test} src/${test}.cpp)
+  target_link_libraries (${test} qpid-proton qpid-proton-cpp)
+  if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+    add_test (NAME cpp_${test}
+              COMMAND ${env_py}
+                "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+                ${test}> ${ARGN})
+  else ()
+    add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${test} ${ARGN})
+  endif ()
+endmacro(add_cpp_test)
+
+add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
+
+## Install
+
 install (TARGETS qpid-proton-cpp
   EXPORT  proton
   ARCHIVE DESTINATION ${LIB_INSTALL_DIR}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/README.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/README.md b/proton-c/bindings/cpp/README.md
index 5e35874..9a30e35 100644
--- a/proton-c/bindings/cpp/README.md
+++ b/proton-c/bindings/cpp/README.md
@@ -9,7 +9,7 @@ API documentation in doxygen format.
 
 There are a number of things that remain to be done.
 
-- Type mapping between AMQP and C++ types, e.g. encoding std::map as map message.
+- Mapping of complex types.
 
 - Finish blocking API & demos.
 - API documentation, HTML docs on website.
@@ -20,3 +20,11 @@ There are a number of things that remain to be done.
 
 - Security: SASL/SSL support.
 - Reconnection
+
+
+# Nice to have
+
+Subclasses of Encoder/Decoder that push to/pull from a std::ostream/istream as
+values are inserted/extracted.
+
+Better support for Decimal type.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
index 852ca97..e4b690c 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acceptor.h
@@ -33,13 +33,13 @@ namespace reactor {
 class Acceptor : public ProtonHandle<pn_acceptor_t>
 {
   public:
-    PROTON_CPP_EXTERN Acceptor();
-    PROTON_CPP_EXTERN Acceptor(pn_acceptor_t *);
-    PROTON_CPP_EXTERN Acceptor(const Acceptor&);
-    PROTON_CPP_EXTERN Acceptor& operator=(const Acceptor&);
-    PROTON_CPP_EXTERN ~Acceptor();
+    PN_CPP_EXTERN Acceptor();
+    PN_CPP_EXTERN Acceptor(pn_acceptor_t *);
+    PN_CPP_EXTERN Acceptor(const Acceptor&);
+    PN_CPP_EXTERN Acceptor& operator=(const Acceptor&);
+    PN_CPP_EXTERN ~Acceptor();
 
-    PROTON_CPP_EXTERN void close();
+    PN_CPP_EXTERN void close();
   private:
     friend class ProtonImplRef<Acceptor>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Acking.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Acking.h b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
index d40d7d4..cfe168c 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Acking.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Acking.h
@@ -32,10 +32,10 @@ namespace reactor {
 class Acking
 {
   public:
-    PROTON_CPP_EXTERN virtual void accept(Delivery &d);
-    PROTON_CPP_EXTERN virtual void reject(Delivery &d);
-    PROTON_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
-    PROTON_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
+    PN_CPP_EXTERN virtual void accept(Delivery &d);
+    PN_CPP_EXTERN virtual void reject(Delivery &d);
+    PN_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
+    PN_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
index aa268db..6b30a20 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingConnection.h
@@ -44,19 +44,19 @@ class WaitCondition;
 class BlockingConnection : public Handle<BlockingConnectionImpl>
 {
   public:
-    PROTON_CPP_EXTERN BlockingConnection();
-    PROTON_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
-    PROTON_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
-    PROTON_CPP_EXTERN ~BlockingConnection();
+    PN_CPP_EXTERN BlockingConnection();
+    PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
+    PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
+    PN_CPP_EXTERN ~BlockingConnection();
 
-    PROTON_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
+    PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
                                          SslDomain *ssld=0, Container *c=0);
-    PROTON_CPP_EXTERN void close();
+    PN_CPP_EXTERN void close();
 
-    PROTON_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
-    PROTON_CPP_EXTERN void wait(WaitCondition &condition);
-    PROTON_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
-    PROTON_CPP_EXTERN Duration getTimeout();
+    PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
+    PN_CPP_EXTERN void wait(WaitCondition &condition);
+    PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
+    PN_CPP_EXTERN Duration getTimeout();
   private:
     friend class PrivateImplRef<BlockingConnection>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
index 7f84ce8..f3c86e1 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingLink.h
@@ -39,11 +39,11 @@ class BlockingConnection;
 class BlockingLink
 {
   public:
-    PROTON_CPP_EXTERN void close();
+    PN_CPP_EXTERN void close();
     ~BlockingLink();
   protected:
-    PROTON_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
-    PROTON_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
+    PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
+    PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
   private:
     BlockingConnection connection;
     Link link;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
index d4ddeae..a72dbb8 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/BlockingSender.h
@@ -41,10 +41,10 @@ class BlockingLink;
 class BlockingSender : public BlockingLink
 {
   public:
-    PROTON_CPP_EXTERN Delivery send(Message &msg);
-    PROTON_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
+    PN_CPP_EXTERN Delivery send(Message &msg);
+    PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
   private:
-    PROTON_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
+    PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
     friend class BlockingConnection;
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Connection.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Connection.h b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
index f3397ce..5deea9b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Connection.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Connection.h
@@ -41,23 +41,23 @@ class ConnectionImpl;
 class Connection : public Endpoint, public Handle<ConnectionImpl>
 {
   public:
-    PROTON_CPP_EXTERN Connection();
-    PROTON_CPP_EXTERN Connection(ConnectionImpl *);
-    PROTON_CPP_EXTERN Connection(const Connection& c);
-    PROTON_CPP_EXTERN Connection& operator=(const Connection& c);
-    PROTON_CPP_EXTERN ~Connection();
+    PN_CPP_EXTERN Connection();
+    PN_CPP_EXTERN Connection(ConnectionImpl *);
+    PN_CPP_EXTERN Connection(const Connection& c);
+    PN_CPP_EXTERN Connection& operator=(const Connection& c);
+    PN_CPP_EXTERN ~Connection();
 
-    PROTON_CPP_EXTERN Connection(Container &c, Handler *h = 0);
-    PROTON_CPP_EXTERN Transport &getTransport();
-    PROTON_CPP_EXTERN Handler *getOverride();
-    PROTON_CPP_EXTERN void setOverride(Handler *h);
-    PROTON_CPP_EXTERN void open();
-    PROTON_CPP_EXTERN void close();
-    PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
-    PROTON_CPP_EXTERN Container &getContainer();
-    PROTON_CPP_EXTERN std::string getHostname();
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
-    PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+    PN_CPP_EXTERN Connection(Container &c, Handler *h = 0);
+    PN_CPP_EXTERN Transport &getTransport();
+    PN_CPP_EXTERN Handler *getOverride();
+    PN_CPP_EXTERN void setOverride(Handler *h);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_connection_t *getPnConnection();
+    PN_CPP_EXTERN Container &getContainer();
+    PN_CPP_EXTERN std::string getHostname();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
   private:
    friend class PrivateImplRef<Connection>;
    friend class Connector;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Container.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Container.h b/proton-c/bindings/cpp/include/proton/cpp/Container.h
index 1d7284d..f6fdf68 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Container.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Container.h
@@ -45,29 +45,29 @@ class Link;
 class Container : public Handle<ContainerImpl>
 {
   public:
-    PROTON_CPP_EXTERN Container(ContainerImpl *);
-    PROTON_CPP_EXTERN Container(const Container& c);
-    PROTON_CPP_EXTERN Container& operator=(const Container& c);
-    PROTON_CPP_EXTERN ~Container();
+    PN_CPP_EXTERN Container(ContainerImpl *);
+    PN_CPP_EXTERN Container(const Container& c);
+    PN_CPP_EXTERN Container& operator=(const Container& c);
+    PN_CPP_EXTERN ~Container();
 
-    PROTON_CPP_EXTERN Container();
-    PROTON_CPP_EXTERN Container(MessagingHandler &mhandler);
-    PROTON_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
-    PROTON_CPP_EXTERN void run();
-    PROTON_CPP_EXTERN void start();
-    PROTON_CPP_EXTERN bool process();
-    PROTON_CPP_EXTERN void stop();
-    PROTON_CPP_EXTERN void wakeup();
-    PROTON_CPP_EXTERN bool isQuiesced();
-    PROTON_CPP_EXTERN pn_reactor_t *getReactor();
-    PROTON_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
-    PROTON_CPP_EXTERN Sender createSender(std::string &url);
-    PROTON_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
-    PROTON_CPP_EXTERN Receiver createReceiver(const std::string &url);
-    PROTON_CPP_EXTERN Acceptor listen(const std::string &url);
-    PROTON_CPP_EXTERN std::string getContainerId();
-    PROTON_CPP_EXTERN Duration getTimeout();
-    PROTON_CPP_EXTERN void setTimeout(Duration timeout);
+    PN_CPP_EXTERN Container();
+    PN_CPP_EXTERN Container(MessagingHandler &mhandler);
+    PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
+    PN_CPP_EXTERN void run();
+    PN_CPP_EXTERN void start();
+    PN_CPP_EXTERN bool process();
+    PN_CPP_EXTERN void stop();
+    PN_CPP_EXTERN void wakeup();
+    PN_CPP_EXTERN bool isQuiesced();
+    PN_CPP_EXTERN pn_reactor_t *getReactor();
+    PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
+    PN_CPP_EXTERN Sender createSender(std::string &url);
+    PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+    PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+    PN_CPP_EXTERN Acceptor listen(const std::string &url);
+    PN_CPP_EXTERN std::string getContainerId();
+    PN_CPP_EXTERN Duration getTimeout();
+    PN_CPP_EXTERN void setTimeout(Duration timeout);
   private:
    friend class PrivateImplRef<Container>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Data.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Data.h b/proton-c/bindings/cpp/include/proton/cpp/Data.h
new file mode 100644
index 0000000..2204e8f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Data.h
@@ -0,0 +1,55 @@
+#ifndef DATA_H
+#define DATA_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/cpp/ImportExport.h"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+/** Base for classes that hold AMQP data. */
+class Data {
+  public:
+    virtual ~Data();
+
+    /** Copies the data */
+    Data& operator=(const Data&);
+
+    /** Clear the data. */
+    PN_CPP_EXTERN void clear();
+
+    /** True if there are no values. */
+    PN_CPP_EXTERN bool empty() const;
+
+    /** Human readable representation of data. */
+    friend std::ostream& operator<<(std::ostream&, const Data&);
+
+  protected:
+    /** Takes ownership of pd */
+    explicit Data(pn_data_t* pd=0);
+    mutable pn_data_t* data;
+};
+
+
+}}
+#endif // DATA_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Decoder.h b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
new file mode 100644
index 0000000..542315e
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Decoder.h
@@ -0,0 +1,165 @@
+#ifndef DECODER_H
+#define DECODER_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/cpp/Data.h"
+#include "proton/cpp/types.h"
+#include "proton/cpp/exceptions.h"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**
+Stream-like decoder from AMQP bytes to a stream of C++ values.
+
+@see types.h defines C++ typedefs and types for AMQP each type. These types can
+all be extracted from the corresponding AMQP type. In additon operator>> will do
+the following conversions from AMQP to C++ types:
+
++-----------------------------------------+--------------------------------------------------+
+|Target C++ type                          |Allowed AMQP types                                |
++=========================================+==================================================+
+|bool                                     |Bool                                              |
+|-----------------------------------------+--------------------------------------------------|
+|signed integer type                      |Byte,Short,Int,Long [1]                           |
++-----------------------------------------+--------------------------------------------------+
+|unsigned integer type                    |UByte,UShort,UInt,ULong [1]                       |
++-----------------------------------------+--------------------------------------------------+
+|float or double                          |Float or Double                                   |
++-----------------------------------------+--------------------------------------------------+
+|Value                                    |Any type                                          |
++-----------------------------------------+--------------------------------------------------+
+|std::string                              |String, Binary, Symbol                            |
++-----------------------------------------+--------------------------------------------------+
+|wchar_t                                  |Char                                              |
++-----------------------------------------+--------------------------------------------------+
+|std::map<K, T>                           |Map with keys that convert to K and data that     |
+|                                         |converts to T                                     |
++-----------------------------------------+--------------------------------------------------+
+|Map                                      |Map may have mixed keys and data types            |
++-----------------------------------------+--------------------------------------------------+
+|std::vector<T>                           |List or Array if data converts to T               |
++-----------------------------------------+--------------------------------------------------+
+|List                                     |List, may have mixed types and datas              |
++-----------------------------------------+--------------------------------------------------+
+
+You can disable conversions and force an exact type match using @see exact()
+*/
+class Decoder : public virtual Data {
+  public:
+    /** Raised if a Decoder operation fails  */
+    struct Error : public ProtonException {
+        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+    };
+
+    PN_CPP_EXTERN Decoder();
+    PN_CPP_EXTERN ~Decoder();
+
+    /** Copy AMQP data from a byte buffer into the Decoder. */
+    PN_CPP_EXTERN Decoder(const char* buffer, size_t size);
+
+    /** Copy AMQP data from a std::string into the Decoder. */
+    PN_CPP_EXTERN Decoder(const std::string&);
+
+    /** Decode AMQP data from a byte buffer onto the end of the value stream. */
+    PN_CPP_EXTERN void decode(const char* buffer, size_t size);
+
+    /** Decode AMQP data from bytes in std::string onto the end of the value stream. */
+    PN_CPP_EXTERN void decode(const std::string&);
+
+    /** Return true if there are more values to read at the current level. */
+    PN_CPP_EXTERN bool more() const;
+
+    /** Type of the next value that will be read by operator>>
+     *@throw Error if empty().
+     */
+    PN_CPP_EXTERN TypeId type() const;
+
+    /** @defgroup decoder_simple_types Extract simple types, @see Decoder for details.
+     *@throw Error if the Decoder is empty or the current value has an incompatible type.
+     *@{
+     */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&);
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+    ///@}
+
+    ///@internal
+    template <class T> struct ExactRef { T& value; ExactRef(T& ref) : value(ref) {} };
+
+    /** @see exact() */
+  template <class T> friend Decoder& operator>>(Decoder&, ExactRef<T>);
+
+  private:
+    PN_CPP_EXTERN Decoder(pn_data_t*);
+    template <class T> Decoder& extract(T& value);
+    void checkType(TypeId);
+
+    // Not implemented
+    Decoder(const Decoder&);
+    Decoder& operator=(const Decoder&);
+
+  friend class Value;
+  friend class Encoder;
+};
+
+/**
+ * exact() disables the conversions allowed by Decoder operator>> and requires exact type match.
+ *
+ * For example the following will throw Decode::Error unless decoder conntains
+ * an AMQP bool and an AMQP ULong.
+ *
+ * @code
+ * Bool b;
+ * ULong ul;
+ * decoder >> exact(b) >> exact(ul)
+ * @code
+ */
+template <class T> Decoder::ExactRef<T> exact(T& value) {
+    return Decoder::ExactRef<T>(value);
+}
+
+///@see exact()
+template <class T> Decoder& operator>>(Decoder& d, Decoder::ExactRef<T> ref) {
+    d.checkType(TypeIdOf<T>::value);
+    d >> ref.value;
+}
+
+}} // namespace proton::reactor
+#endif // DECODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
index 089ae1b..6df658f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Delivery.h
@@ -43,14 +43,14 @@ class Delivery : public ProtonHandle<pn_delivery_t>
         MODIFIED = PN_MODIFIED
     };  // AMQP spec 3.4 Delivery State
 
-    PROTON_CPP_EXTERN Delivery(pn_delivery_t *d);
-    PROTON_CPP_EXTERN Delivery();
-    PROTON_CPP_EXTERN ~Delivery();
-    PROTON_CPP_EXTERN Delivery(const Delivery&);
-    PROTON_CPP_EXTERN Delivery& operator=(const Delivery&);
-    PROTON_CPP_EXTERN bool settled();
-    PROTON_CPP_EXTERN void settle();
-    PROTON_CPP_EXTERN pn_delivery_t *getPnDelivery();
+    PN_CPP_EXTERN Delivery(pn_delivery_t *d);
+    PN_CPP_EXTERN Delivery();
+    PN_CPP_EXTERN ~Delivery();
+    PN_CPP_EXTERN Delivery(const Delivery&);
+    PN_CPP_EXTERN Delivery& operator=(const Delivery&);
+    PN_CPP_EXTERN bool settled();
+    PN_CPP_EXTERN void settle();
+    PN_CPP_EXTERN pn_delivery_t *getPnDelivery();
   private:
     friend class ProtonImplRef<Delivery>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Duration.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Duration.h b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
index d5aca03..08aaf3f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Duration.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Duration.h
@@ -34,22 +34,22 @@ namespace reactor {
 class Duration
 {
   public:
-    PROTON_CPP_EXTERN explicit Duration(uint64_t milliseconds);
-    PROTON_CPP_EXTERN uint64_t getMilliseconds() const;
-    PROTON_CPP_EXTERN static const Duration FOREVER;
-    PROTON_CPP_EXTERN static const Duration IMMEDIATE;
-    PROTON_CPP_EXTERN static const Duration SECOND;
-    PROTON_CPP_EXTERN static const Duration MINUTE;
+    PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
+    PN_CPP_EXTERN uint64_t getMilliseconds() const;
+    PN_CPP_EXTERN static const Duration FOREVER;
+    PN_CPP_EXTERN static const Duration IMMEDIATE;
+    PN_CPP_EXTERN static const Duration SECOND;
+    PN_CPP_EXTERN static const Duration MINUTE;
   private:
     uint64_t milliseconds;
 };
 
-PROTON_CPP_EXTERN Duration operator*(const Duration& duration,
+PN_CPP_EXTERN Duration operator*(const Duration& duration,
                                          uint64_t multiplier);
-PROTON_CPP_EXTERN Duration operator*(uint64_t multiplier,
+PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
                                          const Duration& duration);
-PROTON_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
-PROTON_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
 
 }} // namespace proton::reactor
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Encoder.h b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
new file mode 100644
index 0000000..460bea4
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Encoder.h
@@ -0,0 +1,108 @@
+#ifndef ENCODER_H
+#define ENCODER_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/cpp/Data.h"
+#include "proton/cpp/types.h"
+#include "proton/cpp/exceptions.h"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**
+Stream-like encoder from C++ values to AMQP bytes.
+
+@see types.h defines C++ typedefs and types for AMQP each type. These types
+insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
+insert any other type.
+
+*/
+class Encoder : public virtual Data {
+  public:
+    /** Raised if a Encoder operation fails  */
+    struct Error : public ProtonException {
+        explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+    };
+
+    PN_CPP_EXTERN Encoder();
+    PN_CPP_EXTERN ~Encoder();
+
+    /**
+     * Encode the current values into buffer and update size to reflect the number of bytes encoded.
+     *
+     * Clears the encoder.
+     *
+     *@return if buffer==0 or size is too small then return false and  size to the required size.
+     *Otherwise return true and set size to the number of bytes encoded.
+     */
+    PN_CPP_EXTERN bool encode(char* buffer, size_t& size);
+
+    /** Encode the current values into a std::string, resize the string if necessary.
+     *
+     * Clears the encoder.
+     */
+    PN_CPP_EXTERN void encode(std::string&);
+
+    /** Encode the current values into a std::string. Clears the encoder. */
+    PN_CPP_EXTERN std::string encode();
+
+    /** @defgroup encoder_simple_types Insert simple types.
+     *@{
+     */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+    ///@}
+
+  private:
+    PN_CPP_EXTERN Encoder(pn_data_t* pd); // Does not own.
+
+    // Not implemented
+    Encoder(const Encoder&);
+    Encoder& operator=(const Encoder&);
+
+  friend class Value;
+};
+
+}}
+#endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
index fc1a712..c3edb59 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Endpoint.h
@@ -45,8 +45,8 @@ class Endpoint
     typedef int State;
 
     // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
-    virtual PROTON_CPP_EXTERN Connection &getConnection() = 0;
-    Transport PROTON_CPP_EXTERN &getTransport();
+    virtual PN_CPP_EXTERN Connection &getConnection() = 0;
+    Transport PN_CPP_EXTERN &getTransport();
   protected:
     Endpoint();
     ~Endpoint();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Event.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Event.h b/proton-c/bindings/cpp/include/proton/cpp/Event.h
index 47aee2d..c0a3388 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Event.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Event.h
@@ -38,20 +38,20 @@ class Connection;
 class Event
 {
   public:
-    virtual PROTON_CPP_EXTERN void dispatch(Handler &h) = 0;
-    virtual PROTON_CPP_EXTERN Container &getContainer();
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
-    virtual PROTON_CPP_EXTERN Sender getSender();
-    virtual PROTON_CPP_EXTERN Receiver getReceiver();
-    virtual PROTON_CPP_EXTERN Link getLink();
-    virtual PROTON_CPP_EXTERN Message getMessage();
-    virtual PROTON_CPP_EXTERN void setMessage(Message &);
-    virtual PROTON_CPP_EXTERN ~Event();
+    virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0;
+    virtual PN_CPP_EXTERN Container &getContainer();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    virtual PN_CPP_EXTERN Message getMessage();
+    virtual PN_CPP_EXTERN void setMessage(Message &);
+    virtual PN_CPP_EXTERN ~Event();
   protected:
-    PROTON_CPP_EXTERN PROTON_CPP_EXTERN Event();
+    PN_CPP_EXTERN PN_CPP_EXTERN Event();
   private:
-    PROTON_CPP_EXTERN Event(const Event&);
-    PROTON_CPP_EXTERN Event& operator=(const Event&);
+    PN_CPP_EXTERN Event(const Event&);
+    PN_CPP_EXTERN Event& operator=(const Event&);
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Exception.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Exception.h b/proton-c/bindings/cpp/include/proton/cpp/Exception.h
new file mode 100644
index 0000000..d24c8ef
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Exception.h
@@ -0,0 +1,49 @@
+#ifndef PROTON_CPP_EXCEPTIONS_H
+#define PROTON_CPP_EXCEPTIONS_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 <stdexcept>
+
+namespace proton {
+namespace reactor {
+
+class Exception : public std::runtime_error
+{
+  public:
+    explicit Exception(const std::string& msg) throw() : std::runtime_error(msg) {}
+};
+
+class MessageReject : public Exception
+{
+  public:
+    explicit MessageReject(const std::string& msg) throw() : Exception(msg) {}
+};
+
+class MessageRelease : public Exception
+{
+  public:
+    explicit MessageRelease(const std::string& msg) throw() : Exception(msg) {}
+};
+
+}} // namespace proton::reactor
+
+#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Handle.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handle.h b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
index 2cf3f99..48fe6b9 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handle.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handle.h
@@ -30,6 +30,8 @@ namespace reactor {
 template <class> class PrivateImplRef;
 template <class> class ProtonImplRef;
 
+// FIXME aconway 2015-06-09: don't need handle, get rid of it.
+
 /**
  * A handle is like a pointer: refers to an underlying implementation object.
  * Copying the handle does not copy the object.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Handler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Handler.h b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
index 231942f..86b5bbf 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Handler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Handler.h
@@ -29,17 +29,17 @@
 namespace proton {
 namespace reactor {
 
-class PROTON_CPP_EXTERN Handler
+class PN_CPP_EXTERN Handler
 {
   public:
-    PROTON_CPP_EXTERN Handler();
-    PROTON_CPP_EXTERN virtual ~Handler();
+    PN_CPP_EXTERN Handler();
+    PN_CPP_EXTERN virtual ~Handler();
 
-    PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
+    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
 
-    PROTON_CPP_EXTERN virtual void addChildHandler(Handler &e);
-    PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
-    PROTON_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
+    PN_CPP_EXTERN virtual void addChildHandler(Handler &e);
+    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
+    PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
   protected:
     std::vector<Handler *>childHandlers;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
index 4a88576..cbc0626 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ImportExport.h
@@ -39,9 +39,9 @@
 // For c++ library symbols
 
 #ifdef protoncpp_EXPORTS
-#  define PROTON_CPP_EXTERN PROTON_CPP_EXPORT
+#  define PN_CPP_EXTERN PROTON_CPP_EXPORT
 #else
-#  define PROTON_CPP_EXTERN PROTON_CPP_IMPORT
+#  define PN_CPP_EXTERN PROTON_CPP_IMPORT
 #endif
 
 // TODO:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Link.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Link.h b/proton-c/bindings/cpp/include/proton/cpp/Link.h
index 391e5fc..f4b9662 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Link.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Link.h
@@ -36,24 +36,24 @@ namespace reactor {
 class Link : public Endpoint, public ProtonHandle<pn_link_t>
 {
   public:
-    PROTON_CPP_EXTERN Link(pn_link_t *);
-    PROTON_CPP_EXTERN Link();
-    PROTON_CPP_EXTERN ~Link();
-    PROTON_CPP_EXTERN Link(const Link&);
-    PROTON_CPP_EXTERN Link& operator=(const Link&);
-    PROTON_CPP_EXTERN void open();
-    PROTON_CPP_EXTERN void close();
-    PROTON_CPP_EXTERN bool isSender();
-    PROTON_CPP_EXTERN bool isReceiver();
-    PROTON_CPP_EXTERN int getCredit();
-    PROTON_CPP_EXTERN Terminus getSource();
-    PROTON_CPP_EXTERN Terminus getTarget();
-    PROTON_CPP_EXTERN Terminus getRemoteSource();
-    PROTON_CPP_EXTERN Terminus getRemoteTarget();
-    PROTON_CPP_EXTERN std::string getName();
-    PROTON_CPP_EXTERN pn_link_t *getPnLink() const;
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
-    PROTON_CPP_EXTERN Link getNext(Endpoint::State mask);
+    PN_CPP_EXTERN Link(pn_link_t *);
+    PN_CPP_EXTERN Link();
+    PN_CPP_EXTERN ~Link();
+    PN_CPP_EXTERN Link(const Link&);
+    PN_CPP_EXTERN Link& operator=(const Link&);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN bool isSender();
+    PN_CPP_EXTERN bool isReceiver();
+    PN_CPP_EXTERN int getCredit();
+    PN_CPP_EXTERN Terminus getSource();
+    PN_CPP_EXTERN Terminus getTarget();
+    PN_CPP_EXTERN Terminus getRemoteSource();
+    PN_CPP_EXTERN Terminus getRemoteTarget();
+    PN_CPP_EXTERN std::string getName();
+    PN_CPP_EXTERN pn_link_t *getPnLink() const;
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN Link getNext(Endpoint::State mask);
   protected:
     virtual void verifyType(pn_link_t *l);
   private:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Message.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Message.h b/proton-c/bindings/cpp/include/proton/cpp/Message.h
index 590fdd8..d24cc1b 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Message.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Message.h
@@ -33,74 +33,78 @@ namespace reactor {
 class Message : public ProtonHandle<pn_message_t>
 {
   public:
-    PROTON_CPP_EXTERN Message();
-    PROTON_CPP_EXTERN Message(pn_message_t *);
-    PROTON_CPP_EXTERN Message(const Message&);
-    PROTON_CPP_EXTERN Message& operator=(const Message&);
-    PROTON_CPP_EXTERN ~Message();
+    PN_CPP_EXTERN Message();
+    PN_CPP_EXTERN Message(pn_message_t *);
+    PN_CPP_EXTERN Message(const Message&);
+    PN_CPP_EXTERN Message& operator=(const Message&);
+    PN_CPP_EXTERN ~Message();
 
-    PROTON_CPP_EXTERN pn_message_t *getPnMessage() const;
+    PN_CPP_EXTERN pn_message_t *getPnMessage() const;
 
-    PROTON_CPP_EXTERN void setId(uint64_t id);
-    PROTON_CPP_EXTERN uint64_t getId();
-    PROTON_CPP_EXTERN void setId(const std::string &id);
-    PROTON_CPP_EXTERN std::string getStringId();
-    PROTON_CPP_EXTERN void setId(const char *p, size_t len);
-    PROTON_CPP_EXTERN size_t getId(const char **p);
-    // TODO: UUID version
-    PROTON_CPP_EXTERN pn_type_t getIdType();
+    // FIXME aconway 2015-06-11: get rid of get/set prefixes
 
-    PROTON_CPP_EXTERN void setUserId(const std::string &id);
-    PROTON_CPP_EXTERN std::string getUserId();
+    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+    PN_CPP_EXTERN void setId(uint64_t id);
+    PN_CPP_EXTERN uint64_t getId();
+    PN_CPP_EXTERN void setId(const std::string &id);
+    PN_CPP_EXTERN std::string getStringId();
+    PN_CPP_EXTERN void setId(const char *p, size_t len);
+    PN_CPP_EXTERN size_t getId(const char **p);
+    PN_CPP_EXTERN pn_type_t getIdType();
 
-    PROTON_CPP_EXTERN void setAddress(const std::string &addr);
-    PROTON_CPP_EXTERN std::string getAddress();
+    PN_CPP_EXTERN void setUserId(const std::string &id);
+    PN_CPP_EXTERN std::string getUserId();
 
-    PROTON_CPP_EXTERN void setSubject(const std::string &s);
-    PROTON_CPP_EXTERN std::string getSubject();
+    PN_CPP_EXTERN void setAddress(const std::string &addr);
+    PN_CPP_EXTERN std::string getAddress();
 
-    PROTON_CPP_EXTERN void setReplyTo(const std::string &s);
-    PROTON_CPP_EXTERN std::string getReplyTo();
+    PN_CPP_EXTERN void setSubject(const std::string &s);
+    PN_CPP_EXTERN std::string getSubject();
 
-    PROTON_CPP_EXTERN void setCorrelationId(uint64_t id);
-    PROTON_CPP_EXTERN uint64_t getCorrelationId();
-    PROTON_CPP_EXTERN void setCorrelationId(const std::string &id);
-    PROTON_CPP_EXTERN std::string getStringCorrelationId();
-    PROTON_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
-    PROTON_CPP_EXTERN size_t getCorrelationId(const char **p);
-    // TODO: UUID version
-    PROTON_CPP_EXTERN pn_type_t getCorrelationIdType();
+    PN_CPP_EXTERN void setReplyTo(const std::string &s);
+    PN_CPP_EXTERN std::string getReplyTo();
 
-    PROTON_CPP_EXTERN void setContentType(const std::string &s);
-    PROTON_CPP_EXTERN std::string getContentType();
+    PN_CPP_EXTERN void setCorrelationId(uint64_t id);
+    PN_CPP_EXTERN uint64_t getCorrelationId();
+    PN_CPP_EXTERN void setCorrelationId(const std::string &id);
+    PN_CPP_EXTERN std::string getStringCorrelationId();
+    PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
+    PN_CPP_EXTERN size_t getCorrelationId(const char **p);
 
-    PROTON_CPP_EXTERN void setContentEncoding(const std::string &s);
-    PROTON_CPP_EXTERN std::string getContentEncoding();
+    // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+    PN_CPP_EXTERN pn_type_t getCorrelationIdType();
 
-    PROTON_CPP_EXTERN void setExpiry(pn_timestamp_t t);
-    PROTON_CPP_EXTERN pn_timestamp_t getExpiry();
+    PN_CPP_EXTERN void setContentType(const std::string &s);
+    PN_CPP_EXTERN std::string getContentType();
 
-    PROTON_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
-    PROTON_CPP_EXTERN pn_timestamp_t getCreationTime();
+    PN_CPP_EXTERN void setContentEncoding(const std::string &s);
+    PN_CPP_EXTERN std::string getContentEncoding();
 
-    PROTON_CPP_EXTERN void setGroupId(const std::string &s);
-    PROTON_CPP_EXTERN std::string getGroupId();
+    PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
+    PN_CPP_EXTERN pn_timestamp_t getExpiry();
 
-    PROTON_CPP_EXTERN void setReplyToGroupId(const std::string &s);
-    PROTON_CPP_EXTERN std::string getReplyToGroupId();
+    PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
+    PN_CPP_EXTERN pn_timestamp_t getCreationTime();
 
-    PROTON_CPP_EXTERN void setBody(const std::string &data);
-    PROTON_CPP_EXTERN std::string getBody();
+    PN_CPP_EXTERN void setGroupId(const std::string &s);
+    PN_CPP_EXTERN std::string getGroupId();
 
-    PROTON_CPP_EXTERN void getBody(std::string &str);
+    PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
+    PN_CPP_EXTERN std::string getReplyToGroupId();
 
-    PROTON_CPP_EXTERN void setBody(const char *, size_t len);
-    PROTON_CPP_EXTERN size_t getBody(char *, size_t len);
-    PROTON_CPP_EXTERN size_t getBinaryBodySize();
+    // FIXME aconway 2015-06-11: use Values for body.
+    PN_CPP_EXTERN void setBody(const std::string &data);
+    PN_CPP_EXTERN std::string getBody();
 
+    PN_CPP_EXTERN void getBody(std::string &str);
 
-    PROTON_CPP_EXTERN void encode(std::string &data);
-    PROTON_CPP_EXTERN void decode(const std::string &data);
+    PN_CPP_EXTERN void setBody(const char *, size_t len);
+    PN_CPP_EXTERN size_t getBody(char *, size_t len);
+    PN_CPP_EXTERN size_t getBinaryBodySize();
+
+
+    PN_CPP_EXTERN void encode(std::string &data);
+    PN_CPP_EXTERN void decode(const std::string &data);
 
   private:
     friend class ProtonImplRef<Message>;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
index 280df5b..9cf4347 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingAdapter.h
@@ -38,37 +38,37 @@ namespace reactor {
 class MessagingAdapter : public MessagingHandler
 {
   public:
-    PROTON_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
-    PROTON_CPP_EXTERN virtual ~MessagingAdapter();
-    PROTON_CPP_EXTERN virtual void onReactorInit(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkFlow(Event &e);
-    PROTON_CPP_EXTERN virtual void onDelivery(Event &e);
-    PROTON_CPP_EXTERN virtual void onUnhandled(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionClosed(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionClosing(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionError(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionOpened(Event &e);
-    PROTON_CPP_EXTERN virtual void onConnectionOpening(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionClosed(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionClosing(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionError(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionOpened(Event &e);
-    PROTON_CPP_EXTERN virtual void onSessionOpening(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkClosed(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkClosing(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkError(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkOpened(Event &e);
-    PROTON_CPP_EXTERN virtual void onLinkOpening(Event &e);
-    PROTON_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
+    PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
+    PN_CPP_EXTERN virtual ~MessagingAdapter();
+    PN_CPP_EXTERN virtual void onReactorInit(Event &e);
+    PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
+    PN_CPP_EXTERN virtual void onDelivery(Event &e);
+    PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionError(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
+    PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
+    PN_CPP_EXTERN virtual void onSessionError(Event &e);
+    PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
+    PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
+    PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
+    PN_CPP_EXTERN virtual void onLinkError(Event &e);
+    PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+    PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
+    PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
+    PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
   private:
     MessagingHandler &delegate;  // The handler for generated MessagingEvent's
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
index de79618..f71cace 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingEvent.h
@@ -79,13 +79,13 @@ class MessagingEvent : public ProtonEvent
     MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
     MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
     ~MessagingEvent();
-    virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
-    virtual PROTON_CPP_EXTERN Sender getSender();
-    virtual PROTON_CPP_EXTERN Receiver getReceiver();
-    virtual PROTON_CPP_EXTERN Link getLink();
-    virtual PROTON_CPP_EXTERN Message getMessage();
-    virtual PROTON_CPP_EXTERN void setMessage(Message &);
+    virtual PN_CPP_EXTERN void dispatch(Handler &h);
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    virtual PN_CPP_EXTERN Message getMessage();
+    virtual PN_CPP_EXTERN void setMessage(Message &);
   private:
     MessagingEventType_t messagingType;
     ProtonEvent *parentEvent;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
index c6d8f72..e6c0341 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/MessagingHandler.h
@@ -32,10 +32,10 @@ namespace reactor {
 class Event;
 class MessagingAdapter;
 
-class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
+class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
 {
   public:
-    PROTON_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+    PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
                                        bool peerCloseIsError=false);
     virtual ~MessagingHandler();
 
@@ -83,7 +83,7 @@ class PROTON_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
     bool peerCloseIsError;
     MessagingAdapter *messagingAdapter;
     Handler *flowController;
-    PROTON_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+    PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
                                        bool peerCloseIsError=false);
   private:
     friend class ContainerImpl;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
index 9e5e9f3..be26d83 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonEvent.h
@@ -35,16 +35,16 @@ class Container;
 class ProtonEvent : public Event
 {
   public:
-    virtual PROTON_CPP_EXTERN void dispatch(Handler &h);
-    virtual PROTON_CPP_EXTERN Container &getContainer();
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
-    virtual PROTON_CPP_EXTERN Sender getSender();
-    virtual PROTON_CPP_EXTERN Receiver getReceiver();
-    virtual PROTON_CPP_EXTERN Link getLink();
-    PROTON_CPP_EXTERN int getType();
-    PROTON_CPP_EXTERN pn_event_t* getPnEvent();
+    virtual PN_CPP_EXTERN void dispatch(Handler &h);
+    virtual PN_CPP_EXTERN Container &getContainer();
+    virtual PN_CPP_EXTERN Connection &getConnection();
+    virtual PN_CPP_EXTERN Sender getSender();
+    virtual PN_CPP_EXTERN Receiver getReceiver();
+    virtual PN_CPP_EXTERN Link getLink();
+    PN_CPP_EXTERN int getType();
+    PN_CPP_EXTERN pn_event_t* getPnEvent();
   protected:
-    PROTON_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+    PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
   private:
     pn_event_t *pnEvent;
     int type;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
index b639cc3..4142a2d 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/ProtonHandler.h
@@ -32,7 +32,7 @@ class ProtonEvent;
 class ProtonHandler : public Handler
 {
   public:
-    PROTON_CPP_EXTERN ProtonHandler();
+    PN_CPP_EXTERN ProtonHandler();
     virtual void onReactorInit(Event &e);
     virtual void onReactorQuiesced(Event &e);
     virtual void onReactorFinal(Event &e);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
index c904dc9..a0f45e7 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Receiver.h
@@ -35,9 +35,9 @@ namespace reactor {
 class Receiver : public Link
 {
   public:
-    PROTON_CPP_EXTERN Receiver(pn_link_t *lnk);
-    PROTON_CPP_EXTERN Receiver();
-    PROTON_CPP_EXTERN Receiver(const Link& c);
+    PN_CPP_EXTERN Receiver(pn_link_t *lnk);
+    PN_CPP_EXTERN Receiver();
+    PN_CPP_EXTERN Receiver(const Link& c);
   protected:
     virtual void verifyType(pn_link_t *l);
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Sender.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Sender.h b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
index c63161c..1205f7f 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Sender.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Sender.h
@@ -38,10 +38,10 @@ namespace reactor {
 class Sender : public Link
 {
   public:
-    PROTON_CPP_EXTERN Sender(pn_link_t *lnk);
-    PROTON_CPP_EXTERN Sender();
-    PROTON_CPP_EXTERN Sender(const Link& c);
-    PROTON_CPP_EXTERN Delivery send(Message &m);
+    PN_CPP_EXTERN Sender(pn_link_t *lnk);
+    PN_CPP_EXTERN Sender();
+    PN_CPP_EXTERN Sender(const Link& c);
+    PN_CPP_EXTERN Delivery send(Message &m);
   protected:
     virtual void verifyType(pn_link_t *l);
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Session.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Session.h b/proton-c/bindings/cpp/include/proton/cpp/Session.h
index 68f5e40..8d2f02a 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Session.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Session.h
@@ -42,15 +42,15 @@ class Transport;
  class Session : public Endpoint, public ProtonHandle<pn_session_t>
 {
   public:
-    PROTON_CPP_EXTERN Session(pn_session_t *s);
-    PROTON_CPP_EXTERN Session();
-    PROTON_CPP_EXTERN ~Session();
-    PROTON_CPP_EXTERN void open();
-    PROTON_CPP_EXTERN Session(const Session&);
-    PROTON_CPP_EXTERN Session& operator=(const Session&);
-    PROTON_CPP_EXTERN void close();
-    PROTON_CPP_EXTERN pn_session_t *getPnSession();
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN Session(pn_session_t *s);
+    PN_CPP_EXTERN Session();
+    PN_CPP_EXTERN ~Session();
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN Session(const Session&);
+    PN_CPP_EXTERN Session& operator=(const Session&);
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_session_t *getPnSession();
+    virtual PN_CPP_EXTERN Connection &getConnection();
     Receiver createReceiver(std::string name);
     Sender createSender(std::string name);
   private:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
index 092fcc1..6f93cf4 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Terminus.h
@@ -52,25 +52,25 @@ class Terminus : public ProtonHandle<pn_terminus_t>
     };
 
   public:
-    PROTON_CPP_EXTERN Terminus();
-    PROTON_CPP_EXTERN ~Terminus();
-    PROTON_CPP_EXTERN Terminus(const Terminus&);
-    PROTON_CPP_EXTERN Terminus& operator=(const Terminus&);
-    PROTON_CPP_EXTERN pn_terminus_t *getPnTerminus();
-    PROTON_CPP_EXTERN Type getType();
-    PROTON_CPP_EXTERN void setType(Type);
-    PROTON_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
-    PROTON_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
-    PROTON_CPP_EXTERN DistributionMode getDistributionMode();
-    PROTON_CPP_EXTERN void setDistributionMode(DistributionMode);
-    PROTON_CPP_EXTERN std::string getAddress();
-    PROTON_CPP_EXTERN void setAddress(std::string &);
-    PROTON_CPP_EXTERN bool isDynamic();
-    PROTON_CPP_EXTERN void setDynamic(bool);
+    PN_CPP_EXTERN Terminus();
+    PN_CPP_EXTERN ~Terminus();
+    PN_CPP_EXTERN Terminus(const Terminus&);
+    PN_CPP_EXTERN Terminus& operator=(const Terminus&);
+    PN_CPP_EXTERN pn_terminus_t *getPnTerminus();
+    PN_CPP_EXTERN Type getType();
+    PN_CPP_EXTERN void setType(Type);
+    PN_CPP_EXTERN ExpiryPolicy getExpiryPolicy();
+    PN_CPP_EXTERN void setExpiryPolicy(ExpiryPolicy);
+    PN_CPP_EXTERN DistributionMode getDistributionMode();
+    PN_CPP_EXTERN void setDistributionMode(DistributionMode);
+    PN_CPP_EXTERN std::string getAddress();
+    PN_CPP_EXTERN void setAddress(std::string &);
+    PN_CPP_EXTERN bool isDynamic();
+    PN_CPP_EXTERN void setDynamic(bool);
 
   private:
     Link *link;
-    PROTON_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
+    PN_CPP_EXTERN Terminus(pn_terminus_t *, Link *);
     friend class Link;
     friend class ProtonImplRef<Terminus>;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Transport.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Transport.h b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
index 141e0a3..cd8bf91 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/Transport.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/Transport.h
@@ -35,9 +35,9 @@ class Connection;
 class Transport
 {
   public:
-    PROTON_CPP_EXTERN Transport();
-    PROTON_CPP_EXTERN ~Transport();
-    PROTON_CPP_EXTERN void bind(Connection &c);
+    PN_CPP_EXTERN Transport();
+    PN_CPP_EXTERN ~Transport();
+    PN_CPP_EXTERN void bind(Connection &c);
     Connection *connection;
     pn_transport_t *pnTransport;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/Value.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/Value.h b/proton-c/bindings/cpp/include/proton/cpp/Value.h
new file mode 100644
index 0000000..65ca7ec
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/Value.h
@@ -0,0 +1,103 @@
+#ifndef VALUE_H
+#define VALUE_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/cpp/Encoder.h"
+#include "proton/cpp/Decoder.h"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+/** Holds a sequence of AMQP values, allows inserting and extracting.
+ *
+ * After inserting values, call rewind() to extract them.
+ */
+class Values : public Encoder, public Decoder {
+  public:
+    Values();
+    Values(const Values&);
+    ~Values();
+
+    /** Copy data from another Values */
+    Values& operator=(const Values&);
+
+    PN_CPP_EXTERN void rewind();
+
+  private:
+  friend class Value;
+};
+
+/** Holds a single AMQP value. */
+class Value {
+  public:
+    PN_CPP_EXTERN Value();
+    PN_CPP_EXTERN Value(const Value&);
+    PN_CPP_EXTERN ~Value();
+
+    PN_CPP_EXTERN Value& operator=(const Value&);
+
+    TypeId type() const;
+
+    /** Set the value */
+    template<class T> void set(const T& value);
+    /** Get the value */
+    template<class T> void get(T& value) const;
+    /** Get the value */
+    template<class T> T get() const;
+
+    /** Assignment sets the value */
+    template<class T> Value& operator=(const T& value);
+    /** Conversion operator gets  the value */
+    template<class T> operator T() const;
+
+    /** Insert a value into an Encoder. */
+    PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+
+    /** Extract a value from a decoder. */
+    PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, const Value&);
+
+  friend Decoder& operator>>(Decoder&, Value&);
+  friend Encoder& operator<<(Encoder&, const Value&);
+
+    private:
+    Values values;
+};
+
+template<class T> void Value::set(const T& value) {
+    values.clear();
+    values << value;
+}
+
+template<class T> void Value::get(T& value) const {
+    Values& v = const_cast<Values&>(values);
+    v.rewind();
+    v >> value;
+}
+
+template<class T> T Value::get() const { T value; get(value); return value; }
+
+template<class T> Value& Value::operator=(const T& value) { set(value); return *this; }
+
+template<class T> Value::operator T() const { return get<T>(); }
+
+}}
+
+#endif // VALUE_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
index f4c7cb5..f973fa7 100644
--- a/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
+++ b/proton-c/bindings/cpp/include/proton/cpp/WaitCondition.h
@@ -32,7 +32,7 @@ namespace reactor {
 class WaitCondition
 {
   public:
-    PROTON_CPP_EXTERN virtual ~WaitCondition();
+    PN_CPP_EXTERN virtual ~WaitCondition();
 
     // Overide this member function to indicate whether an expected
     // condition is achieved and requires no further waiting.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/include/proton/cpp/types.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/cpp/types.h b/proton-c/bindings/cpp/include/proton/cpp/types.h
new file mode 100644
index 0000000..963a330
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/cpp/types.h
@@ -0,0 +1,162 @@
+#ifndef TYPES_H
+#define TYPES_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 <string>
+#include <stdint.h>
+#include <proton/codec.h>
+
+namespace proton {
+namespace reactor {
+
+/**@file
+ *
+ * C++ types representing simple AMQP types.
+ *
+ */
+
+
+/** Convert pn_bytes_t to string */
+std::string str(const pn_bytes_t&);
+
+/** Convert string to pn_bytes_t */
+pn_bytes_t bytes(const std::string&);
+
+/** Identifies an AMQP type */
+enum TypeId {
+    NULL_=PN_NULL,
+    BOOL=PN_BOOL,
+    UBYTE=PN_UBYTE,
+    BYTE=PN_BYTE,
+    USHORT=PN_USHORT,
+    SHORT=PN_SHORT,
+    UINT=PN_UINT,
+    INT=PN_INT,
+    CHAR=PN_CHAR,
+    ULONG=PN_ULONG,
+    LONG=PN_LONG,
+    TIMESTAMP=PN_TIMESTAMP,
+    FLOAT=PN_FLOAT,
+    DOUBLE=PN_DOUBLE,
+    DECIMAL32=PN_DECIMAL32,
+    DECIMAL64=PN_DECIMAL64,
+    DECIMAL128=PN_DECIMAL128,
+    UUID=PN_UUID,
+    BINARY=PN_BINARY,
+    STRING=PN_STRING,
+    SYMBOL=PN_SYMBOL,
+    DESCRIBED=PN_DESCRIBED,
+    ARRAY=PN_ARRAY,
+    LIST=PN_LIST,
+    MAP=PN_MAP
+};
+
+/** @defgroup types C++ type definitions for AMQP types.
+ *
+ * These types are all distinct for overloading purposes and will insert as the
+ * corresponding AMQP type with Encoder operator<<.
+ *
+ * @{
+ */
+struct Null {};
+typedef bool Bool;
+typedef uint8_t Ubyte;
+typedef int8_t Byte;
+typedef uint16_t Ushort;
+typedef int16_t Short;
+typedef uint32_t Uint;
+typedef int32_t Int;
+typedef wchar_t Char;
+typedef uint64_t Ulong;
+typedef int64_t Long;
+typedef float Float;
+typedef double Double;
+
+///@internal
+#define STRING_LIKE(NAME)                                               \
+    struct NAME : public std::string{                                   \
+        NAME(const std::string& s=std::string()) : std::string(s) {}    \
+        NAME(const pn_bytes_t& b) : std::string(str(b)) {}              \
+        operator pn_bytes_t() const { return bytes(*this); }            \
+    }
+
+/** UTF-8 encoded string */
+STRING_LIKE(String);
+/** ASCII encoded symbolic name */
+STRING_LIKE(Symbol);
+/** Binary data */
+STRING_LIKE(Binary);
+
+// TODO aconway 2015-06-11: alternative representation of variable-length data
+// as pointer to existing buffers.
+
+template <class T> struct Decimal {
+    T value;
+    Decimal(T v) : value(v) {}
+    Decimal& operator=(T v) { value = v; }
+    operator T() const { return value; }
+};
+typedef Decimal<pn_decimal32_t> Decimal32;
+typedef Decimal<pn_decimal64_t> Decimal64;
+typedef Decimal<pn_decimal128_t> Decimal128;
+
+struct Timestamp {
+    pn_timestamp_t milliseconds; ///< Since the epoch 00:00:00 (UTC), 1 January 1970.
+    Timestamp(int64_t ms) : milliseconds(ms) {}
+    operator pn_timestamp_t() const { return milliseconds; }
+};
+
+typedef pn_uuid_t Uuid;
+
+///@}
+
+/** Meta-function to get the type-id from a class */
+template <class T> struct TypeIdOf {};
+template<> struct TypeIdOf<Null> { static const TypeId value; };
+template<> struct TypeIdOf<Bool> { static const TypeId value; };
+template<> struct TypeIdOf<Ubyte> { static const TypeId value; };
+template<> struct TypeIdOf<Byte> { static const TypeId value; };
+template<> struct TypeIdOf<Ushort> { static const TypeId value; };
+template<> struct TypeIdOf<Short> { static const TypeId value; };
+template<> struct TypeIdOf<Uint> { static const TypeId value; };
+template<> struct TypeIdOf<Int> { static const TypeId value; };
+template<> struct TypeIdOf<Char> { static const TypeId value; };
+template<> struct TypeIdOf<Ulong> { static const TypeId value; };
+template<> struct TypeIdOf<Long> { static const TypeId value; };
+template<> struct TypeIdOf<Timestamp> { static const TypeId value; };
+template<> struct TypeIdOf<Float> { static const TypeId value; };
+template<> struct TypeIdOf<Double> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal32> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal64> { static const TypeId value; };
+template<> struct TypeIdOf<Decimal128> { static const TypeId value; };
+template<> struct TypeIdOf<Uuid> { static const TypeId value; };
+template<> struct TypeIdOf<Binary> { static const TypeId value; };
+template<> struct TypeIdOf<String> { static const TypeId value; };
+template<> struct TypeIdOf<Symbol> { static const TypeId value; };
+
+/** Return the name of a type. */
+std::string typeName(TypeId);
+
+/** Return the name of a type from a class. */
+template<class T> std::string typeName() { return typeName(TypeIdOf<T>::value); }
+
+}}
+
+#endif // TYPES_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ea258831/proton-c/bindings/cpp/src/ConnectionImpl.h
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ConnectionImpl.h b/proton-c/bindings/cpp/src/ConnectionImpl.h
index 48210a3..7add9a0 100644
--- a/proton-c/bindings/cpp/src/ConnectionImpl.h
+++ b/proton-c/bindings/cpp/src/ConnectionImpl.h
@@ -39,19 +39,19 @@ class Container;
 class ConnectionImpl : public Endpoint
 {
   public:
-    PROTON_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
-    PROTON_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
-    PROTON_CPP_EXTERN ~ConnectionImpl();
-    PROTON_CPP_EXTERN Transport &getTransport();
-    PROTON_CPP_EXTERN Handler *getOverride();
-    PROTON_CPP_EXTERN void setOverride(Handler *h);
-    PROTON_CPP_EXTERN void open();
-    PROTON_CPP_EXTERN void close();
-    PROTON_CPP_EXTERN pn_connection_t *getPnConnection();
-    PROTON_CPP_EXTERN Container &getContainer();
-    PROTON_CPP_EXTERN std::string getHostname();
-    PROTON_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
-    virtual PROTON_CPP_EXTERN Connection &getConnection();
+    PN_CPP_EXTERN ConnectionImpl(Container &c, pn_connection_t &pnConn);
+    PN_CPP_EXTERN ConnectionImpl(Container &c, Handler *h = 0);
+    PN_CPP_EXTERN ~ConnectionImpl();
+    PN_CPP_EXTERN Transport &getTransport();
+    PN_CPP_EXTERN Handler *getOverride();
+    PN_CPP_EXTERN void setOverride(Handler *h);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    PN_CPP_EXTERN pn_connection_t *getPnConnection();
+    PN_CPP_EXTERN Container &getContainer();
+    PN_CPP_EXTERN std::string getHostname();
+    PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+    virtual PN_CPP_EXTERN Connection &getConnection();
     static Connection &getReactorReference(pn_connection_t *);
     static ConnectionImpl *getImpl(const Connection &c) { return c.impl; }
     void reactorDetach();


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