You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/10/27 18:00:17 UTC
svn commit: r1634595 - in /qpid/trunk/qpid/cpp/src/qpid/amqp: Decoder.cpp
Descriptor.cpp Descriptor.h descriptors.h
Author: gsim
Date: Mon Oct 27 17:00:16 2014
New Revision: 1634595
URL: http://svn.apache.org/r1634595
Log:
QPID-4710: Handle nested descriptors i.e. described types where the value is itself a described type. Required for sending transaction control messages.
Modified:
qpid/trunk/qpid/cpp/src/qpid/amqp/Decoder.cpp
qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.cpp
qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.h
qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h
Modified: qpid/trunk/qpid/cpp/src/qpid/amqp/Decoder.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp/Decoder.cpp?rev=1634595&r1=1634594&r2=1634595&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp/Decoder.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp/Decoder.cpp Mon Oct 27 17:00:16 2014
@@ -274,6 +274,9 @@ Constructor Decoder::readConstructor()
result.isDescribed = true;
result.descriptor = readDescriptor();
result.code = readCode();
+ for (Descriptor* d = &result.descriptor; result.code == DESCRIPTOR; result.code = readCode()) {
+ d = d->nest(readDescriptor());
+ }
} else {
result.isDescribed = false;
}
Modified: qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.cpp?rev=1634595&r1=1634594&r2=1634595&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.cpp Mon Oct 27 17:00:16 2014
@@ -51,6 +51,13 @@ size_t Descriptor::getSize() const
return size;
}
+Descriptor* Descriptor::nest(const Descriptor& d)
+{
+ nested = boost::shared_ptr<Descriptor>(new Descriptor(0));
+ *nested = d;
+ return nested.get();
+}
+
std::ostream& operator<<(std::ostream& os, const Descriptor& d)
{
switch (d.type) {
@@ -62,6 +69,9 @@ std::ostream& operator<<(std::ostream& o
os << "0x" << std::hex << d.value.code;
break;
}
+ if (d.nested.get()) {
+ os << " ->(" << *d.nested << ")";
+ }
return os;
}
}} // namespace qpid::amqp
Modified: qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.h?rev=1634595&r1=1634594&r2=1634595&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp/Descriptor.h Mon Oct 27 17:00:16 2014
@@ -24,6 +24,7 @@
#include "qpid/amqp/CharSequence.h"
#include "qpid/sys/IntegerTypes.h"
#include <ostream>
+#include <boost/shared_ptr.hpp>
namespace qpid {
namespace amqp {
@@ -41,11 +42,13 @@ struct Descriptor
NUMERIC,
SYMBOLIC
} type;
+ boost::shared_ptr<Descriptor> nested;
QPID_COMMON_EXTERN Descriptor(uint64_t code);
QPID_COMMON_EXTERN Descriptor(const CharSequence& symbol);
QPID_COMMON_EXTERN bool match(const std::string&, uint64_t) const;
QPID_COMMON_EXTERN size_t getSize() const;
+ QPID_COMMON_EXTERN Descriptor* nest(const Descriptor& d);
};
QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const Descriptor& d);
Modified: qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h?rev=1634595&r1=1634594&r2=1634595&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp/descriptors.h Mon Oct 27 17:00:16 2014
@@ -102,6 +102,18 @@ const uint64_t DELETE_ON_NO_MESSAGES_COD
const uint64_t DELETE_ON_NO_LINKS_OR_MESSAGES_CODE(0x2E);
}
+namespace transaction {
+const std::string DECLARE_SYMBOL("amqp:declare:list");
+const std::string DISCHARGE_SYMBOL("amqp:discharge:list");
+const std::string DECLARED_SYMBOL("amqp:declared:list");
+const std::string TRANSACTIONAL_STATE_SYMBOL("amqp:transactional-state:list");
+
+const uint64_t DECLARE_CODE(0x31);
+const uint64_t DISCHARGE_CODE(0x32);
+const uint64_t DECLARED_CODE(0x33);
+const uint64_t TRANSACTIONAL_STATE_CODE(0x34);
+}
+
namespace error_conditions {
//note these are not actually descriptors
const std::string INTERNAL_ERROR("amqp:internal-error");
@@ -113,6 +125,10 @@ const std::string NOT_IMPLEMENTED("amqp:
const std::string RESOURCE_LIMIT_EXCEEDED("amqp:resource-limit-exceeded");
const std::string RESOURCE_DELETED("amqp:resource-deleted");
const std::string PRECONDITION_FAILED("amqp:precondition-failed");
+namespace transaction {
+const std::string UNKNOWN_ID("amqp:transaction:unknown-id");
+const std::string ROLLBACK("amqp:transaction:rolback");
+}
}
}} // namespace qpid::amqp
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org