qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [1/7] qpid-proton git commit: PROTON-865: C++ reactor binding for proton.
Date Fri, 04 Sep 2015 19:14:28 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master f37e2af0e -> 445f88739


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/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
new file mode 100644
index 0000000..ece1c4e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/messaging_event.cpp
@@ -0,0 +1,150 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/reactor.h"
+#include "proton/event.h"
+#include "proton/link.h"
+
+#include "proton/messaging_event.hpp"
+#include "proton/message.hpp"
+#include "proton/proton_handler.hpp"
+#include "proton/messaging_handler.hpp"
+#include "proton/sender.hpp"
+#include "proton/receiver.hpp"
+#include "proton/error.hpp"
+#include "msg.hpp"
+#include "contexts.hpp"
+
+namespace proton {
+
+messaging_event::messaging_event(pn_event_t *ce, proton_event::event_type t, class container &c) :
+    proton_event(ce, t, c), type_(messaging_event::PROTON), parent_event_(0)
+{}
+
+messaging_event::messaging_event(event_type t, proton_event &p) :
+    proton_event(NULL, PN_EVENT_NONE, p.container()), type_(t), parent_event_(&p)
+{
+    if (type_ == messaging_event::PROTON)
+        throw error(MSG("invalid messaging event type"));
+}
+
+messaging_event::~messaging_event() {}
+
+messaging_event::event_type messaging_event::type() const { return type_; }
+
+connection &messaging_event::connection() {
+    if (type_ == messaging_event::PROTON)
+        return proton_event::connection();
+    if (parent_event_)
+        return parent_event_->connection();
+    throw error(MSG("No connection context for event"));
+}
+
+sender& messaging_event::sender() {
+    if (type_ == messaging_event::PROTON)
+        return proton_event::sender();
+    if (parent_event_)
+        return parent_event_->sender();
+    throw error(MSG("No sender context for event"));
+}
+
+receiver& messaging_event::receiver() {
+    if (type_ == messaging_event::PROTON)
+        return proton_event::receiver();
+    if (parent_event_)
+        return parent_event_->receiver();
+    throw error(MSG("No receiver context for event"));
+}
+
+link& messaging_event::link() {
+    if (type_ == messaging_event::PROTON)
+        return proton_event::link();
+    if (parent_event_)
+        return parent_event_->link();
+    throw error(MSG("No link context for event"));
+}
+
+delivery& messaging_event::delivery() {
+    if (type_ == messaging_event::PROTON)
+        return proton_event::delivery();
+    if (parent_event_)
+        return parent_event_->delivery();
+    throw error(MSG("No delivery context for event"));
+}
+
+message &messaging_event::message() {
+    if (type_ != messaging_event::MESSAGE || !parent_event_)
+        throw error(MSG("event type does not provide message"));
+    return message_;
+}
+
+void messaging_event::dispatch(handler &h) {
+    if (type_ == messaging_event::PROTON) {
+        proton_event::dispatch(h);
+        return;
+    }
+
+    messaging_handler *handler = dynamic_cast<messaging_handler*>(&h);
+    if (handler) {
+        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 " << type_));
+            break;
+        }
+    } else {
+        h.on_unhandled(*this);
+    }
+
+    // recurse through children
+    for (handler::iterator child = h.begin(); child != h.end(); ++child) {
+        dispatch(**child);
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/messaging_handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_handler.cpp b/proton-c/bindings/cpp/src/messaging_handler.cpp
new file mode 100644
index 0000000..d8b0262
--- /dev/null
+++ b/proton-c/bindings/cpp/src/messaging_handler.cpp
@@ -0,0 +1,122 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/messaging_handler.hpp"
+#include "proton/proton_event.hpp"
+#include "proton/messaging_adapter.hpp"
+#include "proton/handlers.h"
+#include <algorithm>
+
+namespace proton {
+
+namespace {
+class c_flow_controller : public proton_handler
+{
+  public:
+    pn_handler_t *flowcontroller;
+
+    // TODO: pn_flowcontroller requires a window > 1.
+    c_flow_controller(int window) : flowcontroller(pn_flowcontroller(std::max(window, 2))) {}
+    ~c_flow_controller() {
+        pn_decref(flowcontroller);
+    }
+
+    void redirect(event &e) {
+        proton_event *pne = dynamic_cast<proton_event *>(&e);
+        pn_handler_dispatch(flowcontroller, pne->pn_event(), (pn_event_type_t) pne->type());
+    }
+
+    virtual void on_link_local_open(event &e) { redirect(e); }
+    virtual void on_link_remote_open(event &e) { redirect(e); }
+    virtual void on_link_flow(event &e) { redirect(e); }
+    virtual void on_delivery(event &e) { redirect(e); }
+};
+
+} // namespace
+
+
+
+
+messaging_handler::messaging_handler(int prefetch0, bool auto_accept0, bool auto_settle0, bool peer_close_is_error0) :
+    prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0),
+    peer_close_iserror_(peer_close_is_error0)
+{
+    create_helpers();
+}
+
+messaging_handler::messaging_handler(bool raw_handler, int prefetch0, bool auto_accept0, bool auto_settle0, bool peer_close_is_error0) :
+    prefetch_(prefetch0), auto_accept_(auto_accept0), auto_settle_(auto_settle0),
+    peer_close_iserror_(peer_close_is_error0)
+{
+    if (!raw_handler) {
+        create_helpers();
+    }
+}
+
+void messaging_handler::create_helpers() {
+    if (prefetch_ > 0) {
+        flow_controller_.reset(new c_flow_controller(prefetch_));
+        add_child_handler(*flow_controller_);
+    }
+    messaging_adapter_.reset(new messaging_adapter(*this));
+    add_child_handler(*messaging_adapter_);
+}
+
+messaging_handler::~messaging_handler(){}
+
+void messaging_handler::on_abort(event &e) { on_unhandled(e); }
+void messaging_handler::on_accepted(event &e) { on_unhandled(e); }
+void messaging_handler::on_commit(event &e) { on_unhandled(e); }
+void messaging_handler::on_connection_closed(event &e) { on_unhandled(e); }
+void messaging_handler::on_connection_closing(event &e) { on_unhandled(e); }
+void messaging_handler::on_connection_error(event &e) { on_unhandled(e); }
+void messaging_handler::on_connection_opened(event &e) { on_unhandled(e); }
+void messaging_handler::on_connection_opening(event &e) { on_unhandled(e); }
+void messaging_handler::on_disconnected(event &e) { on_unhandled(e); }
+void messaging_handler::on_fetch(event &e) { on_unhandled(e); }
+void messaging_handler::on_id_loaded(event &e) { on_unhandled(e); }
+void messaging_handler::on_link_closed(event &e) { on_unhandled(e); }
+void messaging_handler::on_link_closing(event &e) { on_unhandled(e); }
+void messaging_handler::on_link_error(event &e) { on_unhandled(e); }
+void messaging_handler::on_link_opened(event &e) { on_unhandled(e); }
+void messaging_handler::on_link_opening(event &e) { on_unhandled(e); }
+void messaging_handler::on_message(event &e) { on_unhandled(e); }
+void messaging_handler::on_quit(event &e) { on_unhandled(e); }
+void messaging_handler::on_record_inserted(event &e) { on_unhandled(e); }
+void messaging_handler::on_records_loaded(event &e) { on_unhandled(e); }
+void messaging_handler::on_rejected(event &e) { on_unhandled(e); }
+void messaging_handler::on_released(event &e) { on_unhandled(e); }
+void messaging_handler::on_request(event &e) { on_unhandled(e); }
+void messaging_handler::on_response(event &e) { on_unhandled(e); }
+void messaging_handler::on_sendable(event &e) { on_unhandled(e); }
+void messaging_handler::on_session_closed(event &e) { on_unhandled(e); }
+void messaging_handler::on_session_closing(event &e) { on_unhandled(e); }
+void messaging_handler::on_session_error(event &e) { on_unhandled(e); }
+void messaging_handler::on_session_opened(event &e) { on_unhandled(e); }
+void messaging_handler::on_session_opening(event &e) { on_unhandled(e); }
+void messaging_handler::on_settled(event &e) { on_unhandled(e); }
+void messaging_handler::on_start(event &e) { on_unhandled(e); }
+void messaging_handler::on_timer(event &e) { on_unhandled(e); }
+void messaging_handler::on_transaction_aborted(event &e) { on_unhandled(e); }
+void messaging_handler::on_transaction_committed(event &e) { on_unhandled(e); }
+void messaging_handler::on_transaction_declared(event &e) { on_unhandled(e); }
+void messaging_handler::on_transport_closed(event &e) { on_unhandled(e); }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/msg.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/msg.hpp b/proton-c/bindings/cpp/src/msg.hpp
new file mode 100644
index 0000000..66c01cb
--- /dev/null
+++ b/proton-c/bindings/cpp/src/msg.hpp
@@ -0,0 +1,58 @@
+#ifndef PROTON_MSG_H
+#define PROTON_MSG_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <sstream>
+#include <iostream>
+
+namespace proton {
+
+/** A simple facade for std::ostringstream that allows
+ * in place construction of a message and automatic conversion
+ * to string.
+ * E.g.
+ *@code
+ * void foo(const std::string&);
+ * foo(msg() << "hello " << 32);
+ *@endcode
+ * Will construct the string "hello 32" and pass it to foo()
+ */
+struct msg {
+    std::ostringstream os;
+    msg() {}
+    msg(const msg& m) : os(m.str()) {}
+    std::string str() const { return os.str(); }
+    operator std::string() const { return str(); }
+    template <class T> msg& operator<<(const T& t) { os <<t; return *this; }
+};
+
+inline std::ostream& operator<<(std::ostream& o, const msg& m) { return o << m.str(); }
+
+/** Construct a message using operator << and append (file:line) */
+#define QUOTe_(x) #x
+#define QUOTE(x) QUOTe_(x)
+#define MSG(message) (::proton::msg() << message)
+
+}
+
+#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/proton_bits.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.cpp b/proton-c/bindings/cpp/src/proton_bits.cpp
new file mode 100644
index 0000000..3b522bf
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_bits.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <string>
+#include <ostream>
+#include <proton/error.h>
+#include <proton/object.h>
+#include "proton_bits.hpp"
+
+std::string error_str(int code) {
+  switch (code)
+  {
+  case 0: return "ok";
+  case PN_EOS: return "end of data stream";
+  case PN_ERR: return "error";
+  case PN_OVERFLOW: return "overflow";
+  case PN_UNDERFLOW: return "underflow";
+  case PN_STATE_ERR: return "invalid state";
+  case PN_ARG_ERR: return "invalud argument";
+  case PN_TIMEOUT: return "timeout";
+  case PN_INTR: return "interrupt";
+  default: return "unknown error code";
+  }
+}
+
+std::string error_str(pn_error_t* err, int code) {
+    if (err && pn_error_code(err)) {
+        const char* text = pn_error_text(err);
+        return text ? std::string(text) : error_str(pn_error_code(err));
+    }
+    return error_str(code);
+}
+
+std::ostream& operator<<(std::ostream& o, const inspectable& object) {
+    pn_string_t* str = pn_string("");
+    pn_inspect(object.value, str);
+    o << pn_string_get(str);
+    pn_free(str);
+    return o;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
new file mode 100644
index 0000000..d615c0f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -0,0 +1,45 @@
+#ifndef ERROR_H
+#define ERROR_H
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <string>
+#include <iosfwd>
+#include <proton/error.h>
+
+/**@file
+ *
+ * Assorted internal proton utilities.
+ */
+
+std::string error_str(int code);
+
+/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
+std::string error_str(pn_error_t*, int code=0);
+
+/** Make a void* inspectable via operator <<. */
+struct inspectable { void* value; inspectable(void* o) : value(o) {} };
+
+/** Stream a proton object via pn_inspect. */
+std::ostream& operator<<(std::ostream& o, const inspectable& object);
+
+
+
+
+#endif // ERROR_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/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
new file mode 100644
index 0000000..4b2d3ac
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -0,0 +1,183 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/reactor.h"
+#include "proton/event.h"
+#include "proton/link.h"
+
+#include "proton/container.hpp"
+#include "proton/delivery.hpp"
+#include "proton/error.hpp"
+#include "proton/proton_event.hpp"
+#include "proton/proton_handler.hpp"
+#include "proton/receiver.hpp"
+#include "proton/sender.hpp"
+
+#include "msg.hpp"
+#include "contexts.hpp"
+
+namespace proton {
+
+proton_event::proton_event(pn_event_t *ce, proton_event::event_type t, class container &c) :
+    pn_event_(ce),
+    type_(t),
+    container_(c)
+{}
+
+int proton_event::type() { return type_; }
+
+pn_event_t *proton_event::pn_event() { return pn_event_; }
+
+container &proton_event::container() { return container_; }
+
+connection &proton_event::connection() {
+    pn_connection_t *conn = pn_event_connection(pn_event());
+    if (!conn)
+        throw error(MSG("No connection context for this event"));
+    return *connection::cast(conn);
+}
+
+link& proton_event::link() {
+    class link *lnk = link::cast(pn_event_link(pn_event()));
+    if (!lnk) throw error(MSG("No link context for this event"));
+    return *lnk;
+}
+
+sender& proton_event::sender() { return link().sender(); }
+
+receiver& proton_event::receiver() { return link().receiver(); }
+
+delivery& proton_event::delivery() {
+    class delivery *dlv = delivery::cast(pn_event_delivery(pn_event()));
+    if (!dlv) throw error(MSG("No delivery context for this event"));
+    return *dlv;
+}
+
+void proton_event::dispatch(handler &h) {
+    proton_handler *handler = dynamic_cast<proton_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:
+            throw error(MSG("Invalid Proton event type " << type_));
+            break;
+        }
+    } else {
+        h.on_unhandled(*this);
+    }
+
+    // recurse through children
+    for (handler::iterator child = h.begin(); child != h.end(); ++child) {
+        dispatch(**child);
+    }
+}
+
+const proton_event::event_type proton_event::EVENT_NONE=PN_EVENT_NONE;
+const proton_event::event_type proton_event::REACTOR_INIT=PN_REACTOR_INIT;
+const proton_event::event_type proton_event::REACTOR_QUIESCED=PN_REACTOR_QUIESCED;
+const proton_event::event_type proton_event::REACTOR_FINAL=PN_REACTOR_FINAL;
+const proton_event::event_type proton_event::TIMER_TASK=PN_TIMER_TASK;
+const proton_event::event_type proton_event::CONNECTION_INIT=PN_CONNECTION_INIT;
+const proton_event::event_type proton_event::CONNECTION_BOUND=PN_CONNECTION_BOUND;
+const proton_event::event_type proton_event::CONNECTION_UNBOUND=PN_CONNECTION_UNBOUND;
+const proton_event::event_type proton_event::CONNECTION_LOCAL_OPEN=PN_CONNECTION_LOCAL_OPEN;
+const proton_event::event_type proton_event::CONNECTION_REMOTE_OPEN=PN_CONNECTION_REMOTE_OPEN;
+const proton_event::event_type proton_event::CONNECTION_LOCAL_CLOSE=PN_CONNECTION_LOCAL_CLOSE;
+const proton_event::event_type proton_event::CONNECTION_REMOTE_CLOSE=PN_CONNECTION_REMOTE_CLOSE;
+const proton_event::event_type proton_event::CONNECTION_FINAL=PN_CONNECTION_FINAL;
+const proton_event::event_type proton_event::SESSION_INIT=PN_SESSION_INIT;
+const proton_event::event_type proton_event::SESSION_LOCAL_OPEN=PN_SESSION_LOCAL_OPEN;
+const proton_event::event_type proton_event::SESSION_REMOTE_OPEN=PN_SESSION_REMOTE_OPEN;
+const proton_event::event_type proton_event::SESSION_LOCAL_CLOSE=PN_SESSION_LOCAL_CLOSE;
+const proton_event::event_type proton_event::SESSION_REMOTE_CLOSE=PN_SESSION_REMOTE_CLOSE;
+const proton_event::event_type proton_event::SESSION_FINAL=PN_SESSION_FINAL;
+const proton_event::event_type proton_event::LINK_INIT=PN_LINK_INIT;
+const proton_event::event_type proton_event::LINK_LOCAL_OPEN=PN_LINK_LOCAL_OPEN;
+const proton_event::event_type proton_event::LINK_REMOTE_OPEN=PN_LINK_REMOTE_OPEN;
+const proton_event::event_type proton_event::LINK_LOCAL_CLOSE=PN_LINK_LOCAL_CLOSE;
+const proton_event::event_type proton_event::LINK_REMOTE_CLOSE=PN_LINK_REMOTE_CLOSE;
+const proton_event::event_type proton_event::LINK_LOCAL_DETACH=PN_LINK_LOCAL_DETACH;
+const proton_event::event_type proton_event::LINK_REMOTE_DETACH=PN_LINK_REMOTE_DETACH;
+const proton_event::event_type proton_event::LINK_FLOW=PN_LINK_FLOW;
+const proton_event::event_type proton_event::LINK_FINAL=PN_LINK_FINAL;
+const proton_event::event_type proton_event::DELIVERY=PN_DELIVERY;
+const proton_event::event_type proton_event::TRANSPORT=PN_TRANSPORT;
+const proton_event::event_type proton_event::TRANSPORT_AUTHENTICATED=PN_TRANSPORT_AUTHENTICATED;
+const proton_event::event_type proton_event::TRANSPORT_ERROR=PN_TRANSPORT_ERROR;
+const proton_event::event_type proton_event::TRANSPORT_HEAD_CLOSED=PN_TRANSPORT_HEAD_CLOSED;
+const proton_event::event_type proton_event::TRANSPORT_TAIL_CLOSED=PN_TRANSPORT_TAIL_CLOSED;
+const proton_event::event_type proton_event::TRANSPORT_CLOSED=PN_TRANSPORT_CLOSED;
+const proton_event::event_type proton_event::SELECTABLE_INIT=PN_SELECTABLE_INIT;
+const proton_event::event_type proton_event::SELECTABLE_UPDATED=PN_SELECTABLE_UPDATED;
+const proton_event::event_type proton_event::SELECTABLE_READABLE=PN_SELECTABLE_READABLE;
+const proton_event::event_type proton_event::SELECTABLE_WRITABLE=PN_SELECTABLE_WRITABLE;
+const proton_event::event_type proton_event::SELECTABLE_ERROR=PN_SELECTABLE_ERROR;
+const proton_event::event_type proton_event::SELECTABLE_EXPIRED=PN_SELECTABLE_EXPIRED;
+const proton_event::event_type proton_event::SELECTABLE_FINAL=PN_SELECTABLE_FINAL;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/proton_handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_handler.cpp b/proton-c/bindings/cpp/src/proton_handler.cpp
new file mode 100644
index 0000000..d7c2da4
--- /dev/null
+++ b/proton-c/bindings/cpp/src/proton_handler.cpp
@@ -0,0 +1,73 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/proton_event.hpp"
+
+namespace proton {
+
+proton_handler::proton_handler(){}
+
+// Everything goes to on_unhandled() unless overriden by subclass
+
+void proton_handler::on_reactor_init(event &e) { on_unhandled(e); }
+void proton_handler::on_reactor_quiesced(event &e) { on_unhandled(e); }
+void proton_handler::on_reactor_final(event &e) { on_unhandled(e); }
+void proton_handler::on_timer_task(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_init(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_bound(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_unbound(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_local_open(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_local_close(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_remote_open(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_remote_close(event &e) { on_unhandled(e); }
+void proton_handler::on_connection_final(event &e) { on_unhandled(e); }
+void proton_handler::on_session_init(event &e) { on_unhandled(e); }
+void proton_handler::on_session_local_open(event &e) { on_unhandled(e); }
+void proton_handler::on_session_local_close(event &e) { on_unhandled(e); }
+void proton_handler::on_session_remote_open(event &e) { on_unhandled(e); }
+void proton_handler::on_session_remote_close(event &e) { on_unhandled(e); }
+void proton_handler::on_session_final(event &e) { on_unhandled(e); }
+void proton_handler::on_link_init(event &e) { on_unhandled(e); }
+void proton_handler::on_link_local_open(event &e) { on_unhandled(e); }
+void proton_handler::on_link_local_close(event &e) { on_unhandled(e); }
+void proton_handler::on_link_local_detach(event &e) { on_unhandled(e); }
+void proton_handler::on_link_remote_open(event &e) { on_unhandled(e); }
+void proton_handler::on_link_remote_close(event &e) { on_unhandled(e); }
+void proton_handler::on_link_remote_detach(event &e) { on_unhandled(e); }
+void proton_handler::on_link_flow(event &e) { on_unhandled(e); }
+void proton_handler::on_link_final(event &e) { on_unhandled(e); }
+void proton_handler::on_delivery(event &e) { on_unhandled(e); }
+void proton_handler::on_transport(event &e) { on_unhandled(e); }
+void proton_handler::on_transport_error(event &e) { on_unhandled(e); }
+void proton_handler::on_transport_head_closed(event &e) { on_unhandled(e); }
+void proton_handler::on_transport_tail_closed(event &e) { on_unhandled(e); }
+void proton_handler::on_transport_closed(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_init(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_updated(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_readable(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_writable(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_expired(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_error(event &e) { on_unhandled(e); }
+void proton_handler::on_selectable_final(event &e) { on_unhandled(e); }
+
+void proton_handler::on_unhandled(event &e) {}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/reactor.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/reactor.cpp b/proton-c/bindings/cpp/src/reactor.cpp
new file mode 100644
index 0000000..d68535d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/reactor.cpp
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "proton/reactor.hpp"
+
+#include <proton/reactor.h>
+
+namespace proton {
+
+PN_UNIQUE_PTR<reactor> reactor::create() {
+    return PN_UNIQUE_PTR<reactor>(reactor::cast(pn_reactor()));
+}
+
+void reactor::run() { pn_reactor_run(pn_cast(this)); }
+void reactor::start() { pn_reactor_start(pn_cast(this)); }
+bool reactor::process() { return pn_reactor_process(pn_cast(this)); }
+void reactor::stop() { pn_reactor_stop(pn_cast(this)); }
+void reactor::wakeup() { pn_reactor_wakeup(pn_cast(this)); }
+bool reactor::quiesced() { return pn_reactor_quiesced(pn_cast(this)); }
+void reactor::yield() { pn_reactor_yield(pn_cast(this)); }
+
+duration reactor::timeout() {
+    pn_millis_t tmo = pn_reactor_get_timeout(pn_cast(this));
+    if (tmo == PN_MILLIS_MAX)
+        return duration::FOREVER;
+    return duration(tmo);
+}
+
+void reactor::timeout(duration timeout) {
+    if (timeout == duration::FOREVER || timeout.milliseconds > PN_MILLIS_MAX)
+        pn_reactor_set_timeout(pn_cast(this), PN_MILLIS_MAX);
+    else
+        pn_reactor_set_timeout(pn_cast(this), timeout.milliseconds);
+}
+
+
+void reactor::operator delete(void* p) {
+    pn_reactor_free(reinterpret_cast<pn_reactor_t*>(p));
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/receiver.cpp b/proton-c/bindings/cpp/src/receiver.cpp
new file mode 100644
index 0000000..96a116d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/receiver.cpp
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/link.hpp"
+#include "proton/receiver.hpp"
+#include "proton/error.hpp"
+#include "msg.hpp"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/link.h"
+
+namespace proton {
+
+void receiver::flow(int count) {
+    pn_link_flow(pn_cast(this), count);
+}
+
+receiver* receiver::cast(pn_type* p) { return &link::cast(p)->receiver(); }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sender.cpp b/proton-c/bindings/cpp/src/sender.cpp
new file mode 100644
index 0000000..993f27d
--- /dev/null
+++ b/proton-c/bindings/cpp/src/sender.cpp
@@ -0,0 +1,59 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/link.hpp"
+#include "proton/sender.hpp"
+#include "proton/error.hpp"
+#include "msg.hpp"
+#include "contexts.hpp"
+
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/link.h"
+#include "proton/types.h"
+#include "proton/codec.h"
+#include "proton/message.h"
+#include "proton/delivery.h"
+#include <stdlib.h>
+#include <string.h>
+
+namespace proton {
+
+namespace {
+// TODO: revisit if thread safety required
+amqp_ulong tag_counter = 0;
+}
+
+delivery& sender::send(const message &message) {
+    amqp_ulong id = ++tag_counter;
+    pn_delivery_t *dlv =
+        pn_delivery(pn_cast(this), pn_dtag(reinterpret_cast<const char*>(&id), sizeof(id)));
+    std::string buf;
+    message.encode(buf);
+    pn_link_send(pn_cast(this), buf.data(), buf.size());
+    pn_link_advance(pn_cast(this));
+    if (pn_link_snd_settle_mode(pn_cast(this)) == PN_SND_SETTLED)
+        pn_delivery_settle(dlv);
+    return *delivery::cast(dlv);
+}
+
+sender* sender::cast(pn_type* p) { return &link::cast(p)->sender(); }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session.cpp b/proton-c/bindings/cpp/src/session.cpp
new file mode 100644
index 0000000..3629f21
--- /dev/null
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -0,0 +1,78 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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/session.hpp"
+#include "proton/connection.h"
+#include "proton/session.h"
+#include "proton/session.hpp"
+#include "proton/connection.hpp"
+
+#include "contexts.hpp"
+#include "container_impl.hpp"
+
+namespace proton {
+
+void session::open() {
+    pn_session_open(pn_cast(this));
+}
+
+connection &session::connection() {
+    return *proton::connection::cast(pn_session_connection(pn_cast(this)));
+}
+
+namespace {
+std::string set_name(const std::string& name, session* s) {
+    if (name.empty())
+        return connection_context::get(
+            pn_cast(&s->connection())).container_impl->next_link_name();
+    return name;
+}
+}
+
+receiver& session::create_receiver_link(const std::string& name) {
+    return *reinterpret_cast<receiver*>(
+        pn_receiver(pn_cast(this), set_name(name, this).c_str()));
+}
+
+sender& session::create_sender_link(const std::string& name) {
+    return *reinterpret_cast<sender*>(
+        pn_sender(pn_cast(this), set_name(name, this).c_str()));
+}
+
+sender& session::create_sender(const std::string &addr, handler *h) {
+    sender& snd = create_sender_link();
+    snd.target().address(addr);
+    if (h) snd.handler(*h);
+    snd.open();
+    return snd;
+}
+
+receiver& session::create_receiver(const std::string &addr, bool dynamic, handler *h)
+{
+    receiver& rcv = create_receiver_link();
+    rcv.source().address(addr);
+    if (dynamic) rcv.source().dynamic(true);
+    if (h) rcv.handler(*h);
+    rcv.open();
+    return rcv;
+}
+
+endpoint::state session::state() { return pn_session_state(pn_cast(this)); }
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/sync_request_response.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sync_request_response.cpp b/proton-c/bindings/cpp/src/sync_request_response.cpp
new file mode 100644
index 0000000..1c9b220
--- /dev/null
+++ b/proton-c/bindings/cpp/src/sync_request_response.cpp
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/blocking_connection.hpp"
+#include "proton/sync_request_response.hpp"
+#include "proton/event.hpp"
+#include "proton/error.hpp"
+#include "proton/data.hpp"
+#include "blocking_connection_impl.hpp"
+#include "msg.hpp"
+
+namespace proton {
+
+sync_request_response::sync_request_response(blocking_connection &conn, const std::string addr):
+    connection_(conn), address_(addr),
+    sender_(new blocking_sender(connection_, addr)),
+    receiver_(new blocking_receiver(connection_, "", 1/*credit*/, true/*dynamic*/)),
+    correlation_id_(0)
+{}
+
+message_value sync_request_response::call(message &request) {
+    if (address_.empty() && request.address().empty())
+        throw error(MSG("Request message has no address"));
+    // TODO: atomic increment.
+    data_value cid(++correlation_id_);
+    request.correlation_id(cid);
+    request.reply_to(this->reply_to());
+    sender_->send(request);
+    message_value response;
+    while (response.correlation_id() != cid) {
+        response = receiver_->receive();
+    }
+    return response;
+}
+
+std::string sync_request_response::reply_to() {
+    return receiver_->receiver().remote_source().address();
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/terminus.cpp b/proton-c/bindings/cpp/src/terminus.cpp
new file mode 100644
index 0000000..2c960d6
--- /dev/null
+++ b/proton-c/bindings/cpp/src/terminus.cpp
@@ -0,0 +1,68 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/link.hpp"
+#include "proton/link.h"
+
+namespace proton {
+
+terminus::type_t terminus::type() {
+    return (type_t) pn_terminus_get_type(pn_cast(this));
+}
+
+void terminus::type(type_t type) {
+    pn_terminus_set_type(pn_cast(this), (pn_terminus_type_t) type);
+}
+
+terminus::expiry_policy_t terminus::expiry_policy() {
+    return (expiry_policy_t) pn_terminus_get_type(pn_cast(this));
+}
+
+void terminus::expiry_policy(expiry_policy_t policy) {
+    pn_terminus_set_expiry_policy(pn_cast(this), (pn_expiry_policy_t) policy);
+}
+
+terminus::distribution_mode_t terminus::distribution_mode() {
+    return (distribution_mode_t) pn_terminus_get_type(pn_cast(this));
+}
+
+void terminus::distribution_mode(distribution_mode_t mode) {
+    pn_terminus_set_distribution_mode(pn_cast(this), (pn_distribution_mode_t) mode);
+}
+
+std::string terminus::address() {
+    const char *addr = pn_terminus_get_address(pn_cast(this));
+    return addr ? std::string(addr) : std::string();
+}
+
+void terminus::address(const std::string &addr) {
+    pn_terminus_set_address(pn_cast(this), addr.c_str());
+}
+
+bool terminus::is_dynamic() {
+    return (type_t) pn_terminus_is_dynamic(pn_cast(this));
+}
+
+void terminus::dynamic(bool d) {
+    pn_terminus_set_dynamic(pn_cast(this), d);
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/test_bits.hpp b/proton-c/bindings/cpp/src/test_bits.hpp
new file mode 100644
index 0000000..bd94b8e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/test_bits.hpp
@@ -0,0 +1,48 @@
+#ifndef TEST_BITS_HPP
+#define TEST_BITS_HPP
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdexcept>
+#include <iostream>
+#include "msg.hpp"
+
+namespace {
+
+struct fail : public std::logic_error { fail(const std::string& what) : logic_error(what) {} };
+#define FAIL(WHAT) throw fail(MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT))
+#define ASSERT(TEST) do { if (!(TEST)) FAIL("assert failed: " << #TEST); } while(false)
+#define ASSERT_EQUAL(WANT, GOT) if ((WANT) != (GOT)) \
+        FAIL(#WANT << " !=  " << #GOT << ": " << WANT << " != " << GOT)
+
+int run_test(void (*testfn)(), const char* name) {
+    try {
+        testfn();
+        return 0;
+    } catch(const fail& e) {
+        std::cout << "FAIL " << name << std::endl << e.what();
+    } catch(const std::exception& e) {
+        std::cout << "ERROR " << name << std::endl << e.what();
+    }
+    return 1;
+}
+
+#define RUN_TEST(TEST) run_test(TEST, #TEST)
+}
+#endif // TEST_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp
new file mode 100644
index 0000000..e128492
--- /dev/null
+++ b/proton-c/bindings/cpp/src/transport.cpp
@@ -0,0 +1,31 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "proton/transport.hpp"
+#include "proton/connection.hpp"
+#include "proton/transport.h"
+
+namespace proton {
+
+connection* transport::connection() {
+    return connection::cast(pn_transport_connection(pn_cast(this)));
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/types.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types.cpp b/proton-c/bindings/cpp/src/types.cpp
new file mode 100644
index 0000000..916e2fb
--- /dev/null
+++ b/proton-c/bindings/cpp/src/types.cpp
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "proton/types.hpp"
+#include <proton/codec.h>
+#include <ostream>
+#include <algorithm>
+
+namespace proton {
+
+namespace {
+inline std::ostream& print_segment(std::ostream& o, const amqp_uuid& u, size_t begin, size_t end, const char* sep="") {
+    for (const char* p = &u[begin]; p < &u[end]; ++p) o << *p;
+    return o << sep;
+}
+}
+
+std::ostream& operator<<(std::ostream& o, const amqp_uuid& u) {
+    std::ios_base::fmtflags ff = o.flags();
+    o.flags(std::ios_base::hex);
+    print_segment(o, u, 0, 4, "-");
+    print_segment(o, u, 4, 6, "-");
+    print_segment(o, u, 6, 8, "-");
+    print_segment(o, u, 8, 10, "-");
+    print_segment(o, u, 10, 16);
+    o.flags(ff);
+    return o;
+}
+
+std::string type_name(type_id t) {
+    switch (t) {
+      case NULL_: return "null";
+      case BOOL: return "bool";
+      case UBYTE: return "ubyte";
+      case BYTE: return "byte";
+      case USHORT: return "ushort";
+      case SHORT: return "short";
+      case UINT: return "uint";
+      case INT: return "int";
+      case CHAR: return "char";
+      case ULONG: return "ulong";
+      case LONG: return "long";
+      case TIMESTAMP: return "timestamp";
+      case FLOAT: return "float";
+      case DOUBLE: return "double";
+      case DECIMAL32: return "decimal32";
+      case DECIMAL64: return "decimal64";
+      case DECIMAL128: return "decimal128";
+      case UUID: return "uuid";
+      case BINARY: return "binary";
+      case STRING: return "string";
+      case SYMBOL: return "symbol";
+      case DESCRIBED: return "described";
+      case ARRAY: return "array";
+      case LIST: return "list";
+      case  MAP: return "map";
+      default: return "unknown";
+    }
+}
+
+std::ostream& operator<<(std::ostream& o,type_id t) { return o << type_name(t); }
+
+PN_CPP_EXTERN bool is_container(type_id t) {
+    return (t == LIST || t == MAP || t == ARRAY || t == DESCRIBED);
+}
+
+pn_bytes_t pn_bytes(const std::string& s) {
+    pn_bytes_t b = { s.size(), const_cast<char*>(&s[0]) };
+    return b;
+}
+
+std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+
+start::start(type_id t, type_id e, bool d, size_t s) : type(t), element(e), is_described(d), size(s) {}
+start start::array(type_id element, bool described) { return start(ARRAY, element, described); }
+start start::list() { return start(LIST); }
+start start::map() { return start(MAP); }
+start start::described() { return start(DESCRIBED, NULL_, true); }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/url.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/url.cpp b/proton-c/bindings/cpp/src/url.cpp
new file mode 100644
index 0000000..4b8d956
--- /dev/null
+++ b/proton-c/bindings/cpp/src/url.cpp
@@ -0,0 +1,114 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/error.hpp"
+#include "proton/url.hpp"
+#include "proton/url.h"
+#include <ostream>
+#include <istream>
+
+namespace proton {
+
+bad_url::bad_url(const std::string& s) throw() : error(s) {}
+
+namespace {
+
+pn_url_t* parse_throw(const std::string& s) {
+    pn_url_t* u = pn_url_parse(s.c_str());
+    if (!u) throw bad_url("invalid URL: " + s);
+    return u;
+}
+
+pn_url_t* parse_allow_empty(const std::string& s) {
+    return s.empty() ? pn_url() : parse_throw(s);
+}
+
+std::string char_str(const char* s) { return s ? std::string(s) : std::string(); }
+
+void replace(pn_url_t*& var, pn_url_t* val) {
+    if (var) pn_url_free(var);
+    var = val;
+}
+
+} // namespace
+
+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_); }
+
+url& url::operator=(const url& u) { replace(url_, parse_allow_empty(u.str())); return *this; }
+
+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_)); }
+std::string url::username() const { return char_str(pn_url_get_username(url_)); }
+std::string url::password() const { return char_str(pn_url_get_password(url_)); }
+std::string url::host() const { return char_str(pn_url_get_host(url_)); }
+std::string url::port() const { return char_str(pn_url_get_port(url_)); }
+std::string url::path() const { return char_str(pn_url_get_path(url_)); }
+
+std::string url::host_port() const { return host() + ":" + port(); }
+
+bool url::empty() const { return str().empty(); }
+
+void url::scheme(const std::string& s) { pn_url_set_scheme(url_, s.c_str()); }
+void url::username(const std::string& s) { pn_url_set_username(url_, s.c_str()); }
+void url::password(const std::string& s) { pn_url_set_password(url_, s.c_str()); }
+void url::host(const std::string& s) { pn_url_set_host(url_, s.c_str()); }
+void url::port(const std::string& s) { pn_url_set_port(url_, s.c_str()); }
+void url::path(const std::string& s) { pn_url_set_path(url_, s.c_str()); }
+
+void url::defaults() {
+    if (scheme().empty()) scheme(AMQP);
+    if (port().empty()) port(scheme());
+}
+
+const std::string url::AMQP("amqp");
+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/445f8873/proton-c/bindings/cpp/src/uuid.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/uuid.cpp b/proton-c/bindings/cpp/src/uuid.cpp
new file mode 100644
index 0000000..ca6dec9
--- /dev/null
+++ b/proton-c/bindings/cpp/src/uuid.cpp
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "uuid.hpp"
+
+#include <cstdlib>
+#include <ctime>
+#include <sstream>
+#include <iomanip>
+
+namespace proton {
+
+uuid::uuid() {
+    static bool seeded = false;
+    if (!seeded) {
+        std::srand(std::time(0)); // use current time as seed for random generator
+        seeded = true;
+    }
+    int r = std::rand();
+    for (size_t i = 0; i < sizeof(bytes); ++i ) {
+        bytes[i] = r & 0xFF;
+        r >>= 8;
+        if (!r) r = std::rand();
+    }
+
+    // From RFC4122, the version bits are set to 0100
+    bytes[6] = (bytes[6] & 0x0F) | 0x40;
+
+    // From RFC4122, the top two bits of byte 8 get set to 01
+    bytes[8] = (bytes[8] & 0x3F) | 0x80;
+}
+
+std::string uuid::str() {
+    // UUID standard format: 8-4-4-4-12 (36 chars, 32 alphanumeric and 4 hypens)
+    std::ostringstream s;
+    s << std::hex << std::setw(2) << std::setfill('0');
+    s << b(0) << b(1) << b(2) << b(3);
+    s << '-' << b(4) << b(5) << '-' << b(6) << b(7) << '-' << b(8) << b(9);
+    s << '-' << b(10) << b(11) << b(12) << b(13) << b(14) << b(15);
+    return s.str();
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/bindings/cpp/src/uuid.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/uuid.hpp b/proton-c/bindings/cpp/src/uuid.hpp
new file mode 100644
index 0000000..12e891e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/uuid.hpp
@@ -0,0 +1,39 @@
+#ifndef UUID_HPP
+#define UUID_HPP
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <proton/types.hpp>
+
+#include <string>
+
+namespace proton {
+
+/// A simple random UUID-like value. Fallback if user does not provide a container id.
+struct uuid {
+    uuid();
+    uint8_t bytes[16];
+    std::string str();
+  private:
+    int b(int i) { return bytes[i]; }
+};
+
+}
+
+#endif // UUID_HPP

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

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/docs/api/user.doxygen.in
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/user.doxygen.in b/proton-c/docs/api/user.doxygen.in
index 6288764..82048cb 100644
--- a/proton-c/docs/api/user.doxygen.in
+++ b/proton-c/docs/api/user.doxygen.in
@@ -162,7 +162,7 @@ STRIP_FROM_INC_PATH    =
 # (but less readable) file names. This can be useful if your file system
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
-SHORT_NAMES            = YES
+SHORT_NAMES            = NO
 
 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
 # will interpret the first line (until the first dot) of a JavaDoc-style
@@ -660,7 +660,7 @@ INPUT_ENCODING         = UTF-8
 # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
 # *.f90 *.f *.for *.vhd *.vhdl
 
-FILE_PATTERNS          = *.h *.md
+FILE_PATTERNS          = *.h *.md *.hpp
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
 # should be searched for input files as well. Possible values are YES and NO.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/include/proton/codec.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/codec.h b/proton-c/include/proton/codec.h
index 4c4d2c3..3f6a6dc 100644
--- a/proton-c/include/proton/codec.h
+++ b/proton-c/include/proton/codec.h
@@ -177,6 +177,9 @@ typedef enum {
   PN_MAP = 25
 } pn_type_t;
 
+/** A special invalid type value that is returned when no valid type is available. */
+PN_EXTERN extern const pn_type_t PN_INVALID;
+
 /**
  * Return a string name for an AMQP type.
  *
@@ -468,8 +471,8 @@ PN_EXTERN bool pn_data_exit(pn_data_t *data);
 PN_EXTERN bool pn_data_lookup(pn_data_t *data, const char *name);
 
 /**
- * Access the type of the current node. Returns an undefined value if
- * there is no current node.
+ * Access the type of the current node. Returns PN_INVALID if there is no
+ * current node.
  *
  * @param data a data object
  * @return the type of the current node
@@ -506,8 +509,7 @@ PN_EXTERN int pn_data_format(pn_data_t *data, char *bytes, size_t *size);
  * @param bytes the buffer for encoded data
  * @param size the size of the buffer
  *
- * @param ssize_t returns the size of the encoded data on success or
- *                an error code on failure
+ * @return the size of the encoded data on success or an error code on failure
  */
 PN_EXTERN ssize_t pn_data_encode(pn_data_t *data, char *bytes, size_t size);
 
@@ -516,7 +518,7 @@ PN_EXTERN ssize_t pn_data_encode(pn_data_t *data, char *bytes, size_t size);
  *
  * @param data the data object
  *
- * @param ssize_t returns the size of the encoded data or an error code if data is invalid.
+ * @return the size of the encoded data or an error code if data is invalid.
  */
 PN_EXTERN ssize_t pn_data_encoded_size(pn_data_t *data);
 
@@ -542,7 +544,7 @@ PN_EXTERN ssize_t pn_data_decode(pn_data_t *data, const char *bytes, size_t size
 /**
  * Puts an empty list value into a pn_data_t. Elements may be filled
  * by entering the list node using ::pn_data_enter() and using
- * ::pn_data_put_* to add the desired contents. Once done,
+ * pn_data_put_* to add the desired contents. Once done,
  * ::pn_data_exit() may be used to return to the current level in the
  * tree and put more values.
  *
@@ -912,7 +914,7 @@ PN_EXTERN size_t pn_data_get_map(pn_data_t *data);
  * If the current node is an array, return the number of elements in
  * the array, otherwise return 0. Array data can be accessed by
  * entering the array. If the array is described, the first child node
- * will be the descriptor, and the remaining @var count child nodes
+ * will be the descriptor, and the remaining count child nodes
  * will be the elements of the array.
  *
  * @code
@@ -953,7 +955,7 @@ PN_EXTERN bool pn_data_is_array_described(pn_data_t *data);
 
 /**
  * Return the array type if the current node points to an array,
- * undefined otherwise.
+ * PN_INVALID otherwise.
  *
  * @param data a pn_data_t object
  * @return the element type of an array node
@@ -1246,7 +1248,7 @@ PN_EXTERN pn_handle_t pn_data_point(pn_data_t *data);
  * otherwise it will return true.
  *
  * @param data a pn_data_t object
- * @param handle a handle referencing the saved navigational state
+ * @param point a handle referencing the saved navigational state
  * @return true iff the prior navigational state was restored
  */
 PN_EXTERN bool pn_data_restore(pn_data_t *data, pn_handle_t point);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/include/proton/event.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/event.h b/proton-c/include/proton/event.h
index 43329c4..d10927b 100644
--- a/proton-c/include/proton/event.h
+++ b/proton-c/include/proton/event.h
@@ -350,8 +350,9 @@ PN_EXTERN void pn_collector_release(pn_collector_t *collector);
  * this happens, this operation will return a NULL pointer.
  *
  * @param[in] collector a collector object
- * @param[in] type the event type
+ * @param[in] clazz class of the context
  * @param[in] context the event context
+ * @param[in] type the event type
  *
  * @return a pointer to the newly created event or NULL if the event
  *         was elided

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/include/proton/handlers.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/handlers.h b/proton-c/include/proton/handlers.h
index 304d0e6..f61e04c 100644
--- a/proton-c/include/proton/handlers.h
+++ b/proton-c/include/proton/handlers.h
@@ -36,7 +36,6 @@ extern "C" {
  * Reactor API for proton.
  *
  * @defgroup handlers Handlers
- * @ingroup handlers
  * @{
  */
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/include/proton/reactor.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/reactor.h b/proton-c/include/proton/reactor.h
index 6f52d22..ed223e7 100644
--- a/proton-c/include/proton/reactor.h
+++ b/proton-c/include/proton/reactor.h
@@ -38,7 +38,6 @@ extern "C" {
  * Reactor API for proton.
  *
  * @defgroup reactor Reactor
- * @ingroup reactor
  * @{
  */
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/include/proton/selectable.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/selectable.h b/proton-c/include/proton/selectable.h
index 07cb212..9c8f7b1 100644
--- a/proton-c/include/proton/selectable.h
+++ b/proton-c/include/proton/selectable.h
@@ -237,6 +237,7 @@ PN_EXTERN void pn_selectable_free(pn_selectable_t *selectable);
  * writable, and expired events into the supplied collector.
  *
  * @param[in] selectable a selectable objet
+ * @param[in] collector a collector object
  */
 PN_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/src/codec/codec.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c
index 0c4eab9..1e58251 100644
--- a/proton-c/src/codec/codec.c
+++ b/proton-c/src/codec/codec.c
@@ -73,6 +73,8 @@ const char *pn_type_name(pn_type_t type)
   return "<UNKNOWN>";
 }
 
+const pn_type_t PN_INVALID = (pn_type_t) -1;
+
 static inline void pni_atom_init(pn_atom_t *atom, pn_type_t type)
 {
   memset(atom, 0, sizeof(pn_atom_t));
@@ -697,7 +699,7 @@ static bool pn_scan_next(pn_data_t *data, pn_type_t *type, bool suspend)
       pn_data_exit(data);
       return pn_scan_next(data, type, suspend);
     } else {
-      *type = (pn_type_t) -1;
+      *type = PN_INVALID;
       return false;
     }
   }
@@ -1271,7 +1273,7 @@ pn_type_t pn_data_type(pn_data_t *data)
   if (node) {
     return node->atom.type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 
@@ -1281,7 +1283,7 @@ pn_type_t pni_data_parent_type(pn_data_t *data)
   if (node) {
     return node->atom.type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 
@@ -1723,7 +1725,7 @@ pn_type_t pn_data_get_array_type(pn_data_t *data)
   if (node && node->atom.type == PN_ARRAY) {
     return node->type;
   } else {
-    return (pn_type_t) -1;
+    return PN_INVALID;
   }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/445f8873/proton-c/src/windows/io.c
----------------------------------------------------------------------
diff --git a/proton-c/src/windows/io.c b/proton-c/src/windows/io.c
index f912a27..2161ebb 100644
--- a/proton-c/src/windows/io.c
+++ b/proton-c/src/windows/io.c
@@ -171,10 +171,19 @@ static void pn_configure_sock(pn_io_t *io, pn_socket_t sock) {
 
 static inline pn_socket_t pni_create_socket(int domain);
 
+static const char *amqp_service(const char *port) {
+  // Help older Windows to know about amqp[s] ports
+  if (port) {
+    if (!strcmp("amqp", port)) return "5672";
+    if (!strcmp("amqps", port)) return "5671";
+  }
+  return port;
+}
+
 pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port)
 {
   struct addrinfo *addr;
-  int code = getaddrinfo(host, port, NULL, &addr);
+  int code = getaddrinfo(host, amqp_service(port), NULL, &addr);
   if (code) {
     pn_error_format(io->error, PN_ERR, "getaddrinfo(%s, %s): %s\n", host, port, gai_strerror(code));
     return INVALID_SOCKET;
@@ -228,7 +237,7 @@ pn_socket_t pn_connect(pn_io_t *io, const char *hostarg, const char *port)
   const char *host = strcmp("0.0.0.0", hostarg) ? hostarg : "127.0.0.1";
 
   struct addrinfo *addr;
-  int code = getaddrinfo(host, port, NULL, &addr);
+  int code = getaddrinfo(host, amqp_service(port), NULL, &addr);
   if (code) {
     pn_error_format(io->error, PN_ERR, "getaddrinfo(%s, %s): %s", host, port, gai_strerror(code));
     return INVALID_SOCKET;


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


Mime
View raw message