http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..15b28fa
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -0,0 +1,67 @@
+#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/export.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 {
+
+class handler;
+class transport;
+class connection_impl;
+
+class connection : public endpoint, public handle<connection_impl>
+{
+  public:
+    PN_CPP_EXTERN connection();
+    PN_CPP_EXTERN connection(connection_impl *);
+    PN_CPP_EXTERN connection(const connection& c);
+    PN_CPP_EXTERN connection(class container &c, handler *h = 0);
+    PN_CPP_EXTERN ~connection();
+
+    PN_CPP_EXTERN connection& operator=(const connection& c);
+
+    PN_CPP_EXTERN class transport& transport();
+    PN_CPP_EXTERN handler *override();
+    PN_CPP_EXTERN void override(handler *h);
+    PN_CPP_EXTERN void open();
+    PN_CPP_EXTERN void close();
+    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);
+  private:
+   friend class private_impl_ref<connection>;
+   friend class Connector;
+   friend class connection_impl;
+};
+
+}
+
+#endif  /*!PROTON_CPP_CONNECTION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..0a1eb7a
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/container.hpp
@@ -0,0 +1,76 @@
+#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/export.hpp"
+#include "proton/handle.hpp"
+#include "proton/acceptor.hpp"
+#include "proton/duration.hpp"
+#include <proton/reactor.h>
+#include <string>
+
+namespace proton {
+
+class dispatch_helper;
+class connection;
+class Connector;
+class acceptor;
+class container_impl;
+class messaging_handler;
+class sender;
+class receiver;
+class link;
+ class handler;
+
+class container : public handle<container_impl>
+{
+  public:
+    PN_CPP_EXTERN container(container_impl *);
+    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(messaging_handler &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 is_quiesced();
+    PN_CPP_EXTERN pn_reactor_t *reactor();
+    PN_CPP_EXTERN sender create_sender(connection &connection, std::string 
&addr, handler *h=0);
+    PN_CPP_EXTERN sender create_sender(std::string &url);
+    PN_CPP_EXTERN receiver create_receiver(connection &connection, std::string 
&addr);
+    PN_CPP_EXTERN receiver create_receiver(const std::string &url);
+    PN_CPP_EXTERN acceptor listen(const std::string &url);
+    PN_CPP_EXTERN std::string container_id();
+    PN_CPP_EXTERN duration timeout();
+    PN_CPP_EXTERN void timeout(duration timeout);
+  private:
+   friend class private_impl_ref<container>;
+};
+
+}
+
+#endif  /*!PROTON_CPP_CONTAINER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..c0d3e8c
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/data.hpp
@@ -0,0 +1,70 @@
+#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/export.hpp"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+
+/** Base for classes that hold AMQP data. */
+class data {
+  public:
+    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. */
+    PN_CPP_EXTERN void clear();
+
+    /** Rewind to the start of the data. */
+    PN_CPP_EXTERN void rewind();
+
+    /** True if there are no values. */
+    PN_CPP_EXTERN bool empty() const;
+
+    /** The underlying pn_data_t */
+    PN_CPP_EXTERN pn_data_t* pn_data() { return data_; }
+
+    /** True if this data object owns it's own pn_data_t, false if it is 
acting as a "view" */
+    PN_CPP_EXTERN bool own() const { return own_; }
+
+    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 */
+    PN_CPP_EXTERN explicit data(pn_data_t*);
+
+    /** Does not take ownership, just a view on the data */
+    PN_CPP_EXTERN  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/69783099/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..22effe3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/decoder.hpp
@@ -0,0 +1,230 @@
+#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/error.hpp"
+#include "proton/type_traits.hpp"
+#include "proton/types.hpp"
+#include <iosfwd>
+
+namespace proton {
+
+class value;
+
+/** Raised by decoder operations on error. @ingroup cpp*/
+struct decode_error : public error { PN_CPP_EXTERN explicit decode_error(const 
std::string&) throw(); };
+
+/** Skips a value with `decoder >> skip()`. @ingroup cpp */
+struct skip{};
+
+/** Rewind the decoder with `decoder >> rewind()`. @ingroup cpp */
+struct rewind{};
+
+/**
+ * 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.
+ *
+ *     amqp_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<amqp_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 
decoder::operator>>(decoder&, start&)
+ * @ingroup cpp
+*/
+class decoder : public virtual data {
+  public:
+
+    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 type_id 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&, amqp_null);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_bool&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_ubyte&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_byte&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_ushort&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_short&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_uint&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_int&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_char&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_ulong&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_long&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_timestamp&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_float&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_double&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_decimal32&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_decimal64&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_decimal128&);
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, amqp_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, type_id A> T get_as() { T value; *this >> as<A>(value); 
return value; }
+
+    /** Call decoder::start() in constructor, decoder::finish in destructor().
+     * @ingroup cpp
+     */
+    struct scope : public start {
+        decoder& decoder_;
+        scope(decoder& d) : decoder_(d) { d >> *this; }
+        ~scope() { decoder_ >> finish(); }
+    };
+
+    template <type_id A, class T> friend decoder& operator>>(decoder& d, 
ref<T, A> ref) {
+        d.check_type(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.
+     *
+     * You must always end a complex type by extracting to an instance of 
`finish`,
+     * the decoder::scope automates this.
+     *
+     *@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);
+
+    /** Rewind to the beginning */
+    PN_CPP_EXTERN friend decoder& operator>>(decoder&, struct rewind);
+
+  private:
+    template <class T> decoder& extract(T& value);
+    PN_CPP_EXTERN void check_type(type_id);
+
+  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<is_unknown_integer<T>::value, decoder&>::type 
operator>>(decoder& d, T& i)  {
+    typename integer_type<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.is_described) 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;
+}
+
+}
+#endif // DECODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..0dc80da
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/delivery.hpp
@@ -0,0 +1,59 @@
+#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/export.hpp"
+#include "proton/proton_handle.hpp"
+
+#include "proton/delivery.h"
+#include "proton/disposition.h"
+
+namespace proton {
+
+class delivery : public proton_handle<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 *pn_delivery();
+  private:
+    friend class proton_impl_ref<delivery>;
+};
+
+}
+
+#endif  /*!PROTON_CPP_DELIVERY_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..b5bd59b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/duration.hpp
@@ -0,0 +1,55 @@
+#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/export.hpp"
+#include "proton/types.hpp"
+
+namespace proton {
+
+/** @ingroup cpp
+ * A duration is a time in milliseconds.
+ */
+class duration : public comparable<duration>
+{
+  public:
+    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; }
+
+    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, std::uint64_t n) { return 
duration(d.milliseconds*n); }
+inline duration operator*(std::uint64_t n, duration d) { return d * n; }
+
+inline amqp_timestamp operator+(amqp_timestamp ts, duration d) { return 
amqp_timestamp(ts.milliseconds+d.milliseconds); }
+inline amqp_timestamp operator+(duration d, amqp_timestamp ts) { return ts + 
d; }
+}
+
+#endif  /*!PROTON_CPP_DURATION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..3f4ee0d
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/encoder.hpp
@@ -0,0 +1,198 @@
+#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/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;
+class values;
+
+/** Raised by encoder operations on error */
+struct encode_error : public error { PN_CPP_EXTERN explicit encode_error(const 
std::string&) throw(); };
+
+/**
+ * Stream C++ data values into an AMQP encoder using operator<<.
+ *
+ * types.h defines C++ typedefs and types for AMQP each type. These types 
insert
+ * as the corresponding AMQP type. Conversion rules apply to other types:
+ *
+ * - Integer types insert as the AMQP integer of matching size and signedness.
+ * - std::string or char* insert as AMQP strings.
+ *
+ * C++ containers can be inserted as AMQP containers with the as() helper
+ * functions. For example:
+ *
+ *     std::vector<amqp_symbol> v;
+ *     encoder << as<amqp_list>(v);
+ *
+ * AMQP maps can be inserted from any container with std::pair<X,Y> as the
+ * value_type. That includes std::map and std::unordered_map but also for
+ * example std::vector<std::pair<X,Y> >. This allows you to control the order
+ * of elements when inserting AMQP maps.
+ *
+ * You can also insert containers element-by-element, see operator<<(encoder&, 
const start&)
+ *
+ *@throw decoder::error if the curent value is not a container type.
+ *@ingroup cpp
+ */
+class encoder : public virtual data {
+  public:
+    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.
+     *@{
+     */
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_null);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_bool);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_ubyte);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_byte);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_ushort);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_short);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_uint);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_int);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_char);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_ulong);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_long);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_timestamp);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_float);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_double);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_decimal32);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_decimal64);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_decimal128);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_uuid);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_string);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_symbol);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, amqp_binary);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, const value&);
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, const values&);
+    ///@}
+
+    /**
+     * Start a container type.
+     *
+     * Use one of the static functions start::array(), start::list(),
+     * start::map() or start::described() to create an appropriate start value
+     * and inser it into the encoder, followed by the contained elements.  For
+     * example:
+     *
+     *      encoder << start::list() << amqp_int(1) << amqp_symbol("two") << 
3.0 << finish();
+     */
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, const start&);
+
+    /** Finish a container type. See operator<<(encoder&, const start&) */
+  friend PN_CPP_EXTERN encoder& operator<<(encoder& e, finish);
+
+
+    /**@name Insert values returned by the as<type_id> helper.
+     *@{
+     */
+  template <class T, type_id 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>);
+    // TODO aconway 2015-06-16: DESCRIBED.
+    ///@}
+
+    /** Copy data from a raw pn_data_t */
+  friend PN_CPP_EXTERN encoder& operator<<(encoder&, pn_data_t*);
+
+  private:
+    PN_CPP_EXTERN encoder(pn_data_t* pd);
+
+  friend class value;
+};
+
+// Need to disambiguate char* conversion to bool and std::string as 
amqp_string.
+inline encoder& operator<<(encoder& e, char* s) { return e << amqp_string(s); }
+inline encoder& operator<<(encoder& e, const char* s) { return e << 
amqp_string(s); }
+inline encoder& operator<<(encoder& e, const std::string& s) { return e << 
amqp_string(s); }
+
+// operator << for integer types that are not covered by the standard 
overrides.
+template <class T>
+typename std::enable_if<is_unknown_integer<T>::value, encoder&>::type 
operator<<(encoder& e, T i)  {
+    typename integer_type<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.
+
+template <class T> encoder& operator<<(encoder& e, cref<T, ARRAY> a) {
+    e << start::array(type_idOf<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;
+}
+//@internal Convert a ref to a cref.
+template <class T, type_id A> encoder& operator<<(encoder& e, ref<T, A> ref) {
+    return e << cref<T,A>(ref);
+}
+
+
+}
+#endif // ENCODER_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..195a010
--- /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/export.hpp"
+#include "proton/connection.h"
+
+namespace proton {
+
+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;
+
+     PN_CPP_EXTERN virtual class connection &connection();
+     PN_CPP_EXTERN virtual class transport &transport();
+
+    // TODO: condition, remote_condition, update_condition, get/handler
+protected:
+    PN_CPP_EXTERN endpoint();
+    PN_CPP_EXTERN ~endpoint();
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_ENDPOINT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..2e2ac17
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/error.hpp
@@ -0,0 +1,44 @@
+#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>
+#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 { PN_CPP_EXTERN explicit error(const 
std::string&) throw(); };
+
+/** Raised if a message is rejected */
+struct message_reject : public error { PN_CPP_EXTERN explicit 
message_reject(const std::string&) throw(); };
+
+/** Raised if a message is released */
+struct message_release : public error { PN_CPP_EXTERN explicit 
message_release(const std::string&) throw(); };
+
+
+}
+
+#endif  /*!PROTON_CPP_EXCEPTIONS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..2feff2b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/event.hpp
@@ -0,0 +1,58 @@
+#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/export.hpp"
+#include "proton/link.hpp"
+#include "proton/connection.hpp"
+#include "proton/message.hpp"
+#include <vector>
+
+
+namespace proton {
+
+class handler;
+class container;
+class connection;
+
+class event
+{
+  public:
+    virtual PN_CPP_EXTERN void dispatch(handler &h) = 0;
+    virtual PN_CPP_EXTERN class container &container();
+    virtual PN_CPP_EXTERN class connection &connection();
+    virtual PN_CPP_EXTERN class sender sender();
+    virtual PN_CPP_EXTERN class receiver receiver();
+    virtual PN_CPP_EXTERN class link link();
+    virtual PN_CPP_EXTERN class message message();
+    virtual PN_CPP_EXTERN void message(class message &);
+    virtual PN_CPP_EXTERN ~event();
+  protected:
+    PN_CPP_EXTERN event();
+  private:
+    event(const event&);
+    event& operator=(const event&);
+};
+
+}
+
+#endif  /*!PROTON_CPP_EVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..0a23b01
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/handle.hpp
@@ -0,0 +1,78 @@
+#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/export.hpp"
+
+namespace proton {
+
+template <class> class private_impl_ref;
+template <class> class proton_impl_ref;
+
+// 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 is_valid(), is_null() 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. */
+    bool is_valid() const { return impl_; }
+
+    /**@return true if handle is null. It is an error to call any function on 
a null handle. */
+    bool is_null() const { return !impl_; }
+
+    /** Conversion to bool supports idiom if (handle) { handle->... } */
+    operator bool() const { return impl_; }
+
+    /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+    bool operator !() const { return !impl_; }
+
+    /** Operator ==  equal if they point to same non-null object*/
+    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; }
+
+  private:
+    // Not implemented, subclasses must implement.
+    handle(const handle&);
+    handle& operator=(const handle&);
+
+  protected:
+    typedef T Impl;
+    handle() : impl_() {}
+
+    mutable Impl* impl_;
+
+  friend class private_impl_ref<T>;
+};
+
+}
+
+#endif  /*!PROTON_CPP_HANDLE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..eb019e3
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/handler.hpp
@@ -0,0 +1,43 @@
+#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/export.hpp"
+#include "proton/event.hpp"
+#include "proton/event.h"
+#include <vector>
+
+namespace proton {
+
+class handler : public std::vector<handler*> {
+  public:
+    PN_CPP_EXTERN handler();
+    PN_CPP_EXTERN virtual ~handler();
+
+    PN_CPP_EXTERN virtual void on_unhandled(event &e);
+
+    PN_CPP_EXTERN virtual void add_child_handler(handler &e);
+};
+
+}
+
+#endif  /*!PROTON_CPP_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/index.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/index.md 
b/proton-c/bindings/cpp/include/proton/index.md
new file mode 100644
index 0000000..d82ab8a
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/index.md
@@ -0,0 +1,7 @@
+@defgroup cpp C++ API
+
+Proton C++ API
+==============
+
+Provides a C++ object-oriented wrappers for the C proton API and stream-based
+operators to convert between C++ and AMQP data types.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..6af20a9
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -0,0 +1,69 @@
+#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/export.hpp"
+#include "proton/proton_handle.hpp"
+#include "proton/endpoint.hpp"
+#include "proton/terminus.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+
+class link : public endpoint, public proton_handle<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 is_sender();
+    PN_CPP_EXTERN bool is_receiver();
+    PN_CPP_EXTERN int credit();
+    PN_CPP_EXTERN terminus source();
+    PN_CPP_EXTERN terminus target();
+    PN_CPP_EXTERN terminus remote_source();
+    PN_CPP_EXTERN terminus remote_target();
+    PN_CPP_EXTERN std::string name();
+    PN_CPP_EXTERN pn_link_t *pn_link() const;
+    PN_CPP_EXTERN link next(endpoint::State mask);
+    class connection &connection();
+
+  protected:
+    PN_CPP_EXTERN virtual void verify_type(pn_link_t *l);
+  private:
+    friend class proton_impl_ref<link>;
+    bool sender_link;
+};
+
+}
+
+#include "proton/sender.hpp"
+#include "proton/receiver.hpp"
+
+#endif  /*!PROTON_CPP_LINK_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..0667337
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/message.hpp
@@ -0,0 +1,112 @@
+#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/export.hpp"
+#include "proton/proton_handle.hpp"
+#include "proton/value.hpp"
+#include "proton/message.hpp"
+#include <string>
+
+struct pn_message_t;
+struct pn_data_t;
+
+namespace proton {
+
+// FIXME aconway 2015-06-17: documentation of properties.
+class message : public proton_handle<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 *pn_message() const;
+
+    PN_CPP_EXTERN void id(const value& id);
+    PN_CPP_EXTERN value id() const;
+
+    PN_CPP_EXTERN void user(const std::string &user);
+    PN_CPP_EXTERN std::string user() const;
+
+    PN_CPP_EXTERN void address(const std::string &addr);
+    PN_CPP_EXTERN std::string address() const;
+
+    PN_CPP_EXTERN void subject(const std::string &s);
+    PN_CPP_EXTERN std::string subject() const;
+
+    PN_CPP_EXTERN void reply_to(const std::string &s);
+    PN_CPP_EXTERN std::string reply_to() const;
+
+    PN_CPP_EXTERN void correlation_id(const value&);
+    PN_CPP_EXTERN value correlation_id() const;
+
+    PN_CPP_EXTERN void content_type(const std::string &s);
+    PN_CPP_EXTERN std::string content_type() const;
+
+    PN_CPP_EXTERN void content_encoding(const std::string &s);
+    PN_CPP_EXTERN std::string content_encoding() const;
+
+    PN_CPP_EXTERN void expiry(amqp_timestamp t);
+    PN_CPP_EXTERN amqp_timestamp expiry() const;
+
+    PN_CPP_EXTERN void creation_time(amqp_timestamp t);
+    PN_CPP_EXTERN amqp_timestamp creation_time() const;
+
+    PN_CPP_EXTERN void group_id(const std::string &s);
+    PN_CPP_EXTERN std::string group_id() const;
+
+    PN_CPP_EXTERN void reply_togroup_id(const std::string &s);
+    PN_CPP_EXTERN std::string reply_togroup_id() const;
+
+    /** Set the body to an AMQP 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. */
+    PN_CPP_EXTERN void body(const values&);
+
+    PN_CPP_EXTERN const values& body() const;
+
+    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?
+
+    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_;
+  friend class proton_impl_ref<message>;
+};
+
+}
+
+#endif  /*!PROTON_CPP_MESSAGE_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp 
b/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
new file mode 100644
index 0000000..3486b97
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
@@ -0,0 +1,76 @@
+#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/proton_handler.hpp"
+#include "proton/messaging_handler.hpp"
+
+#include "proton/messaging_event.hpp"
+#include "proton/event.h"
+#include "proton/reactor.h"
+
+namespace proton {
+
+// Combine's Python's: endpoint_state_handler, incoming_message_handler, 
outgoing_message_handler
+
+class messaging_adapter : public messaging_handler
+{
+  public:
+    PN_CPP_EXTERN messaging_adapter(messaging_handler &delegate);
+    PN_CPP_EXTERN virtual ~messaging_adapter();
+    PN_CPP_EXTERN virtual void on_reactor_init(event &e);
+    PN_CPP_EXTERN virtual void on_link_flow(event &e);
+    PN_CPP_EXTERN virtual void on_delivery(event &e);
+    PN_CPP_EXTERN virtual void on_unhandled(event &e);
+    PN_CPP_EXTERN virtual void on_connection_closed(event &e);
+    PN_CPP_EXTERN virtual void on_connection_closing(event &e);
+    PN_CPP_EXTERN virtual void on_connection_error(event &e);
+    PN_CPP_EXTERN virtual void on_connection_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_connection_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_connection_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_connection_opened(event &e);
+    PN_CPP_EXTERN virtual void on_connection_opening(event &e);
+    PN_CPP_EXTERN virtual void on_session_closed(event &e);
+    PN_CPP_EXTERN virtual void on_session_closing(event &e);
+    PN_CPP_EXTERN virtual void on_session_error(event &e);
+    PN_CPP_EXTERN virtual void on_session_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_session_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_session_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_session_opened(event &e);
+    PN_CPP_EXTERN virtual void on_session_opening(event &e);
+    PN_CPP_EXTERN virtual void on_link_closed(event &e);
+    PN_CPP_EXTERN virtual void on_link_closing(event &e);
+    PN_CPP_EXTERN virtual void on_link_error(event &e);
+    PN_CPP_EXTERN virtual void on_link_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_link_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_link_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_link_opened(event &e);
+    PN_CPP_EXTERN virtual void on_link_opening(event &e);
+    PN_CPP_EXTERN virtual void on_transport_tail_closed(event &e);
+  private:
+    messaging_handler &delegate_;  // The handler for generated 
messaging_event's
+};
+
+}
+
+#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/messaging_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_event.hpp 
b/proton-c/bindings/cpp/include/proton/messaging_event.hpp
new file mode 100644
index 0000000..62f0160
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/messaging_event.hpp
@@ -0,0 +1,98 @@
+#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/proton_event.hpp"
+#include "proton/link.hpp"
+
+namespace proton {
+
+class handler;
+class container;
+class connection;
+
+typedef enum {
+    PN_MESSAGING_PROTON = 0,  // Wrapped pn_event_t
+    // Covenience events for C++ messaging_handlers
+    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
+} messaging_event_type_t;
+
+class messaging_event : public proton_event
+{
+  public:
+    messaging_event(pn_event_t *ce, pn_event_type_t t, class container &c);
+    messaging_event(messaging_event_type_t t, proton_event &parent);
+    ~messaging_event();
+    virtual PN_CPP_EXTERN void dispatch(handler &h);
+    virtual PN_CPP_EXTERN class connection &connection();
+    virtual PN_CPP_EXTERN class sender sender();
+    virtual PN_CPP_EXTERN class receiver receiver();
+    virtual PN_CPP_EXTERN class link link();
+    virtual PN_CPP_EXTERN class message message();
+    virtual PN_CPP_EXTERN void message(class message &);
+  private:
+    messaging_event_type_t messaging_type_;
+    proton_event *parent_event_;
+    class message *message_;
+    messaging_event operator=(const messaging_event&);
+    messaging_event(const messaging_event&);
+};
+
+}
+
+#endif  /*!PROTON_CPP_MESSAGINGEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp 
b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
new file mode 100644
index 0000000..9380755
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
@@ -0,0 +1,96 @@
+#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/proton_handler.hpp"
+#include "proton/acking.hpp"
+#include "proton/event.h"
+
+namespace proton {
+
+class event;
+class messaging_adapter;
+
+class messaging_handler : public proton_handler , public acking
+{
+  public:
+    PN_CPP_EXTERN messaging_handler(int prefetch=10, bool auto_accept=true, 
bool auto_settle=true,
+                                       bool peer_close_isError=false);
+    PN_CPP_EXTERN virtual ~messaging_handler();
+
+    PN_CPP_EXTERN virtual void on_abort(event &e);
+    PN_CPP_EXTERN virtual void on_accepted(event &e);
+    PN_CPP_EXTERN virtual void on_commit(event &e);
+    PN_CPP_EXTERN virtual void on_connection_closed(event &e);
+    PN_CPP_EXTERN virtual void on_connection_closing(event &e);
+    PN_CPP_EXTERN virtual void on_connection_error(event &e);
+    PN_CPP_EXTERN virtual void on_connection_opening(event &e);
+    PN_CPP_EXTERN virtual void on_connection_opened(event &e);
+    PN_CPP_EXTERN virtual void on_disconnected(event &e);
+    PN_CPP_EXTERN virtual void on_fetch(event &e);
+    PN_CPP_EXTERN virtual void on_idLoaded(event &e);
+    PN_CPP_EXTERN virtual void on_link_closed(event &e);
+    PN_CPP_EXTERN virtual void on_link_closing(event &e);
+    PN_CPP_EXTERN virtual void on_link_error(event &e);
+    PN_CPP_EXTERN virtual void on_link_opened(event &e);
+    PN_CPP_EXTERN virtual void on_link_opening(event &e);
+    PN_CPP_EXTERN virtual void on_message(event &e);
+    PN_CPP_EXTERN virtual void on_quit(event &e);
+    PN_CPP_EXTERN virtual void on_record_inserted(event &e);
+    PN_CPP_EXTERN virtual void on_records_loaded(event &e);
+    PN_CPP_EXTERN virtual void on_rejected(event &e);
+    PN_CPP_EXTERN virtual void on_released(event &e);
+    PN_CPP_EXTERN virtual void on_request(event &e);
+    PN_CPP_EXTERN virtual void on_response(event &e);
+    PN_CPP_EXTERN virtual void on_sendable(event &e);
+    PN_CPP_EXTERN virtual void on_session_closed(event &e);
+    PN_CPP_EXTERN virtual void on_session_closing(event &e);
+    PN_CPP_EXTERN virtual void on_session_error(event &e);
+    PN_CPP_EXTERN virtual void on_session_opened(event &e);
+    PN_CPP_EXTERN virtual void on_session_opening(event &e);
+    PN_CPP_EXTERN virtual void on_settled(event &e);
+    PN_CPP_EXTERN virtual void on_start(event &e);
+    PN_CPP_EXTERN virtual void on_timer(event &e);
+    PN_CPP_EXTERN virtual void on_transaction_aborted(event &e);
+    PN_CPP_EXTERN virtual void on_transaction_committed(event &e);
+    PN_CPP_EXTERN virtual void on_transaction_declared(event &e);
+    PN_CPP_EXTERN virtual void on_transport_closed(event &e);
+
+ private:
+    int prefetch_;
+    bool auto_accept_;
+    bool auto_settle_;
+    bool peer_close_iserror_;
+    messaging_adapter *messaging_adapter_;
+    handler *flow_controller_;
+    PN_CPP_EXTERN messaging_handler(
+        bool raw_handler, int prefetch=10, bool auto_accept=true,
+        bool auto_settle=true, bool peer_close_isError=false);
+    friend class container_impl;
+    friend class messaging_adapter;
+    PN_CPP_EXTERN void create_helpers();
+};
+
+}
+
+#endif  /*!PROTON_CPP_MESSAGING_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/proton_event.hpp 
b/proton-c/bindings/cpp/include/proton/proton_event.hpp
new file mode 100644
index 0000000..c4bd5e8
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/proton_event.hpp
@@ -0,0 +1,55 @@
+#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 {
+
+class handler;
+class container;
+class connection;
+class container;
+
+class proton_event : public event
+{
+  public:
+    virtual PN_CPP_EXTERN void dispatch(handler &h);
+    virtual PN_CPP_EXTERN class container &container();
+    virtual PN_CPP_EXTERN class connection &connection();
+    virtual PN_CPP_EXTERN class sender sender();
+    virtual PN_CPP_EXTERN class receiver receiver();
+    virtual PN_CPP_EXTERN class link link();
+    PN_CPP_EXTERN int type();
+    PN_CPP_EXTERN pn_event_t* pn_event();
+  protected:
+    PN_CPP_EXTERN proton_event(pn_event_t *ce, pn_event_type_t t, class 
container &c);
+  private:
+    pn_event_t *pn_event_;
+    int type_;
+    class container &container_;
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONEVENT_H*/

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

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/include/proton/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/proton_handler.hpp 
b/proton-c/bindings/cpp/include/proton/proton_handler.hpp
new file mode 100644
index 0000000..24384a8
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/proton_handler.hpp
@@ -0,0 +1,81 @@
+#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 {
+
+class event;
+class proton_event;
+
+class proton_handler : public handler
+{
+  public:
+    PN_CPP_EXTERN proton_handler();
+    PN_CPP_EXTERN virtual void on_reactor_init(event &e);
+    PN_CPP_EXTERN virtual void on_reactor_quiesced(event &e);
+    PN_CPP_EXTERN virtual void on_reactor_final(event &e);
+    PN_CPP_EXTERN virtual void on_timer_task(event &e);
+    PN_CPP_EXTERN virtual void on_connection_init(event &e);
+    PN_CPP_EXTERN virtual void on_connection_bound(event &e);
+    PN_CPP_EXTERN virtual void on_connection_unbound(event &e);
+    PN_CPP_EXTERN virtual void on_connection_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_connection_local_close(event &e);
+    PN_CPP_EXTERN virtual void on_connection_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_connection_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_connection_final(event &e);
+    PN_CPP_EXTERN virtual void on_session_init(event &e);
+    PN_CPP_EXTERN virtual void on_session_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_session_local_close(event &e);
+    PN_CPP_EXTERN virtual void on_session_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_session_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_session_final(event &e);
+    PN_CPP_EXTERN virtual void on_link_init(event &e);
+    PN_CPP_EXTERN virtual void on_link_local_open(event &e);
+    PN_CPP_EXTERN virtual void on_link_local_close(event &e);
+    PN_CPP_EXTERN virtual void on_link_local_detach(event &e);
+    PN_CPP_EXTERN virtual void on_link_remote_open(event &e);
+    PN_CPP_EXTERN virtual void on_link_remote_close(event &e);
+    PN_CPP_EXTERN virtual void on_link_remote_detach(event &e);
+    PN_CPP_EXTERN virtual void on_link_flow(event &e);
+    PN_CPP_EXTERN virtual void on_link_final(event &e);
+    PN_CPP_EXTERN virtual void on_delivery(event &e);
+    PN_CPP_EXTERN virtual void on_transport(event &e);
+    PN_CPP_EXTERN virtual void on_transport_error(event &e);
+    PN_CPP_EXTERN virtual void on_transport_head_closed(event &e);
+    PN_CPP_EXTERN virtual void on_transport_tail_closed(event &e);
+    PN_CPP_EXTERN virtual void on_transport_closed(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_init(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_updated(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_readable(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_writable(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_expired(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_error(event &e);
+    PN_CPP_EXTERN virtual void on_selectable_final(event &e);
+
+    PN_CPP_EXTERN virtual void on_unhandled(event &e);
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..be19358
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/receiver.hpp
@@ -0,0 +1,46 @@
+#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/export.hpp"
+#include "proton/endpoint.hpp"
+#include "proton/link.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+
+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:
+    PN_CPP_EXTERN virtual void verify_type(pn_link_t *l);
+};
+
+}
+
+#endif  /*!PROTON_CPP_RECEIVER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..1d35c42
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/sender.hpp
@@ -0,0 +1,51 @@
+#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/export.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 {
+
+
+class sender : public link
+{
+  public:
+    PN_CPP_EXTERN sender(pn_link_t *lnk=0);
+    PN_CPP_EXTERN sender(const link& c);
+    PN_CPP_EXTERN delivery send(message &m);
+
+  protected:
+    PN_CPP_EXTERN virtual void verify_type(pn_link_t *l);
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_SENDER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..b0117c0
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/session.hpp
@@ -0,0 +1,60 @@
+#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/export.hpp"
+#include "proton/endpoint.hpp"
+#include "proton/link.hpp"
+
+#include "proton/types.h"
+#include "proton/link.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+
+class container;
+class handler;
+class transport;
+
+ class session : public endpoint, public proton_handle<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 *pn_session();
+    PN_CPP_EXTERN virtual class connection &connection();
+    PN_CPP_EXTERN receiver create_receiver(std::string name);
+    PN_CPP_EXTERN sender create_sender(std::string name);
+  private:
+    friend class proton_impl_ref<session>;
+};
+
+}
+
+#endif  /*!PROTON_CPP_SESSION_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..22c61d0
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/terminus.hpp
@@ -0,0 +1,83 @@
+#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/export.hpp"
+#include "proton/link.hpp"
+
+#include "proton/link.h"
+#include <string>
+
+namespace proton {
+
+class link;
+
+class terminus : public proton_handle<pn_terminus_t>
+{
+  public:
+    enum type_t {
+        TYPE_UNSPECIFIED = PN_UNSPECIFIED,
+        SOURCE = PN_SOURCE,
+        TARGET = PN_TARGET,
+        COORDINATOR = PN_COORDINATOR
+    };
+
+    enum expiry_policy_t {
+        NONDURABLE = PN_NONDURABLE,
+        CONFIGURATION = PN_CONFIGURATION,
+        DELIVERIES = PN_DELIVERIES
+    };
+
+    enum distribution_mode_t {
+        MODE_UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED,
+        COPY = PN_DIST_MODE_COPY,
+        MOVE = PN_DIST_MODE_MOVE
+    };
+
+
+    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 *pn_terminus();
+    PN_CPP_EXTERN type_t type();
+    PN_CPP_EXTERN void type(type_t);
+    PN_CPP_EXTERN expiry_policy_t expiry_policy();
+    PN_CPP_EXTERN void expiry_policy(expiry_policy_t);
+    PN_CPP_EXTERN distribution_mode_t distribution_mode();
+    PN_CPP_EXTERN void distribution_mode(distribution_mode_t);
+    PN_CPP_EXTERN std::string address();
+    PN_CPP_EXTERN void address(std::string &);
+    PN_CPP_EXTERN bool is_dynamic();
+    PN_CPP_EXTERN void dynamic(bool);
+
+  private:
+    link *link_;
+    PN_CPP_EXTERN terminus(pn_terminus_t *, link *);
+  friend class link;
+  friend class proton_impl_ref<terminus>;
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_TERMINUS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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..8d0774f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/transport.hpp
@@ -0,0 +1,52 @@
+#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/export.hpp"
+#include "proton/transport.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+
+class connection;
+
+class transport
+{
+  public:
+    PN_CPP_EXTERN transport();
+    PN_CPP_EXTERN ~transport();
+    PN_CPP_EXTERN void bind(connection &c);
+
+    class connection* connection() const { return connection_; }
+    pn_transport_t* pn_transport() const { return pn_transport_; }
+
+  private:
+    class connection *connection_;
+    pn_transport_t *pn_transport_;
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_TRANSPORT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/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 f635128..f30d980 100644
--- a/proton-c/bindings/cpp/include/proton/type_traits.hpp
+++ b/proton-c/bindings/cpp/include/proton/type_traits.hpp
@@ -1,5 +1,5 @@
-#ifndef ENABLE_IF_HPP
-#define ENABLE_IF_HPP
+#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
@@ -21,10 +21,6 @@
 
 #include "proton/types.hpp"
 
-/**@file
- * Type traits used for type conversions.
- * @internal
- */
 #if  defined(__cplusplus) && __cplusplus >= 201100
 #include <type_traits>
 #else
@@ -68,49 +64,49 @@ template <> struct is_signed<signed long> : public 
true_type {};
 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>  {
+template <class T> struct type_idOf;
+template<> struct type_idOf<amqp_null> { static const type_id value=NULl_; };
+template<> struct type_idOf<amqp_bool> { static const type_id value=BOOL; };
+template<> struct type_idOf<amqp_ubyte> { static const type_id value=UBYTE; };
+template<> struct type_idOf<amqp_byte> { static const type_id value=BYTE; };
+template<> struct type_idOf<amqp_ushort> { static const type_id value=USHORT; 
};
+template<> struct type_idOf<amqp_short> { static const type_id value=SHORT; };
+template<> struct type_idOf<amqp_uint> { static const type_id value=UINT; };
+template<> struct type_idOf<amqp_int> { static const type_id value=INT; };
+template<> struct type_idOf<amqp_char> { static const type_id value=CHAR; };
+template<> struct type_idOf<amqp_ulong> { static const type_id value=ULONG; };
+template<> struct type_idOf<amqp_long> { static const type_id value=LONG; };
+template<> struct type_idOf<amqp_timestamp> { static const type_id 
value=TIMESTAMP; };
+template<> struct type_idOf<amqp_float> { static const type_id value=FLOAT; };
+template<> struct type_idOf<amqp_double> { static const type_id value=DOUBLE; 
};
+template<> struct type_idOf<amqp_decimal32> { static const type_id 
value=DECIMAL32; };
+template<> struct type_idOf<amqp_decimal64> { static const type_id 
value=DECIMAL64; };
+template<> struct type_idOf<amqp_decimal128> { static const type_id 
value=DECIMAL128; };
+template<> struct type_idOf<amqp_uuid> { static const type_id value=UUID; };
+template<> struct type_idOf<amqp_binary> { static const type_id value=BINARY; 
};
+template<> struct type_idOf<amqp_string> { static const type_id value=STRING; 
};
+template<> struct type_idOf<amqp_symbol> { static const type_id value=SYMBOL; 
};
+
+template <class T, class Enable=void> struct has_type_id { static const bool 
value = false; };
+template <class T> struct has_type_id<T, typename 
std::enable_if<type_idOf<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;
+// amqp_map to known integer types by sizeof and signedness.
+template<size_t N, bool S> struct integer_type;
+template<> struct integer_type<1, true> { typedef amqp_byte type; };
+template<> struct integer_type<2, true> { typedef amqp_short type; };
+template<> struct integer_type<4, true> { typedef amqp_int type; };
+template<> struct integer_type<8, true> { typedef amqp_long type; };
+template<> struct integer_type<1, false> { typedef amqp_ubyte type; };
+template<> struct integer_type<2, false> { typedef amqp_ushort type; };
+template<> struct integer_type<4, false> { typedef amqp_uint type; };
+template<> struct integer_type<8, false> { typedef amqp_ulong type; };
+
+// True if T is an integer type that does not have a type_id mapping.
+template <class T> struct is_unknown_integer {
+    static const bool value = !has_type_id<T>::value && 
std::is_integral<T>::value;
 };
 
 }
-#endif // ENABLE_IF_HPP
+#endif // ENABLE_If_HPP


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to