summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2006-11-22 16:57:35 +0000
committerKim van der Riet <kpvdr@apache.org>2006-11-22 16:57:35 +0000
commitd46ac2955c4871c9f22067f47490095e2c5f1806 (patch)
tree7e76ef7e4ca47e4cc57c83f7950bf97c3eceb210 /cpp/src/qpid/framing
parent018723f3889e9a1f63585dddba8eecff1d168501 (diff)
downloadqpid-python-d46ac2955c4871c9f22067f47490095e2c5f1806.tar.gz
Merged AMQP version-sensitive generated files with C++ trunk. Phase 1 of merge complete - all locations where version info is required in the framing, broker and client code, the version has been hard-coded to mahor=8, minor=0. Next step: make broker and client version-aware.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@478237 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing')
-rw-r--r--cpp/src/qpid/framing/AMQFrame.cpp36
-rw-r--r--cpp/src/qpid/framing/AMQFrame.h7
-rw-r--r--cpp/src/qpid/framing/AMQMethodBody.h5
-rw-r--r--cpp/src/qpid/framing/BasicHeaderProperties.h2
-rw-r--r--cpp/src/qpid/framing/amqp_framing.h4
5 files changed, 39 insertions, 15 deletions
diff --git a/cpp/src/qpid/framing/AMQFrame.cpp b/cpp/src/qpid/framing/AMQFrame.cpp
index ba6f4fe2de..b58bc93545 100644
--- a/cpp/src/qpid/framing/AMQFrame.cpp
+++ b/cpp/src/qpid/framing/AMQFrame.cpp
@@ -24,14 +24,23 @@
using namespace qpid::framing;
-AMQFrame::AMQFrame(){}
+// AMQP version management change - kpvdr 2006-11-17
+// TODO: Make this class version-aware and link these hard-wired numbers to that version
+AMQFrame::AMQFrame() : versionMap(8, 0) {}
-AMQFrame::AMQFrame(u_int16_t _channel, AMQBody* _body) : channel(_channel), body(_body){}
+// AMQP version management change - kpvdr 2006-11-17
+// TODO: Make this class version-aware and link these hard-wired numbers to that version
+AMQFrame::AMQFrame(u_int16_t _channel, AMQBody* _body) :
+channel(_channel), body(_body), versionMap(8, 0)
+{}
-AMQFrame::AMQFrame(u_int16_t _channel, AMQBody::shared_ptr& _body) : channel(_channel), body(_body){}
+// AMQP version management change - kpvdr 2006-11-17
+// TODO: Make this class version-aware and link these hard-wired numbers to that version
+AMQFrame::AMQFrame(u_int16_t _channel, AMQBody::shared_ptr& _body) :
+channel(_channel), body(_body), versionMap(8, 0)
+{}
-AMQFrame::~AMQFrame(){
-}
+AMQFrame::~AMQFrame() {}
u_int16_t AMQFrame::getChannel(){
return channel;
@@ -50,10 +59,14 @@ void AMQFrame::encode(Buffer& buffer)
buffer.putOctet(0xCE);
}
-AMQBody::shared_ptr createMethodBody(Buffer& buffer){
+AMQBody::shared_ptr AMQFrame::createMethodBody(Buffer& buffer){
u_int16_t classId = buffer.getShort();
u_int16_t methodId = buffer.getShort();
- AMQBody::shared_ptr body(createAMQMethodBody(classId, methodId));
+ // 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, 8, 0));
+ // Origianl stmt:
+ // AMQBody::shared_ptr body(createAMQMethodBody(classId, methodId));
return body;
}
@@ -108,10 +121,13 @@ void AMQFrame::decodeBody(Buffer& buffer, uint32_t bufSize)
body->decode(buffer, bufSize);
}
-std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t){
+std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t)
+{
out << "Frame[channel=" << t.channel << "; ";
- if (t.body.get() == 0) out << "empty";
- else out << *t.body;
+ if (t.body.get() == 0)
+ out << "empty";
+ else
+ out << *t.body;
out << "]";
return out;
}
diff --git a/cpp/src/qpid/framing/AMQFrame.h b/cpp/src/qpid/framing/AMQFrame.h
index bb1ecfac36..29ee1250e1 100644
--- a/cpp/src/qpid/framing/AMQFrame.h
+++ b/cpp/src/qpid/framing/AMQFrame.h
@@ -18,7 +18,7 @@
* under the License.
*
*/
-#include <qpid/framing/amqp_methods.h>
+/*#include <qpid/framing/amqp_methods.h>*/
#include <qpid/framing/amqp_types.h>
#include <qpid/framing/AMQBody.h>
#include <qpid/framing/AMQDataBlock.h>
@@ -26,6 +26,7 @@
#include <qpid/framing/AMQHeaderBody.h>
#include <qpid/framing/AMQContentBody.h>
#include <qpid/framing/AMQHeartbeatBody.h>
+#include <qpid/framing/AMQP_MethodVersionMap.h>
#include <qpid/framing/Buffer.h>
#ifndef _AMQFrame_
@@ -39,7 +40,9 @@ namespace qpid {
u_int16_t channel;
u_int8_t type;//used if the body is decoded separately from the 'head'
AMQBody::shared_ptr body;
-
+ AMQP_MethodVersionMap versionMap;
+ AMQBody::shared_ptr createMethodBody(Buffer& buffer);
+
public:
AMQFrame();
AMQFrame(u_int16_t channel, AMQBody* body);
diff --git a/cpp/src/qpid/framing/AMQMethodBody.h b/cpp/src/qpid/framing/AMQMethodBody.h
index 3f7a668e57..e6e592761e 100644
--- a/cpp/src/qpid/framing/AMQMethodBody.h
+++ b/cpp/src/qpid/framing/AMQMethodBody.h
@@ -35,9 +35,12 @@ class AMQMethodBody : virtual public AMQBody
public:
typedef boost::shared_ptr<AMQMethodBody> shared_ptr;
+ ProtocolVersion version;
inline u_int8_t type() const { return METHOD_BODY; }
inline u_int32_t size() const { return 4 + bodySize(); }
- inline virtual ~AMQMethodBody(){}
+ inline AMQMethodBody(u_int8_t major, u_int8_t minor) : version(major, minor) {}
+ inline AMQMethodBody(ProtocolVersion version) : version(version) {}
+ inline virtual ~AMQMethodBody() {}
virtual void print(std::ostream& out) const = 0;
virtual u_int16_t amqpMethodId() const = 0;
virtual u_int16_t amqpClassId() const = 0;
diff --git a/cpp/src/qpid/framing/BasicHeaderProperties.h b/cpp/src/qpid/framing/BasicHeaderProperties.h
index 3f5f1a10af..6dbfd55a5c 100644
--- a/cpp/src/qpid/framing/BasicHeaderProperties.h
+++ b/cpp/src/qpid/framing/BasicHeaderProperties.h
@@ -19,8 +19,8 @@
*
*/
#include <qpid/framing/amqp_types.h>
-#include <qpid/framing/amqp_methods.h>
#include <qpid/framing/Buffer.h>
+#include <qpid/framing/FieldTable.h>
#include <qpid/framing/HeaderProperties.h>
#ifndef _BasicHeaderProperties_
diff --git a/cpp/src/qpid/framing/amqp_framing.h b/cpp/src/qpid/framing/amqp_framing.h
index e266293003..6714eddf07 100644
--- a/cpp/src/qpid/framing/amqp_framing.h
+++ b/cpp/src/qpid/framing/amqp_framing.h
@@ -26,9 +26,11 @@
#include <qpid/framing/AMQHeaderBody.h>
#include <qpid/framing/AMQContentBody.h>
#include <qpid/framing/AMQHeartbeatBody.h>
-#include <qpid/framing/amqp_methods.h>
+#include <qpid/framing/AMQP_MethodVersionMap.h>
#include <qpid/framing/InputHandler.h>
#include <qpid/framing/OutputHandler.h>
#include <qpid/framing/InitiationHandler.h>
#include <qpid/framing/ProtocolInitiation.h>
#include <qpid/framing/BasicHeaderProperties.h>
+#include <qpid/framing/ProtocolVersion.h>
+#include <qpid/framing/ProtocolVersionException.h>