summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2015-01-19 14:12:54 +0000
committerGordon Sim <gsim@apache.org>2015-01-19 14:12:54 +0000
commite459d2c4c0073217cdd7cd5b73e3aecee0c06ca8 (patch)
treee3b2e05c5225f9f24f0318b85a3cbda32fc458a0 /qpid/cpp
parent2e7cc144d9ce84301ad5d9c3f868eb0f4ea03822 (diff)
downloadqpid-python-e459d2c4c0073217cdd7cd5b73e3aecee0c06ca8.tar.gz
QPID-6321: handle change to pn_delivery_tag_t in 0.9
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1653005 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/amqp.cmake5
-rw-r--r--qpid/cpp/src/config.h.cmake2
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Connection.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp9
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Relay.cpp9
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Session.cpp5
-rw-r--r--qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp5
7 files changed, 37 insertions, 2 deletions
diff --git a/qpid/cpp/src/amqp.cmake b/qpid/cpp/src/amqp.cmake
index 77ade87c8e..b2ff10bd68 100644
--- a/qpid/cpp/src/amqp.cmake
+++ b/qpid/cpp/src/amqp.cmake
@@ -22,7 +22,7 @@
find_package(Proton 0.5)
set (amqp_default ${amqp_force})
-set (maximum_version 0.8)
+set (maximum_version 0.9)
if (Proton_FOUND)
if (Proton_VERSION GREATER ${maximum_version})
message(WARNING "Qpid proton ${Proton_VERSION} is not a tested version and might not be compatible, ${maximum_version} is highest tested; build may not work")
@@ -37,6 +37,9 @@ if (Proton_FOUND)
set (USE_PROTON_TRANSPORT_CONDITION 1)
set (HAVE_PROTON_EVENTS 1)
endif (Proton_VERSION GREATER 0.7)
+ if (Proton_VERSION GREATER 0.8)
+ set (NO_PROTON_DELIVERY_TAG_T 1)
+ endif (Proton_VERSION GREATER 0.8)
else ()
message(STATUS "Qpid proton not found, amqp 1.0 support not enabled")
endif ()
diff --git a/qpid/cpp/src/config.h.cmake b/qpid/cpp/src/config.h.cmake
index dbfc4ced8a..777fc1b893 100644
--- a/qpid/cpp/src/config.h.cmake
+++ b/qpid/cpp/src/config.h.cmake
@@ -59,5 +59,5 @@
#cmakedefine HAVE_PROTON_TRACER
#cmakedefine USE_PROTON_TRANSPORT_CONDITION
#cmakedefine HAVE_PROTON_EVENTS
-
+#cmakedefine NO_PROTON_DELIVERY_TAG_T
#endif /* QPID_CONFIG_H */
diff --git a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
index f04cd8eb6e..3a93e2aac5 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
@@ -412,7 +412,11 @@ void Connection::process()
namespace {
std::string convert(pn_delivery_tag_t in)
{
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ return std::string(in.start, in.size);
+#else
return std::string(in.bytes, in.size);
+#endif
}
}
void Connection::processDeliveries()
diff --git a/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp b/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
index d0b41c6c90..0136d5a0ed 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
@@ -32,6 +32,7 @@
#include "qpid/framing/Buffer.h"
#include "qpid/framing/reply_exceptions.h"
#include "qpid/log/Statement.h"
+#include "config.h"
namespace qpid {
namespace broker {
@@ -285,7 +286,11 @@ qpid::broker::OwnershipToken* OutgoingFromQueue::getSession()
OutgoingFromQueue::Record::Record() : delivery(0), disposition(0), index(0)
{
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ tag.start = tagData;
+#else
tag.bytes = tagData;
+#endif
tag.size = TAG_WIDTH;
}
void OutgoingFromQueue::Record::init(size_t i)
@@ -306,7 +311,11 @@ void OutgoingFromQueue::Record::reset()
size_t OutgoingFromQueue::Record::getIndex(pn_delivery_tag_t t)
{
assert(t.size == TAG_WIDTH);
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ qpid::framing::Buffer buffer(const_cast<char*>(t.start)/*won't ever be written to*/, t.size);
+#else
qpid::framing::Buffer buffer(const_cast<char*>(t.bytes)/*won't ever be written to*/, t.size);
+#endif
return (size_t) buffer.getLong();
}
diff --git a/qpid/cpp/src/qpid/broker/amqp/Relay.cpp b/qpid/cpp/src/qpid/broker/amqp/Relay.cpp
index 5e7a3af889..587a11466a 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Relay.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Relay.cpp
@@ -23,6 +23,7 @@
#include "qpid/log/Statement.h"
#include <algorithm>
#include <string.h>
+#include "config.h"
namespace qpid {
namespace broker {
@@ -244,7 +245,11 @@ void BufferedTransfer::initIn(pn_link_t* link, pn_delivery_t* d)
//copy delivery tag
pn_delivery_tag_t dt = pn_delivery_tag(d);
tag.resize(dt.size);
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ ::memmove(&tag[0], dt.start, dt.size);
+#else
::memmove(&tag[0], dt.bytes, dt.size);
+#endif
//set context
pn_delivery_set_context(d, this);
@@ -264,7 +269,11 @@ bool BufferedTransfer::settle()
void BufferedTransfer::initOut(pn_link_t* link)
{
pn_delivery_tag_t dt;
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ dt.start = &tag[0];
+#else
dt.bytes = &tag[0];
+#endif
dt.size = tag.size();
out.handle = pn_delivery(link, dt);
//set context
diff --git a/qpid/cpp/src/qpid/broker/amqp/Session.cpp b/qpid/cpp/src/qpid/broker/amqp/Session.cpp
index 2e7d30118a..04a691e5d9 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Session.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Session.cpp
@@ -48,6 +48,7 @@
#include "qpid/framing/MessageTransferBody.h"
#include "qpid/log/Statement.h"
#include "qpid/amqp_0_10/Codecs.h"
+#include "config.h"
#include <boost/intrusive_ptr.hpp>
#include <boost/format.hpp>
#include <map>
@@ -615,7 +616,11 @@ void Session::accepted(pn_delivery_t* delivery, bool sync)
void Session::readable(pn_link_t* link, pn_delivery_t* delivery)
{
pn_delivery_tag_t tag = pn_delivery_tag(delivery);
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ QPID_LOG(debug, "received delivery: " << std::string(tag.start, tag.size));
+#else
QPID_LOG(debug, "received delivery: " << std::string(tag.bytes, tag.size));
+#endif
incomingMessageReceived();
IncomingLinks::iterator target = incoming.find(link);
if (target == incoming.end()) {
diff --git a/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp
index 421b177163..2a48b2241a 100644
--- a/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp
+++ b/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp
@@ -30,6 +30,7 @@
#include "qpid/messaging/Message.h"
#include "qpid/messaging/MessageImpl.h"
#include "qpid/log/Statement.h"
+#include "config.h"
extern "C" {
#include <proton/engine.h>
}
@@ -510,7 +511,11 @@ void SenderContext::Delivery::send(pn_link_t* sender, bool unreliable)
{
pn_delivery_tag_t tag;
tag.size = sizeof(id);
+#ifdef NO_PROTON_DELIVERY_TAG_T
+ tag.start = reinterpret_cast<const char*>(&id);
+#else
tag.bytes = reinterpret_cast<const char*>(&id);
+#endif
token = pn_delivery(sender, tag);
pn_link_send(sender, encoded.getData(), encoded.getSize());
if (unreliable) {