diff options
Diffstat (limited to 'cpp/lib/common')
| -rw-r--r-- | cpp/lib/common/framing/AMQFrame.cpp | 26 | ||||
| -rw-r--r-- | cpp/lib/common/framing/AMQFrame.h | 8 |
2 files changed, 14 insertions, 20 deletions
diff --git a/cpp/lib/common/framing/AMQFrame.cpp b/cpp/lib/common/framing/AMQFrame.cpp index 5eb76a87ee..2f1efcbe09 100644 --- a/cpp/lib/common/framing/AMQFrame.cpp +++ b/cpp/lib/common/framing/AMQFrame.cpp @@ -26,20 +26,16 @@ using namespace qpid::framing; AMQP_MethodVersionMap AMQFrame::versionMap; -// AMQP version management change - kpvdr 2-11-17 -// TODO: Make this class version-aware -AMQFrame::AMQFrame() {} - -// AMQP version management change - kpvdr 2006-11-17 -// TODO: Make this class version-aware -AMQFrame::AMQFrame(u_int16_t _channel, AMQBody* _body) : -channel(_channel), body(_body) +AMQFrame::AMQFrame(qpid::framing::ProtocolVersion& _version): +version(_version) + {} + +AMQFrame::AMQFrame(qpid::framing::ProtocolVersion& _version, u_int16_t _channel, AMQBody* _body) : +version(_version), channel(_channel), body(_body) {} -// AMQP version management change - kpvdr 2006-11-17 -// TODO: Make this class version-aware -AMQFrame::AMQFrame(u_int16_t _channel, AMQBody::shared_ptr& _body) : -channel(_channel), body(_body) +AMQFrame::AMQFrame(qpid::framing::ProtocolVersion& _version, u_int16_t _channel, AMQBody::shared_ptr& _body) : +version(_version), channel(_channel), body(_body) {} AMQFrame::~AMQFrame() {} @@ -64,11 +60,7 @@ void AMQFrame::encode(Buffer& buffer) AMQBody::shared_ptr AMQFrame::createMethodBody(Buffer& buffer){ u_int16_t classId = buffer.getShort(); u_int16_t methodId = buffer.getShort(); - // AMQP version management change - kpvdr 2006-11-16 - // TODO: Make this class version-aware and link these hard-wired numbers to that version - AMQBody::shared_ptr body(versionMap.createMethodBody(classId, methodId, 0, 9)); - // Origianl stmt: - // AMQBody::shared_ptr body(createAMQMethodBody(classId, methodId)); + AMQBody::shared_ptr body(versionMap.createMethodBody(classId, methodId, version.getMajor(), version.getMinor())); return body; } diff --git a/cpp/lib/common/framing/AMQFrame.h b/cpp/lib/common/framing/AMQFrame.h index 9962f85b62..ff27e1e68f 100644 --- a/cpp/lib/common/framing/AMQFrame.h +++ b/cpp/lib/common/framing/AMQFrame.h @@ -27,6 +27,7 @@ #include <AMQContentBody.h> #include <AMQHeartbeatBody.h> #include <AMQP_MethodVersionMap.h> +#include <AMQP_HighestVersion.h> #include <Buffer.h> #ifndef _AMQFrame_ @@ -39,6 +40,7 @@ namespace framing { class AMQFrame : virtual public AMQDataBlock { static AMQP_MethodVersionMap versionMap; + qpid::framing::ProtocolVersion version; u_int16_t channel; u_int8_t type;//used if the body is decoded separately from the 'head' @@ -46,9 +48,9 @@ class AMQFrame : virtual public AMQDataBlock AMQBody::shared_ptr createMethodBody(Buffer& buffer); public: - AMQFrame(); - AMQFrame(u_int16_t channel, AMQBody* body); - AMQFrame(u_int16_t channel, AMQBody::shared_ptr& body); + AMQFrame(qpid::framing::ProtocolVersion& _version = highestProtocolVersion); + AMQFrame(qpid::framing::ProtocolVersion& _version, u_int16_t channel, AMQBody* body); + AMQFrame(qpid::framing::ProtocolVersion& _version, u_int16_t channel, AMQBody::shared_ptr& body); virtual ~AMQFrame(); virtual void encode(Buffer& buffer); virtual bool decode(Buffer& buffer); |
