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/07/16 07:23:49 UTC

[2/3] qpid-proton git commit: PROTON-865: C++ binding API documentation and cleanup.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 22c61d0..62fb960 100644
--- a/proton-c/bindings/cpp/include/proton/terminus.hpp
+++ b/proton-c/bindings/cpp/include/proton/terminus.hpp
@@ -31,22 +31,28 @@ namespace proton {
 
 class link;
 
+/** A terminus represents one end of a link.
+ * The source terminus is where originate, the target terminus is where they go.
+ */
 class terminus : public proton_handle<pn_terminus_t>
 {
   public:
+    /// Type of terminus
     enum type_t {
         TYPE_UNSPECIFIED = PN_UNSPECIFIED,
         SOURCE = PN_SOURCE,
         TARGET = PN_TARGET,
-        COORDINATOR = PN_COORDINATOR
+        COORDINATOR = PN_COORDINATOR ///< Transaction co-ordinator
     };
 
+    /// Expiry policy
     enum expiry_policy_t {
         NONDURABLE = PN_NONDURABLE,
         CONFIGURATION = PN_CONFIGURATION,
         DELIVERIES = PN_DELIVERIES
     };
 
+    /// Distribution mode
     enum distribution_mode_t {
         MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED,
         COPY = PN_DIST_MODE_COPY,

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 8d0774f..6bb6f5b 100644
--- a/proton-c/bindings/cpp/include/proton/transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/transport.hpp
@@ -31,11 +31,14 @@ namespace proton {
 
 class connection;
 
+/** Represents a connection transport */
 class transport
 {
   public:
     PN_CPP_EXTERN transport();
     PN_CPP_EXTERN ~transport();
+
+    /** Bind the transport to an AMQP connection */
     PN_CPP_EXTERN void bind(connection &c);
 
     class connection* connection() const { return connection_; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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
index 4f02214..aa1f610 100644
--- a/proton-c/bindings/cpp/include/proton/type_traits.hpp
+++ b/proton-c/bindings/cpp/include/proton/type_traits.hpp
@@ -19,23 +19,19 @@
  * under the License.
  */
 
-///@cond INTERNAL_DETAIL
+/**@file
+ * Internal: Type traits for mapping between AMQP and C++ types.
+ *
+ * Also provides workarounds for missing type_traits classes on older C++ compilers.
+ * @cond INTERNAL
+ */
 
 #include "proton/types.hpp"
 
-#if  defined(__cplusplus) && __cplusplus >= 201100
-#include <type_traits>
-#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729
+#ifdef USE_CPP11
 #include <type_traits>
 #else
-/**
- * Workaround missing std:: classes on older C++ compilers.  NOTE: this is NOT a
- * full implementation of the standard c++11 types, it is the bare minimum
- * needed by this library.
- */
 namespace std {
-
-
 template <bool, class T=void> struct enable_if;
 template <class T> struct enable_if<true, T> { typedef T type; };
 
@@ -123,7 +119,6 @@ template <class T> struct is_unknown_integer {
 };
 
 }
-
 ///@endcond
 
 #endif // TYPE_TRAITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 f3adbf5..d5cf23c 100644
--- a/proton-c/bindings/cpp/include/proton/types.hpp
+++ b/proton-c/bindings/cpp/include/proton/types.hpp
@@ -21,7 +21,6 @@
 
 /**@file
  * Defines C++ types representing AMQP types.
- * @ingroup cpp
  */
 
 #include "proton/export.hpp"
@@ -35,9 +34,7 @@
 
 namespace proton {
 
-/** type_id identifies an AMQP type.
- *@ingroup cpp
- */
+/** type_id identifies an AMQP type. */
 enum type_id {
     NULl_=PN_NULL,              ///< The null type, contains no data.
     BOOL=PN_BOOL,               ///< Boolean true or false.
@@ -66,8 +63,9 @@ enum type_id {
     MAP=PN_MAP                  ///< A sequence of key:value pairs, may be of mixed types.
 };
 
-///@internal
+/// Internal base class to provide comparison operators.
 template <class T> struct comparable {};
+///@cond INTERNAL
 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
 }
@@ -77,37 +75,38 @@ template<class T> bool operator>=(const comparable<T>& a, const comparable<T>& 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); }
 
-/// AMQP NULL type. @ingroup cpp
+PN_CPP_EXTERN pn_bytes_t pn_bytes(const std::string&);
+PN_CPP_EXTERN std::string str(const pn_bytes_t& b);
+///@endcond
+
+/// AMQP NULL type.
 struct amqp_null {};
-/// AMQP boolean type. @ingroup cpp
+/// AMQP boolean type.
 typedef bool amqp_bool;
-/// AMQP unsigned 8-bit type. @ingroup cpp
+/// AMQP unsigned 8-bit type.
 typedef std::uint8_t amqp_ubyte;
-/// AMQP signed 8-bit integer type. @ingroup cpp
+/// AMQP signed 8-bit integer type.
 typedef std::int8_t amqp_byte;
-/// AMQP unsigned 16-bit integer type. @ingroup cpp
+/// AMQP unsigned 16-bit integer type.
 typedef std::uint16_t amqp_ushort;
-/// AMQP signed 16-bit integer type. @ingroup cpp
+/// AMQP signed 16-bit integer type.
 typedef std::int16_t amqp_short;
-/// AMQP unsigned 32-bit integer type. @ingroup cpp
+/// AMQP unsigned 32-bit integer type.
 typedef std::uint32_t amqp_uint;
-/// AMQP signed 32-bit integer type. @ingroup cpp
+/// AMQP signed 32-bit integer type.
 typedef std::int32_t amqp_int;
-/// AMQP 32-bit unicode character type. @ingroup cpp
+/// AMQP 32-bit unicode character type.
 typedef wchar_t amqp_char;
-/// AMQP unsigned 64-bit integer type. @ingroup cpp
+/// AMQP unsigned 64-bit integer type.
 typedef std::uint64_t amqp_ulong;
-/// AMQP signed 64-bit integer type. @ingroup cpp
+/// AMQP signed 64-bit integer type.
 typedef std::int64_t amqp_long;
-/// AMQP 32-bit floating-point type. @ingroup cpp
+/// AMQP 32-bit floating-point type.
 typedef float amqp_float;
-/// AMQP 64-bit floating-point type. @ingroup cpp
+/// AMQP 64-bit floating-point type.
 typedef double amqp_double;
 
-PN_CPP_EXTERN pn_bytes_t pn_bytes(const std::string&);
-PN_CPP_EXTERN std::string str(const pn_bytes_t& b);
-
-/// AMQP UTF-8 encoded string. @ingroup cpp
+/// AMQP UTF-8 encoded string.
 struct amqp_string : public std::string {
     amqp_string(const std::string& s=std::string()) : std::string(s) {}
     amqp_string(const char* s) : std::string(s) {}
@@ -115,7 +114,7 @@ struct amqp_string : public std::string {
     operator pn_bytes_t() const { return pn_bytes(*this); }
 };
 
-/// AMQP ASCII encoded symbolic name. @ingroup cpp
+/// AMQP ASCII encoded symbolic name.
 struct amqp_symbol : public std::string {
     amqp_symbol(const std::string& s=std::string()) : std::string(s) {}
     amqp_symbol(const char* s) : std::string(s) {}
@@ -123,7 +122,7 @@ struct amqp_symbol : public std::string {
     operator pn_bytes_t() const { return pn_bytes(*this); }
 };
 
-/// AMQP variable-length binary data. @ingroup cpp
+/// AMQP variable-length binary data.
 struct amqp_binary : public std::string {
     amqp_binary(const std::string& s=std::string()) : std::string(s) {}
     amqp_binary(const char* s) : std::string(s) {}
@@ -134,7 +133,7 @@ struct amqp_binary : public std::string {
 // TODO aconway 2015-06-11: alternative representation of variable-length data
 // as pointer to existing buffer.
 
-// Wrapper for opaque proton types that can be treated as byte arrays.
+/// Template for opaque proton proton types that can be treated as byte arrays.
 template <class P> struct opaque: public comparable<opaque<P> > {
     P value;
     opaque(const P& p=P()) : value(p) {}
@@ -152,17 +151,17 @@ template <class P> struct opaque: public comparable<opaque<P> > {
     bool operator<(const opaque& x) const { return std::lexicographical_compare(begin(), end(), x.begin(), x.end()); }
 };
 
-/// AMQP 16-byte UUID. @ingroup cpp
+/// AMQP 16-byte UUID.
 typedef opaque<pn_uuid_t> amqp_uuid;
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const amqp_uuid&);
-/// AMQP 32-bit decimal floating point (IEEE 854). @ingroup cpp
+/// AMQP 32-bit decimal floating point (IEEE 854).
 typedef opaque<pn_decimal32_t> amqp_decimal32;
-/// AMQP 64-bit decimal floating point (IEEE 854). @ingroup cpp
+/// AMQP 64-bit decimal floating point (IEEE 854).
 typedef opaque<pn_decimal64_t> amqp_decimal64;
-/// AMQP 128-bit decimal floating point (IEEE 854). @ingroup cpp
+/// AMQP 128-bit decimal floating point (IEEE 854).
 typedef opaque<pn_decimal128_t> amqp_decimal128;
 
-/// AMQP timestamp, milliseconds since the epoch 00:00:00 (UTC), 1 January 1970. @ingroup cpp
+/// AMQP timestamp, milliseconds since the epoch 00:00:00 (UTC), 1 January 1970.
 struct amqp_timestamp : public comparable<amqp_timestamp> {
     pn_timestamp_t milliseconds;
     amqp_timestamp(std::int64_t ms=0) : milliseconds(ms) {}
@@ -171,6 +170,7 @@ struct amqp_timestamp : public comparable<amqp_timestamp> {
     bool operator<(const amqp_timestamp& x) { return milliseconds < x.milliseconds; }
 };
 
+///@cond INTERNAL
 template<class T, type_id A> struct type_pair {
     typedef T cpp_type;
     type_id type;
@@ -186,41 +186,45 @@ template<class T, type_id A> struct cref : public type_pair<T, A> {
     cref(const ref<T,A>& ref) : value(ref.value) {}
     const T& value;
 };
+///@endcond INTERNAL
 
 /** A holder for AMQP values. A holder is always encoded/decoded as its amqp_value, no need
  * for the as<TYPE>() helper functions.
  *
  * For example to encode an array of arrays using std::vector:
  *
- *     typedef Holder<std::vector<amqp_string>, ARRAY> Inner;
- *     typedef Holder<std::vector<Inner>, ARRAY> Outer;
+ *     typedef holder<std::vector<amqp_string>, ARRAY> Inner;
+ *     typedef holder<std::vector<Inner>, ARRAY> Outer;
  *     Outer o ...
  *     encoder << o;
- * @ingroup cpp
+ *
  */
-template<class T, type_id A> struct Holder : public type_pair<T, A> {
+template<class T, type_id A> struct holder : public type_pair<T, A> {
     T value;
 };
 
-/** Create a reference to value as AMQP type A for decoding. For example to decode an array of amqp_int:
+/** Create a reference to value as AMQP type A for decoding.
+ * For example to decode an array of amqp_int:
  *
  *     std::vector<amqp_int> v;
  *     decoder >> as<ARRAY>(v);
- * @ingroup cpp
  */
 template <type_id 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. */
+/** Create a const reference to value as AMQP type A for encoding.
+ * For example to encode an array of amqp_int:
+ *
+ *     std::vector<amqp_int> v;
+ *     encoder << as<ARRAY>(v);
+ */
 template <type_id 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. @ingroup cpp */
+/** Return the name of a type. */
 PN_CPP_EXTERN std::string type_name(type_id);
 
-/** Print the name of a type. @ingroup cpp */
+/** Print the name of a type. */
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, type_id);
 
 /** Information needed to start extracting or inserting a container type.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/include/proton/url.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/url.hpp b/proton-c/bindings/cpp/include/proton/url.hpp
index 1d7ca10..4da3a56 100644
--- a/proton-c/bindings/cpp/include/proton/url.hpp
+++ b/proton-c/bindings/cpp/include/proton/url.hpp
@@ -27,11 +27,15 @@ struct pn_url_t;
 
 namespace proton {
 
+/// Thrown if URL parsing fails.
 struct bad_url : public error { PN_CPP_EXTERN explicit bad_url(const std::string&) throw(); };
 
 
 /**
- * url is a proton URL of the form <scheme>://<username>:<password>@<host>:<port>/<path>.
+ * url is a proton URL of the form `<scheme>://<username>:<password>@<host>:<port>/<path>`.
+ * scheme can be `amqp` or `amqps`. host is a DNS name or IP address (v4 or v6)
+ * port can be a number or symbolic service name like `amqp`. path is normally used as
+ * a link source or target address, on a broker it typically it corresponds to a queue or topic name.
  */
 class url {
   public:
@@ -48,6 +52,13 @@ class url {
      */
     PN_CPP_EXTERN url(const std::string& url_str, bool defaults=true);
 
+    /** Parse url_str as an AMQP URL. If defaults is true, fill in defaults for missing values
+     *  otherwise return an empty string for missing values.
+     *  Note: converts automatically from string.
+     *@throws bad_url if URL is invalid.
+     */
+    PN_CPP_EXTERN url(const char* url_str, bool defaults=true);
+
     PN_CPP_EXTERN url(const url&);
     PN_CPP_EXTERN ~url();
     PN_CPP_EXTERN url& operator=(const url&);
@@ -57,6 +68,11 @@ class url {
      */
     PN_CPP_EXTERN void parse(const std::string&);
 
+    /** Parse a string as a URL 
+     *@throws bad_url if URL is invalid.
+     */
+    PN_CPP_EXTERN void parse(const char*);
+
     PN_CPP_EXTERN bool empty() const;
 
     /** str returns the URL as a string string */
@@ -92,11 +108,19 @@ class url {
     /** defaults fills in default values for missing parts of the URL */
     PN_CPP_EXTERN void defaults();
 
+  friend std::ostream& operator<<(std::ostream&, const url&);
+
+    /** parse url from istream, automatically fills in defaults for missing values.
+     *
+     * Note: an invalid url is indicated by setting std::stream::fail() NOT by throwing bad_url.
+     */
+  friend std::istream& operator>>(std::istream&, url&);
+
   private:
     pn_url_t* url_;
 };
 
-std::ostream& operator<<(std::ostream&, const url&);
+
 }
 
 #endif // URL_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/include/proton/wait_condition.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/wait_condition.hpp b/proton-c/bindings/cpp/include/proton/wait_condition.hpp
index f184f71..760928e 100644
--- a/proton-c/bindings/cpp/include/proton/wait_condition.hpp
+++ b/proton-c/bindings/cpp/include/proton/wait_condition.hpp
@@ -25,6 +25,9 @@
 
 namespace proton {
 
+// TODO aconway 2015-07-15: c++11 should use std::function
+// c++03 could use a function template.
+
 // Interface class to indicates that an expected contion has been
 // achieved, i.e. for blocking_connection.wait()
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/blocking_connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection.cpp b/proton-c/bindings/cpp/src/blocking_connection.cpp
index 5bd790b..02cec85 100644
--- a/proton-c/bindings/cpp/src/blocking_connection.cpp
+++ b/proton-c/bindings/cpp/src/blocking_connection.cpp
@@ -22,6 +22,7 @@
 #include "proton/blocking_connection.hpp"
 #include "proton/blocking_sender.hpp"
 #include "proton/messaging_handler.hpp"
+#include "proton/url.hpp"
 #include "proton/error.hpp"
 #include "msg.hpp"
 #include "blocking_connection_impl.hpp"
@@ -39,7 +40,7 @@ blocking_connection::blocking_connection(const blocking_connection& c) : handle<
 blocking_connection& blocking_connection::operator=(const blocking_connection& c) { return PI::assign(*this, c); }
 blocking_connection::~blocking_connection() { PI::dtor(*this); }
 
-blocking_connection::blocking_connection(std::string &url, duration d, ssl_domain *ssld, container *c) {
+blocking_connection::blocking_connection(const proton::url &url, duration d, ssl_domain *ssld, container *c) {
     blocking_connection_impl *cimpl = new blocking_connection_impl(url, d,ssld, c);
     PI::ctor(*this, cimpl);
 }
@@ -51,7 +52,7 @@ void blocking_connection::wait(wait_condition &cond, std::string &msg, duration
     return impl_->wait(cond, msg, timeout);
 }
 
-blocking_sender blocking_connection::create_sender(std::string &address, handler *h) {
+blocking_sender blocking_connection::create_sender(const std::string &address, handler *h) {
     sender sender = impl_->container_.create_sender(impl_->connection_, address, h);
     return blocking_sender(*this, sender);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection_impl.cpp b/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
index 43420d7..26d0e78 100644
--- a/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
+++ b/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
@@ -107,8 +107,7 @@ void blocking_connection_impl::wait(wait_condition &condition, std::string &msg,
                 std::string txt = "connection timed out";
                 if (!msg.empty())
                     txt += ": " + msg;
-                // TODO: proper Timeout exception
-                throw error(MSG(txt));
+                throw timeout_error(txt);
             }
         }
     } catch (...) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 6c21fdd..2b335a4 100644
--- a/proton-c/bindings/cpp/src/connection.cpp
+++ b/proton-c/bindings/cpp/src/connection.cpp
@@ -61,7 +61,7 @@ std::string connection::hostname() { return impl_->hostname(); }
 
 class container &connection::container() { return impl_->container(); }
 
-link connection::link_head(endpoint::State mask) {
+link connection::link_head(endpoint::state mask) {
     return impl_->link_head(mask);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/connection_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection_impl.cpp b/proton-c/bindings/cpp/src/connection_impl.cpp
index e515d78..51da569 100644
--- a/proton-c/bindings/cpp/src/connection_impl.cpp
+++ b/proton-c/bindings/cpp/src/connection_impl.cpp
@@ -129,7 +129,7 @@ connection &connection_impl::reactor_reference(pn_connection_t *conn) {
     return impl_->reactor_reference_;
 }
 
-link connection_impl::link_head(endpoint::State mask) {
+link connection_impl::link_head(endpoint::state mask) {
     return link(pn_link_head(pn_connection_, mask));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/connection_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection_impl.hpp b/proton-c/bindings/cpp/src/connection_impl.hpp
index 816f0d5..6450ef5 100644
--- a/proton-c/bindings/cpp/src/connection_impl.hpp
+++ b/proton-c/bindings/cpp/src/connection_impl.hpp
@@ -49,7 +49,7 @@ class connection_impl : public endpoint
     PN_CPP_EXTERN pn_connection_t *pn_connection();
     PN_CPP_EXTERN class container &container();
     PN_CPP_EXTERN std::string hostname();
-    PN_CPP_EXTERN link link_head(endpoint::State mask);
+    PN_CPP_EXTERN link link_head(endpoint::state mask);
     virtual PN_CPP_EXTERN class connection &connection();
     static class connection &reactor_reference(pn_connection_t *);
     static connection_impl *impl(const class connection &c) { return c.impl_; }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 f135336..07cb971 100644
--- a/proton-c/bindings/cpp/src/container.cpp
+++ b/proton-c/bindings/cpp/src/container.cpp
@@ -64,7 +64,7 @@ duration container::timeout() { return impl_->timeout(); }
 void container::timeout(duration timeout) { impl_->timeout(timeout); }
 
 
-sender container::create_sender(connection &connection, std::string &addr, handler *h) {
+sender container::create_sender(connection &connection, const std::string &addr, handler *h) {
     return impl_->create_sender(connection, addr, h);
 }
 
@@ -72,8 +72,8 @@ sender container::create_sender(const proton::url &url) {
     return impl_->create_sender(url);
 }
 
-receiver container::create_receiver(connection &connection, std::string &addr) {
-    return impl_->create_receiver(connection, addr);
+receiver container::create_receiver(connection &connection, const std::string &addr, handler *h) {
+    return impl_->create_receiver(connection, addr, h);
 }
 
 receiver container::create_receiver(const proton::url &url) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index fc1aafd..0858d73 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -230,7 +230,7 @@ void container_impl::timeout(duration timeout) {
 }
 
 
-sender container_impl::create_sender(connection &connection, std::string &addr, handler *h) {
+sender container_impl::create_sender(connection &connection, const std::string &addr, handler *h) {
     if (!reactor_) throw error(MSG("container not started"));
     session session = default_session(connection.pn_connection(), &impl(connection)->default_session_);
     sender snd = session.create_sender(container_id_  + '-' + addr);
@@ -255,19 +255,23 @@ sender container_impl::create_sender(const proton::url &url) {
     return snd;
 }
 
-receiver container_impl::create_receiver(connection &connection, std::string &addr) {
+receiver container_impl::create_receiver(connection &connection, const std::string &addr, handler *h) {
     if (!reactor_) throw error(MSG("container not started"));
     connection_impl *conn_impl = impl(connection);
     session session = default_session(conn_impl->pn_connection_, &conn_impl->default_session_);
     receiver rcv = session.create_receiver(container_id_ + '-' + addr);
-    pn_terminus_set_address(pn_link_source(rcv.pn_link()), addr.c_str());
+    pn_link_t *lnk = rcv.pn_link();
+    pn_terminus_set_address(pn_link_source(lnk), addr.c_str());
+    if (h) {
+        pn_record_t *record = pn_link_attachments(lnk);
+        pn_record_set_handler(record, wrap_handler(h));
+    }
     rcv.open();
     return rcv;
 }
 
 receiver container_impl::create_receiver(const proton::url &url) {
     if (!reactor_) throw error(MSG("container not started"));
-    // TODO: const cleanup of API
     connection conn = connect(url, 0);
     session session = default_session(conn.pn_connection(), &impl(conn)->default_session_);
     std::string path = url.path();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.hpp b/proton-c/bindings/cpp/src/container_impl.hpp
index 39f513d..4378f7d 100644
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ b/proton-c/bindings/cpp/src/container_impl.hpp
@@ -46,9 +46,9 @@ class container_impl
     PN_CPP_EXTERN connection connect(const url&, handler *h);
     PN_CPP_EXTERN void run();
     PN_CPP_EXTERN pn_reactor_t *reactor();
-    PN_CPP_EXTERN sender create_sender(connection &connection, std::string &addr, handler *h);
+    PN_CPP_EXTERN sender create_sender(connection &connection, const std::string &addr, handler *h);
     PN_CPP_EXTERN sender create_sender(const url&);
-    PN_CPP_EXTERN receiver create_receiver(connection &connection, std::string &addr);
+    PN_CPP_EXTERN receiver create_receiver(connection &connection, const std::string &addr, handler *h);
     PN_CPP_EXTERN receiver create_receiver(const url&);
     PN_CPP_EXTERN class acceptor listen(const url&);
     PN_CPP_EXTERN std::string container_id();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 92df1f7..6ad7dfe 100644
--- a/proton-c/bindings/cpp/src/decoder.cpp
+++ b/proton-c/bindings/cpp/src/decoder.cpp
@@ -293,7 +293,6 @@ decoder& operator>>(decoder& d, amqp_double& value) {
     return d;
 }
 
-// TODO aconway 2015-06-11: decimal conversions.
 decoder& operator>>(decoder& d, amqp_decimal32& value) {
     extract(d.data_, value, pn_data_get_decimal32);
     return d;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 98e912a..2b7d645 100644
--- a/proton-c/bindings/cpp/src/endpoint.cpp
+++ b/proton-c/bindings/cpp/src/endpoint.cpp
@@ -22,6 +22,7 @@
 #include "proton/endpoint.hpp"
 #include "proton/connection.hpp"
 #include "proton/transport.hpp"
+#include "proton/connection.h"
 
 namespace proton {
 
@@ -29,4 +30,13 @@ endpoint::endpoint() {}
 
 endpoint::~endpoint() {}
 
+const int endpoint::LOCAL_UNINIT = PN_LOCAL_UNINIT;
+const int endpoint::REMOTE_UNINIT = PN_REMOTE_UNINIT;
+const int endpoint::LOCAL_ACTIVE = PN_LOCAL_ACTIVE;
+const int endpoint::REMOTE_ACTIVE = PN_REMOTE_ACTIVE;
+const int endpoint::LOCAL_CLOSED = PN_LOCAL_CLOSED;
+const int endpoint::REMOTE_CLOSED = PN_REMOTE_CLOSED;
+const int endpoint::LOCAL_MASK = PN_LOCAL_MASK;
+const int endpoint::REMOTE_MASK = PN_REMOTE_MASK;
+ 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 18aaa7c..fb409ef 100644
--- a/proton-c/bindings/cpp/src/error.cpp
+++ b/proton-c/bindings/cpp/src/error.cpp
@@ -25,6 +25,8 @@ static const std::string prefix("proton: ");
 
 error::error(const std::string& msg) throw() : std::runtime_error(prefix+msg) {}
 
+timeout_error::timeout_error(const std::string& msg) throw() : error(msg) {}
+
 message_reject::message_reject(const std::string& msg) throw() : error(msg) {}
 
 message_release::message_release(const std::string& msg) throw() : error(msg) {}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 2470510..2cef0a2 100644
--- a/proton-c/bindings/cpp/src/link.cpp
+++ b/proton-c/bindings/cpp/src/link.cpp
@@ -105,7 +105,7 @@ class connection &link::connection() {
     return connection_impl::reactor_reference(c);
 }
 
-link link::next(endpoint::State mask) {
+link link::next(endpoint::state mask) {
 
     return link(pn_link_next(impl_, (pn_state_t) mask));
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 62dca4d..616f23d 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -44,13 +44,16 @@ message::message(const message& m) : proton_handle<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.
+// TODO aconway 2015-06-17: message should be a value not a handle
+// 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); }
 
+void message::clear() { pn_message_clear(impl_); }
+
 namespace {
 void confirm(pn_message_t * const&  p) {
     if (p) return;
@@ -189,12 +192,12 @@ std::string message::group_id() const {
     return s ? std::string(s) : std::string();
 }
 
-void message::reply_togroup_id(const std::string &s) {
+void message::reply_to_group_id(const std::string &s) {
     confirm(impl_);
     check(pn_message_set_reply_to_group_id(impl_, s.c_str()));
 }
 
-std::string message::reply_togroup_id() const {
+std::string message::reply_to_group_id() const {
     confirm(impl_);
     const char* s = pn_message_get_reply_to_group_id(impl_);
     return s ? std::string(s) : std::string();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index 433b254..0bb574f 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -43,7 +43,7 @@ messaging_adapter::~messaging_adapter(){}
 void messaging_adapter::on_reactor_init(event &e) {
     proton_event *pe = dynamic_cast<proton_event*>(&e);
     if (pe) {
-        messaging_event mevent(PN_MESSAGING_START, *pe);
+        messaging_event mevent(messaging_event::START, *pe);
         delegate_.on_start(mevent);
     }
 }
@@ -55,7 +55,7 @@ void messaging_adapter::on_link_flow(event &e) {
         pn_link_t *lnk = pn_event_link(pne);
         if (lnk && pn_link_is_sender(lnk) && pn_link_credit(lnk) > 0) {
             // create on_message extended event
-            messaging_event mevent(PN_MESSAGING_SENDABLE, *pe);
+            messaging_event mevent(messaging_event::SENDABLE, *pe);
             delegate_.on_sendable(mevent);;
         }
    }
@@ -86,7 +86,7 @@ void messaging_adapter::on_delivery(event &e) {
         if (pn_link_is_receiver(lnk)) {
             if (!pn_delivery_partial(dlv) && pn_delivery_readable(dlv)) {
                 // generate on_message
-                messaging_event mevent(PN_MESSAGING_MESSAGE, *pe);
+                messaging_event mevent(messaging_event::MESSAGE, *pe);
                 message m(receive_message(lnk, dlv));
                 mevent.message(m);
                 if (pn_link_state(lnk) & PN_LOCAL_CLOSED) {
@@ -114,7 +114,7 @@ void messaging_adapter::on_delivery(event &e) {
                 }
             }
             else if (pn_delivery_updated(dlv) && pn_delivery_settled(dlv)) {
-                messaging_event mevent(PN_MESSAGING_SETTLED, *pe);
+                messaging_event mevent(messaging_event::SETTLED, *pe);
                 delegate_.on_settled(mevent);
             }
         } else {
@@ -122,20 +122,20 @@ void messaging_adapter::on_delivery(event &e) {
             if (pn_delivery_updated(dlv)) {
                 std::uint64_t rstate = pn_delivery_remote_state(dlv);
                 if (rstate == PN_ACCEPTED) {
-                    messaging_event mevent(PN_MESSAGING_ACCEPTED, *pe);
+                    messaging_event mevent(messaging_event::ACCEPTED, *pe);
                     delegate_.on_accepted(mevent);
                 }
                 else if (rstate == PN_REJECTED) {
-                    messaging_event mevent(PN_MESSAGING_REJECTED, *pe);
+                    messaging_event mevent(messaging_event::REJECTED, *pe);
                     delegate_.on_rejected(mevent);
                 }
                 else if (rstate == PN_RELEASED || rstate == PN_MODIFIED) {
-                    messaging_event mevent(PN_MESSAGING_RELEASED, *pe);
+                    messaging_event mevent(messaging_event::RELEASED, *pe);
                     delegate_.on_released(mevent);
                 }
 
                 if (pn_delivery_settled(dlv)) {
-                    messaging_event mevent(PN_MESSAGING_SETTLED, *pe);
+                    messaging_event mevent(messaging_event::SETTLED, *pe);
                     delegate_.on_settled(mevent);
                 }
                 if (auto_settle_)
@@ -172,15 +172,15 @@ void messaging_adapter::on_link_remote_close(event &e) {
         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))) {
-            messaging_event mevent(PN_MESSAGING_LINK_ERROR, *pe);
+            messaging_event mevent(messaging_event::LINK_ERROR, *pe);
             on_link_error(mevent);
         }
         else if (is_local_closed(state)) {
-            messaging_event mevent(PN_MESSAGING_LINK_CLOSED, *pe);
+            messaging_event mevent(messaging_event::LINK_CLOSED, *pe);
             on_link_closed(mevent);
         }
         else {
-            messaging_event mevent(PN_MESSAGING_LINK_CLOSING, *pe);
+            messaging_event mevent(messaging_event::LINK_CLOSING, *pe);
             on_link_closing(mevent);
         }
         pn_link_close(lnk);
@@ -194,15 +194,15 @@ void messaging_adapter::on_session_remote_close(event &e) {
         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))) {
-            messaging_event mevent(PN_MESSAGING_SESSION_ERROR, *pe);
+            messaging_event mevent(messaging_event::SESSION_ERROR, *pe);
             on_session_error(mevent);
         }
         else if (is_local_closed(state)) {
-            messaging_event mevent(PN_MESSAGING_SESSION_CLOSED, *pe);
+            messaging_event mevent(messaging_event::SESSION_CLOSED, *pe);
             on_session_closed(mevent);
         }
         else {
-            messaging_event mevent(PN_MESSAGING_SESSION_CLOSING, *pe);
+            messaging_event mevent(messaging_event::SESSION_CLOSING, *pe);
             on_session_closing(mevent);
         }
         pn_session_close(session);
@@ -216,15 +216,15 @@ void messaging_adapter::on_connection_remote_close(event &e) {
         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))) {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_ERROR, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_ERROR, *pe);
             on_connection_error(mevent);
         }
         else if (is_local_closed(state)) {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_CLOSED, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_CLOSED, *pe);
             on_connection_closed(mevent);
         }
         else {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_CLOSING, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_CLOSING, *pe);
             on_connection_closing(mevent);
         }
         pn_connection_close(connection);
@@ -236,7 +236,7 @@ void messaging_adapter::on_connection_local_open(event &e) {
     if (pe) {
         pn_connection_t *connection = pn_event_connection(pe->pn_event());
         if (is_remote_open(pn_connection_state(connection))) {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_OPENED, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_OPENED, *pe);
             on_connection_opened(mevent);
         }
     }
@@ -247,11 +247,11 @@ void messaging_adapter::on_connection_remote_open(event &e) {
     if (pe) {
         pn_connection_t *connection = pn_event_connection(pe->pn_event());
         if (is_local_open(pn_connection_state(connection))) {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_OPENED, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_OPENED, *pe);
             on_connection_opened(mevent);
         }
         else if (is_local_unititialised(pn_connection_state(connection))) {
-            messaging_event mevent(PN_MESSAGING_CONNECTION_OPENING, *pe);
+            messaging_event mevent(messaging_event::CONNECTION_OPENING, *pe);
             on_connection_opening(mevent);
             pn_connection_open(connection);
         }
@@ -263,7 +263,7 @@ void messaging_adapter::on_session_local_open(event &e) {
     if (pe) {
         pn_session_t *session = pn_event_session(pe->pn_event());
         if (is_remote_open(pn_session_state(session))) {
-            messaging_event mevent(PN_MESSAGING_SESSION_OPENED, *pe);
+            messaging_event mevent(messaging_event::SESSION_OPENED, *pe);
             on_session_opened(mevent);
         }
     }
@@ -274,11 +274,11 @@ void messaging_adapter::on_session_remote_open(event &e) {
     if (pe) {
         pn_session_t *session = pn_event_session(pe->pn_event());
         if (is_local_open(pn_session_state(session))) {
-            messaging_event mevent(PN_MESSAGING_SESSION_OPENED, *pe);
+            messaging_event mevent(messaging_event::SESSION_OPENED, *pe);
             on_session_opened(mevent);
         }
         else if (is_local_unititialised(pn_session_state(session))) {
-            messaging_event mevent(PN_MESSAGING_SESSION_OPENING, *pe);
+            messaging_event mevent(messaging_event::SESSION_OPENING, *pe);
             on_session_opening(mevent);
             pn_session_open(session);
         }
@@ -290,7 +290,7 @@ void messaging_adapter::on_link_local_open(event &e) {
     if (pe) {
         pn_link_t *link = pn_event_link(pe->pn_event());
         if (is_remote_open(pn_link_state(link))) {
-            messaging_event mevent(PN_MESSAGING_LINK_OPENED, *pe);
+            messaging_event mevent(messaging_event::LINK_OPENED, *pe);
             on_link_opened(mevent);
         }
     }
@@ -301,11 +301,11 @@ void messaging_adapter::on_link_remote_open(event &e) {
     if (pe) {
         pn_link_t *link = pn_event_link(pe->pn_event());
         if (is_local_open(pn_link_state(link))) {
-            messaging_event mevent(PN_MESSAGING_LINK_OPENED, *pe);
+            messaging_event mevent(messaging_event::LINK_OPENED, *pe);
             on_link_opened(mevent);
         }
         else if (is_local_unititialised(pn_link_state(link))) {
-            messaging_event mevent(PN_MESSAGING_LINK_OPENING, *pe);
+            messaging_event mevent(messaging_event::LINK_OPENING, *pe);
             on_link_opening(mevent);
             pn_link_open(link);
         }
@@ -317,7 +317,7 @@ void messaging_adapter::on_transport_tail_closed(event &e) {
     if (pe) {
         pn_connection_t *conn = pn_event_connection(pe->pn_event());
         if (conn && is_local_open(pn_connection_state(conn))) {
-            messaging_event mevent(PN_MESSAGING_DISCONNECTED, *pe);
+            messaging_event mevent(messaging_event::DISCONNECTED, *pe);
             delegate_.on_disconnected(mevent);
         }
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/messaging_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_event.cpp b/proton-c/bindings/cpp/src/messaging_event.cpp
index b5da375..d79974d 100644
--- a/proton-c/bindings/cpp/src/messaging_event.cpp
+++ b/proton-c/bindings/cpp/src/messaging_event.cpp
@@ -34,12 +34,13 @@
 namespace proton {
 
 messaging_event::messaging_event(pn_event_t *ce, pn_event_type_t t, class container &c) :
-    proton_event(ce, t, c), messaging_type_(PN_MESSAGING_PROTON), parent_event_(0), message_(0)
+    proton_event(ce, t, c), type_(messaging_event::PROTON), parent_event_(0), message_(0)
 {}
 
-messaging_event::messaging_event(messaging_event_type_t t, proton_event &p) :
-    proton_event(NULL, PN_EVENT_NONE, p.container()), messaging_type_(t), parent_event_(&p), message_(0) {
-    if (messaging_type_ == PN_MESSAGING_PROTON)
+messaging_event::messaging_event(event_type t, proton_event &p) :
+    proton_event(NULL, PN_EVENT_NONE, p.container()), type_(t), parent_event_(&p), message_(0)
+{
+    if (type_ == messaging_event::PROTON)
         throw error(MSG("invalid messaging event type"));
 }
 
@@ -47,8 +48,10 @@ messaging_event::~messaging_event() {
     delete message_;
 }
 
+messaging_event::event_type messaging_event::type() const { return type_; }
+
 connection &messaging_event::connection() {
-    if (messaging_type_ == PN_MESSAGING_PROTON)
+    if (type_ == messaging_event::PROTON)
         return proton_event::connection();
     if (parent_event_)
         return parent_event_->connection();
@@ -56,7 +59,7 @@ connection &messaging_event::connection() {
 }
 
 sender messaging_event::sender() {
-    if (messaging_type_ == PN_MESSAGING_PROTON)
+    if (type_ == messaging_event::PROTON)
         return proton_event::sender();
     if (parent_event_)
         return parent_event_->sender();
@@ -64,7 +67,7 @@ sender messaging_event::sender() {
 }
 
 receiver messaging_event::receiver() {
-    if (messaging_type_ == PN_MESSAGING_PROTON)
+    if (type_ == messaging_event::PROTON)
         return proton_event::receiver();
     if (parent_event_)
         return parent_event_->receiver();
@@ -72,7 +75,7 @@ receiver messaging_event::receiver() {
 }
 
 link messaging_event::link() {
-    if (messaging_type_ == PN_MESSAGING_PROTON)
+    if (type_ == messaging_event::PROTON)
         return proton_event::link();
     if (parent_event_)
         return parent_event_->link();
@@ -89,50 +92,50 @@ message messaging_event::message() {
 }
 
 void messaging_event::message(class message &m) {
-    if (messaging_type_ != PN_MESSAGING_MESSAGE || !parent_event_)
+    if (type_ != messaging_event::MESSAGE || !parent_event_)
         throw error(MSG("event type does not provide message"));
     event_context(parent_event_->pn_event(), m.pn_message());
 }
 
 void messaging_event::dispatch(handler &h) {
-    if (messaging_type_ == PN_MESSAGING_PROTON) {
+    if (type_ == messaging_event::PROTON) {
         proton_event::dispatch(h);
         return;
     }
 
     messaging_handler *handler = dynamic_cast<messaging_handler*>(&h);
     if (handler) {
-        switch(messaging_type_) {
-
-        case PN_MESSAGING_START:       handler->on_start(*this); break;
-        case PN_MESSAGING_SENDABLE:    handler->on_sendable(*this); break;
-        case PN_MESSAGING_MESSAGE:     handler->on_message(*this); break;
-        case PN_MESSAGING_ACCEPTED:    handler->on_accepted(*this); break;
-        case PN_MESSAGING_REJECTED:    handler->on_rejected(*this); break;
-        case PN_MESSAGING_RELEASED:    handler->on_released(*this); break;
-        case PN_MESSAGING_SETTLED:     handler->on_settled(*this); break;
-
-        case PN_MESSAGING_CONNECTION_CLOSING:     handler->on_connection_closing(*this); break;
-        case PN_MESSAGING_CONNECTION_CLOSED:      handler->on_connection_closed(*this); break;
-        case PN_MESSAGING_CONNECTION_ERROR:       handler->on_connection_error(*this); break;
-        case PN_MESSAGING_CONNECTION_OPENING:     handler->on_connection_opening(*this); break;
-        case PN_MESSAGING_CONNECTION_OPENED:      handler->on_connection_opened(*this); break;
-
-        case PN_MESSAGING_LINK_CLOSED:            handler->on_link_closed(*this); break;
-        case PN_MESSAGING_LINK_CLOSING:           handler->on_link_closing(*this); break;
-        case PN_MESSAGING_LINK_ERROR:             handler->on_link_error(*this); break;
-        case PN_MESSAGING_LINK_OPENING:           handler->on_link_opening(*this); break;
-        case PN_MESSAGING_LINK_OPENED:            handler->on_link_opened(*this); break;
-
-        case PN_MESSAGING_SESSION_CLOSED:         handler->on_session_closed(*this); break;
-        case PN_MESSAGING_SESSION_CLOSING:        handler->on_session_closing(*this); break;
-        case PN_MESSAGING_SESSION_ERROR:          handler->on_session_error(*this); break;
-        case PN_MESSAGING_SESSION_OPENING:        handler->on_session_opening(*this); break;
-        case PN_MESSAGING_SESSION_OPENED:         handler->on_session_opened(*this); break;
-
-        case PN_MESSAGING_TRANSPORT_CLOSED:       handler->on_transport_closed(*this); break;
+        switch(type_) {
+
+        case messaging_event::START:       handler->on_start(*this); break;
+        case messaging_event::SENDABLE:    handler->on_sendable(*this); break;
+        case messaging_event::MESSAGE:     handler->on_message(*this); break;
+        case messaging_event::ACCEPTED:    handler->on_accepted(*this); break;
+        case messaging_event::REJECTED:    handler->on_rejected(*this); break;
+        case messaging_event::RELEASED:    handler->on_released(*this); break;
+        case messaging_event::SETTLED:     handler->on_settled(*this); break;
+
+        case messaging_event::CONNECTION_CLOSING:     handler->on_connection_closing(*this); break;
+        case messaging_event::CONNECTION_CLOSED:      handler->on_connection_closed(*this); break;
+        case messaging_event::CONNECTION_ERROR:       handler->on_connection_error(*this); break;
+        case messaging_event::CONNECTION_OPENING:     handler->on_connection_opening(*this); break;
+        case messaging_event::CONNECTION_OPENED:      handler->on_connection_opened(*this); break;
+
+        case messaging_event::LINK_CLOSED:            handler->on_link_closed(*this); break;
+        case messaging_event::LINK_CLOSING:           handler->on_link_closing(*this); break;
+        case messaging_event::LINK_ERROR:             handler->on_link_error(*this); break;
+        case messaging_event::LINK_OPENING:           handler->on_link_opening(*this); break;
+        case messaging_event::LINK_OPENED:            handler->on_link_opened(*this); break;
+
+        case messaging_event::SESSION_CLOSED:         handler->on_session_closed(*this); break;
+        case messaging_event::SESSION_CLOSING:        handler->on_session_closing(*this); break;
+        case messaging_event::SESSION_ERROR:          handler->on_session_error(*this); break;
+        case messaging_event::SESSION_OPENING:        handler->on_session_opening(*this); break;
+        case messaging_event::SESSION_OPENED:         handler->on_session_opened(*this); break;
+
+        case messaging_event::TRANSPORT_CLOSED:       handler->on_transport_closed(*this); break;
         default:
-            throw error(MSG("Unkown messaging event type " << messaging_type_));
+            throw error(MSG("Unkown messaging event type " << type_));
             break;
         }
     } else {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/bindings/cpp/src/proton_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.cpp b/proton-c/bindings/cpp/src/proton_event.cpp
index 2d2f7d5..e3e39ab 100644
--- a/proton-c/bindings/cpp/src/proton_event.cpp
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -35,9 +35,9 @@
 namespace proton {
 
 proton_event::proton_event(pn_event_t *ce, pn_event_type_t t, class container &c) :
-        pn_event_(ce),
-        type_((int) t),
-        container_(c)
+    pn_event_(ce),
+    type_((int) t),
+    container_(c)
 {}
 
 int proton_event::type() { return type_; }
@@ -87,54 +87,54 @@ void proton_event::dispatch(handler &h) {
     if (handler) {
         switch(type_) {
 
-        case PN_REACTOR_INIT: handler->on_reactor_init(*this); break;
-        case PN_REACTOR_QUIESCED: handler->on_reactor_quiesced(*this); break;
-        case PN_REACTOR_FINAL: handler->on_reactor_final(*this); break;
-
-        case PN_TIMER_TASK: handler->on_timer_task(*this); break;
-
-        case PN_CONNECTION_INIT: handler->on_connection_init(*this); break;
-        case PN_CONNECTION_BOUND: handler->on_connection_bound(*this); break;
-        case PN_CONNECTION_UNBOUND: handler->on_connection_unbound(*this); break;
-        case PN_CONNECTION_LOCAL_OPEN: handler->on_connection_local_open(*this); break;
-        case PN_CONNECTION_LOCAL_CLOSE: handler->on_connection_local_close(*this); break;
-        case PN_CONNECTION_REMOTE_OPEN: handler->on_connection_remote_open(*this); break;
-        case PN_CONNECTION_REMOTE_CLOSE: handler->on_connection_remote_close(*this); break;
-        case PN_CONNECTION_FINAL: handler->on_connection_final(*this); break;
-
-        case PN_SESSION_INIT: handler->on_session_init(*this); break;
-        case PN_SESSION_LOCAL_OPEN: handler->on_session_local_open(*this); break;
-        case PN_SESSION_LOCAL_CLOSE: handler->on_session_local_close(*this); break;
-        case PN_SESSION_REMOTE_OPEN: handler->on_session_remote_open(*this); break;
-        case PN_SESSION_REMOTE_CLOSE: handler->on_session_remote_close(*this); break;
-        case PN_SESSION_FINAL: handler->on_session_final(*this); break;
-
-        case PN_LINK_INIT: handler->on_link_init(*this); break;
-        case PN_LINK_LOCAL_OPEN: handler->on_link_local_open(*this); break;
-        case PN_LINK_LOCAL_CLOSE: handler->on_link_local_close(*this); break;
-        case PN_LINK_LOCAL_DETACH: handler->on_link_local_detach(*this); break;
-        case PN_LINK_REMOTE_OPEN: handler->on_link_remote_open(*this); break;
-        case PN_LINK_REMOTE_CLOSE: handler->on_link_remote_close(*this); break;
-        case PN_LINK_REMOTE_DETACH: handler->on_link_remote_detach(*this); break;
-        case PN_LINK_FLOW: handler->on_link_flow(*this); break;
-        case PN_LINK_FINAL: handler->on_link_final(*this); break;
-
-        case PN_DELIVERY: handler->on_delivery(*this); break;
-
-        case PN_TRANSPORT: handler->on_transport(*this); break;
-        case PN_TRANSPORT_ERROR: handler->on_transport_error(*this); break;
-        case PN_TRANSPORT_HEAD_CLOSED: handler->on_transport_head_closed(*this); break;
-        case PN_TRANSPORT_TAIL_CLOSED: handler->on_transport_tail_closed(*this); break;
-        case PN_TRANSPORT_CLOSED: handler->on_transport_closed(*this); break;
-
-        case PN_SELECTABLE_INIT: handler->on_selectable_init(*this); break;
-        case PN_SELECTABLE_UPDATED: handler->on_selectable_updated(*this); break;
-        case PN_SELECTABLE_READABLE: handler->on_selectable_readable(*this); break;
-        case PN_SELECTABLE_WRITABLE: handler->on_selectable_writable(*this); break;
-        case PN_SELECTABLE_EXPIRED: handler->on_selectable_expired(*this); break;
-        case PN_SELECTABLE_ERROR: handler->on_selectable_error(*this); break;
-        case PN_SELECTABLE_FINAL: handler->on_selectable_final(*this); break;
-        default:
+          case PN_REACTOR_INIT: handler->on_reactor_init(*this); break;
+          case PN_REACTOR_QUIESCED: handler->on_reactor_quiesced(*this); break;
+          case PN_REACTOR_FINAL: handler->on_reactor_final(*this); break;
+
+          case PN_TIMER_TASK: handler->on_timer_task(*this); break;
+
+          case PN_CONNECTION_INIT: handler->on_connection_init(*this); break;
+          case PN_CONNECTION_BOUND: handler->on_connection_bound(*this); break;
+          case PN_CONNECTION_UNBOUND: handler->on_connection_unbound(*this); break;
+          case PN_CONNECTION_LOCAL_OPEN: handler->on_connection_local_open(*this); break;
+          case PN_CONNECTION_LOCAL_CLOSE: handler->on_connection_local_close(*this); break;
+          case PN_CONNECTION_REMOTE_OPEN: handler->on_connection_remote_open(*this); break;
+          case PN_CONNECTION_REMOTE_CLOSE: handler->on_connection_remote_close(*this); break;
+          case PN_CONNECTION_FINAL: handler->on_connection_final(*this); break;
+
+          case PN_SESSION_INIT: handler->on_session_init(*this); break;
+          case PN_SESSION_LOCAL_OPEN: handler->on_session_local_open(*this); break;
+          case PN_SESSION_LOCAL_CLOSE: handler->on_session_local_close(*this); break;
+          case PN_SESSION_REMOTE_OPEN: handler->on_session_remote_open(*this); break;
+          case PN_SESSION_REMOTE_CLOSE: handler->on_session_remote_close(*this); break;
+          case PN_SESSION_FINAL: handler->on_session_final(*this); break;
+
+          case PN_LINK_INIT: handler->on_link_init(*this); break;
+          case PN_LINK_LOCAL_OPEN: handler->on_link_local_open(*this); break;
+          case PN_LINK_LOCAL_CLOSE: handler->on_link_local_close(*this); break;
+          case PN_LINK_LOCAL_DETACH: handler->on_link_local_detach(*this); break;
+          case PN_LINK_REMOTE_OPEN: handler->on_link_remote_open(*this); break;
+          case PN_LINK_REMOTE_CLOSE: handler->on_link_remote_close(*this); break;
+          case PN_LINK_REMOTE_DETACH: handler->on_link_remote_detach(*this); break;
+          case PN_LINK_FLOW: handler->on_link_flow(*this); break;
+          case PN_LINK_FINAL: handler->on_link_final(*this); break;
+
+          case PN_DELIVERY: handler->on_delivery(*this); break;
+
+          case PN_TRANSPORT: handler->on_transport(*this); break;
+          case PN_TRANSPORT_ERROR: handler->on_transport_error(*this); break;
+          case PN_TRANSPORT_HEAD_CLOSED: handler->on_transport_head_closed(*this); break;
+          case PN_TRANSPORT_TAIL_CLOSED: handler->on_transport_tail_closed(*this); break;
+          case PN_TRANSPORT_CLOSED: handler->on_transport_closed(*this); break;
+
+          case PN_SELECTABLE_INIT: handler->on_selectable_init(*this); break;
+          case PN_SELECTABLE_UPDATED: handler->on_selectable_updated(*this); break;
+          case PN_SELECTABLE_READABLE: handler->on_selectable_readable(*this); break;
+          case PN_SELECTABLE_WRITABLE: handler->on_selectable_writable(*this); break;
+          case PN_SELECTABLE_EXPIRED: handler->on_selectable_expired(*this); break;
+          case PN_SELECTABLE_ERROR: handler->on_selectable_error(*this); break;
+          case PN_SELECTABLE_FINAL: handler->on_selectable_final(*this); break;
+          default:
             throw error(MSG("Invalid Proton event type " << type_));
             break;
         }
@@ -148,4 +148,46 @@ void proton_event::dispatch(handler &h) {
     }
 }
 
+const proton_event::event_type EVENT_NONE=PN_EVENT_NONE;
+const proton_event::event_type REACTOR_INIT=PN_REACTOR_INIT;
+const proton_event::event_type REACTOR_QUIESCED=PN_REACTOR_QUIESCED;
+const proton_event::event_type REACTOR_FINAL=PN_REACTOR_FINAL;
+const proton_event::event_type TIMER_TASK=PN_TIMER_TASK;
+const proton_event::event_type CONNECTION_INIT=PN_CONNECTION_INIT;
+const proton_event::event_type CONNECTION_BOUND=PN_CONNECTION_BOUND;
+const proton_event::event_type CONNECTION_UNBOUND=PN_CONNECTION_UNBOUND;
+const proton_event::event_type CONNECTION_LOCAL_OPEN=PN_CONNECTION_LOCAL_OPEN;
+const proton_event::event_type CONNECTION_REMOTE_OPEN=PN_CONNECTION_REMOTE_OPEN;
+const proton_event::event_type CONNECTION_LOCAL_CLOSE=PN_CONNECTION_LOCAL_CLOSE;
+const proton_event::event_type CONNECTION_REMOTE_CLOSE=PN_CONNECTION_REMOTE_CLOSE;
+const proton_event::event_type CONNECTION_FINAL=PN_CONNECTION_FINAL;
+const proton_event::event_type SESSION_INIT=PN_SESSION_INIT;
+const proton_event::event_type SESSION_LOCAL_OPEN=PN_SESSION_LOCAL_OPEN;
+const proton_event::event_type SESSION_REMOTE_OPEN=PN_SESSION_REMOTE_OPEN;
+const proton_event::event_type SESSION_LOCAL_CLOSE=PN_SESSION_LOCAL_CLOSE;
+const proton_event::event_type SESSION_REMOTE_CLOSE=PN_SESSION_REMOTE_CLOSE;
+const proton_event::event_type SESSION_FINAL=PN_SESSION_FINAL;
+const proton_event::event_type LINK_INIT=PN_LINK_INIT;
+const proton_event::event_type LINK_LOCAL_OPEN=PN_LINK_LOCAL_OPEN;
+const proton_event::event_type LINK_REMOTE_OPEN=PN_LINK_REMOTE_OPEN;
+const proton_event::event_type LINK_LOCAL_CLOSE=PN_LINK_LOCAL_CLOSE;
+const proton_event::event_type LINK_REMOTE_CLOSE=PN_LINK_REMOTE_CLOSE;
+const proton_event::event_type LINK_LOCAL_DETACH=PN_LINK_LOCAL_DETACH;
+const proton_event::event_type LINK_REMOTE_DETACH=PN_LINK_REMOTE_DETACH;
+const proton_event::event_type LINK_FLOW=PN_LINK_FLOW;
+const proton_event::event_type LINK_FINAL=PN_LINK_FINAL;
+const proton_event::event_type DELIVERY=PN_DELIVERY;
+const proton_event::event_type TRANSPORT=PN_TRANSPORT;
+const proton_event::event_type TRANSPORT_AUTHENTICATED=PN_TRANSPORT_AUTHENTICATED;
+const proton_event::event_type TRANSPORT_ERROR=PN_TRANSPORT_ERROR;
+const proton_event::event_type TRANSPORT_HEAD_CLOSED=PN_TRANSPORT_HEAD_CLOSED;
+const proton_event::event_type TRANSPORT_TAIL_CLOSED=PN_TRANSPORT_TAIL_CLOSED;
+const proton_event::event_type TRANSPORT_CLOSED=PN_TRANSPORT_CLOSED;
+const proton_event::event_type SELECTABLE_INIT=PN_SELECTABLE_INIT;
+const proton_event::event_type SELECTABLE_UPDATED=PN_SELECTABLE_UPDATED;
+const proton_event::event_type SELECTABLE_READABLE=PN_SELECTABLE_READABLE;
+const proton_event::event_type SELECTABLE_WRITABLE=PN_SELECTABLE_WRITABLE;
+const proton_event::event_type SELECTABLE_ERROR=PN_SELECTABLE_ERROR;
+const proton_event::event_type SELECTABLE_EXPIRED=PN_SELECTABLE_EXPIRED;
+const proton_event::event_type SELECTABLE_FINAL=PN_SELECTABLE_FINAL;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 283b085..5742f13 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -60,12 +60,12 @@ connection &session::connection() {
     return connection_impl::reactor_reference(c);
 }
 
-receiver session::create_receiver(std::string name) {
+receiver session::create_receiver(const std::string& name) {
     pn_link_t *link = pn_receiver(impl_, name.c_str());
     return receiver(link);
 }
 
-sender session::create_sender(std::string name) {
+sender session::create_sender(const std::string& name) {
     pn_link_t *link = pn_sender(impl_, name.c_str());
     return sender(link);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/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 d5ab411..4b8d956 100644
--- a/proton-c/bindings/cpp/src/url.cpp
+++ b/proton-c/bindings/cpp/src/url.cpp
@@ -22,6 +22,8 @@
 #include "proton/error.hpp"
 #include "proton/url.hpp"
 #include "proton/url.h"
+#include <ostream>
+#include <istream>
 
 namespace proton {
 
@@ -52,6 +54,8 @@ url::url() : url_(pn_url()) {}
 
 url::url(const std::string &s, bool d) : url_(parse_throw(s)) { if (d) defaults(); }
 
+url::url(const char *s, bool d) : url_(parse_throw(s)) { if (d) defaults(); }
+
 url::url(const url& u) : url_(parse_allow_empty(u.str())) {}
 
 url::~url() { pn_url_free(url_); }
@@ -60,6 +64,8 @@ url& url::operator=(const url& u) { replace(url_, parse_allow_empty(u.str())); r
 
 void url::parse(const std::string& s) { replace(url_, parse_throw(s)); }
 
+void url::parse(const char *s) { replace(url_, parse_throw(s)); }
+
 std::string url::str() const { return char_str(pn_url_str(url_)); }
 
 std::string url::scheme() const { return char_str(pn_url_get_scheme(url_)); }
@@ -90,4 +96,19 @@ const std::string url::AMQPS("amqps");
 
 std::ostream& operator<<(std::ostream& o, const url& u) { return o << u.str(); }
 
+std::istream& operator>>(std::istream& i, url& u) {
+    std::string s;
+    i >> s;
+    if (!i.fail() && !i.bad()) {
+        pn_url_t* p = pn_url_parse(s.c_str());
+        if (p) {
+            replace(u.url_, p);
+            u.defaults();
+        } else {
+            i.clear(std::ios::failbit);
+        }
+    }
+    return i;
+}
+
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/035b6957/proton-c/include/proton/message.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/message.h b/proton-c/include/proton/message.h
index 837b95e..42e45f5 100644
--- a/proton-c/include/proton/message.h
+++ b/proton-c/include/proton/message.h
@@ -389,7 +389,7 @@ PN_EXTERN const char *   pn_message_get_subject           (pn_message_t *msg);
 PN_EXTERN int            pn_message_set_subject           (pn_message_t *msg, const char *subject);
 
 /**
- * Get the reply_to for a message.
+o * Get the reply_to for a message.
  *
  * This operation will return NULL if no reply_to has been set or if
  * the reply_to has been set to NULL. The pointer returned by this


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