From c0e2b3586a64acbd2f2a46e3b79384cab76e6ddd Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 16 Oct 2006 13:50:26 +0000 Subject: Build system reorg, see README and Makefile comments for details. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@464494 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/common/framing/Makefile | 28 -- qpid/cpp/common/framing/generated/Makefile | 41 --- .../framing/generated/stylesheets/amqp_client.xsl | 155 -------- .../stylesheets/amqp_client_handler_impl.xsl | 187 ---------- .../stylesheets/amqp_client_operations.xsl | 105 ------ .../framing/generated/stylesheets/amqp_consts.xsl | 77 ---- .../framing/generated/stylesheets/amqp_server.xsl | 187 ---------- .../stylesheets/amqp_server_handler_impl.xsl | 187 ---------- .../stylesheets/amqp_server_operations.xsl | 113 ------ .../framing/generated/stylesheets/code_gen.xsl | 91 ----- .../framing/generated/stylesheets/code_utils.xsl | 210 ----------- .../framing/generated/stylesheets/convert_0.81.xsl | 407 --------------------- .../common/framing/generated/stylesheets/cpp.xsl | 315 ---------------- .../framing/generated/stylesheets/framing.xsl | 49 --- .../framing/generated/stylesheets/prepare1.xsl | 104 ------ .../framing/generated/stylesheets/prepare2.xsl | 54 --- .../framing/generated/stylesheets/prepare3.xsl | 54 --- .../framing/generated/stylesheets/registry.xsl | 12 - .../common/framing/generated/stylesheets/utils.xsl | 194 ---------- qpid/cpp/common/framing/inc/AMQBody.h | 48 --- qpid/cpp/common/framing/inc/AMQContentBody.h | 50 --- qpid/cpp/common/framing/inc/AMQDataBlock.h | 39 -- qpid/cpp/common/framing/inc/AMQFrame.h | 61 --- qpid/cpp/common/framing/inc/AMQHeaderBody.h | 57 --- qpid/cpp/common/framing/inc/AMQHeartbeatBody.h | 44 --- qpid/cpp/common/framing/inc/AMQMethodBody.h | 56 --- .../cpp/common/framing/inc/BasicHeaderProperties.h | 93 ----- qpid/cpp/common/framing/inc/BodyHandler.h | 51 --- qpid/cpp/common/framing/inc/Buffer.h | 78 ---- qpid/cpp/common/framing/inc/FieldTable.h | 78 ---- qpid/cpp/common/framing/inc/HeaderProperties.h | 43 --- qpid/cpp/common/framing/inc/InitiationHandler.h | 38 -- qpid/cpp/common/framing/inc/InputHandler.h | 38 -- qpid/cpp/common/framing/inc/OutputHandler.h | 38 -- qpid/cpp/common/framing/inc/ProtocolInitiation.h | 48 --- qpid/cpp/common/framing/inc/Value.h | 160 -------- qpid/cpp/common/framing/inc/amqp_framing.h | 31 -- qpid/cpp/common/framing/inc/amqp_types.h | 36 -- qpid/cpp/common/framing/src/AMQBody.cpp | 33 -- qpid/cpp/common/framing/src/AMQContentBody.cpp | 40 -- qpid/cpp/common/framing/src/AMQFrame.cpp | 115 ------ qpid/cpp/common/framing/src/AMQHeaderBody.cpp | 73 ---- qpid/cpp/common/framing/src/AMQHeartbeatBody.cpp | 26 -- qpid/cpp/common/framing/src/AMQMethodBody.cpp | 43 --- .../common/framing/src/BasicHeaderProperties.cpp | 100 ----- qpid/cpp/common/framing/src/BodyHandler.cpp | 51 --- qpid/cpp/common/framing/src/Buffer.cpp | 168 --------- qpid/cpp/common/framing/src/FieldTable.cpp | 147 -------- qpid/cpp/common/framing/src/InitiationHandler.cpp | 21 -- qpid/cpp/common/framing/src/InputHandler.cpp | 21 -- qpid/cpp/common/framing/src/OutputHandler.cpp | 21 -- qpid/cpp/common/framing/src/ProtocolInitiation.cpp | 53 --- qpid/cpp/common/framing/src/Value.cpp | 111 ------ qpid/cpp/common/framing/test/BodyHandlerTest.cpp | 103 ------ qpid/cpp/common/framing/test/Makefile | 21 -- qpid/cpp/common/framing/test/field_table_test.cpp | 52 --- qpid/cpp/common/framing/test/framing_test.cpp | 144 -------- qpid/cpp/common/framing/test/header_test.cpp | 141 ------- 58 files changed, 5141 deletions(-) delete mode 100644 qpid/cpp/common/framing/Makefile delete mode 100644 qpid/cpp/common/framing/generated/Makefile delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_client.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_client_handler_impl.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_client_operations.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_consts.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_server.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_server_handler_impl.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/amqp_server_operations.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/code_gen.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/code_utils.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/convert_0.81.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/cpp.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/framing.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/prepare1.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/prepare2.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/prepare3.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/registry.xsl delete mode 100644 qpid/cpp/common/framing/generated/stylesheets/utils.xsl delete mode 100644 qpid/cpp/common/framing/inc/AMQBody.h delete mode 100644 qpid/cpp/common/framing/inc/AMQContentBody.h delete mode 100644 qpid/cpp/common/framing/inc/AMQDataBlock.h delete mode 100644 qpid/cpp/common/framing/inc/AMQFrame.h delete mode 100644 qpid/cpp/common/framing/inc/AMQHeaderBody.h delete mode 100644 qpid/cpp/common/framing/inc/AMQHeartbeatBody.h delete mode 100644 qpid/cpp/common/framing/inc/AMQMethodBody.h delete mode 100644 qpid/cpp/common/framing/inc/BasicHeaderProperties.h delete mode 100644 qpid/cpp/common/framing/inc/BodyHandler.h delete mode 100644 qpid/cpp/common/framing/inc/Buffer.h delete mode 100644 qpid/cpp/common/framing/inc/FieldTable.h delete mode 100644 qpid/cpp/common/framing/inc/HeaderProperties.h delete mode 100644 qpid/cpp/common/framing/inc/InitiationHandler.h delete mode 100644 qpid/cpp/common/framing/inc/InputHandler.h delete mode 100644 qpid/cpp/common/framing/inc/OutputHandler.h delete mode 100644 qpid/cpp/common/framing/inc/ProtocolInitiation.h delete mode 100644 qpid/cpp/common/framing/inc/Value.h delete mode 100644 qpid/cpp/common/framing/inc/amqp_framing.h delete mode 100644 qpid/cpp/common/framing/inc/amqp_types.h delete mode 100644 qpid/cpp/common/framing/src/AMQBody.cpp delete mode 100644 qpid/cpp/common/framing/src/AMQContentBody.cpp delete mode 100644 qpid/cpp/common/framing/src/AMQFrame.cpp delete mode 100644 qpid/cpp/common/framing/src/AMQHeaderBody.cpp delete mode 100644 qpid/cpp/common/framing/src/AMQHeartbeatBody.cpp delete mode 100644 qpid/cpp/common/framing/src/AMQMethodBody.cpp delete mode 100644 qpid/cpp/common/framing/src/BasicHeaderProperties.cpp delete mode 100644 qpid/cpp/common/framing/src/BodyHandler.cpp delete mode 100644 qpid/cpp/common/framing/src/Buffer.cpp delete mode 100644 qpid/cpp/common/framing/src/FieldTable.cpp delete mode 100644 qpid/cpp/common/framing/src/InitiationHandler.cpp delete mode 100644 qpid/cpp/common/framing/src/InputHandler.cpp delete mode 100644 qpid/cpp/common/framing/src/OutputHandler.cpp delete mode 100644 qpid/cpp/common/framing/src/ProtocolInitiation.cpp delete mode 100644 qpid/cpp/common/framing/src/Value.cpp delete mode 100644 qpid/cpp/common/framing/test/BodyHandlerTest.cpp delete mode 100644 qpid/cpp/common/framing/test/Makefile delete mode 100644 qpid/cpp/common/framing/test/field_table_test.cpp delete mode 100644 qpid/cpp/common/framing/test/framing_test.cpp delete mode 100644 qpid/cpp/common/framing/test/header_test.cpp (limited to 'qpid/cpp/common/framing') diff --git a/qpid/cpp/common/framing/Makefile b/qpid/cpp/common/framing/Makefile deleted file mode 100644 index 1dfc286050..0000000000 --- a/qpid/cpp/common/framing/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2006 The Apache Software Foundation -# -# Licensed 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. -# - -.PHONY: all clean test - -all: - @$(MAKE) -C generated all - -test: - @$(MAKE) -C test all - -clean : - @$(MAKE) -C generated clean - @$(MAKE) -C test clean - diff --git a/qpid/cpp/common/framing/generated/Makefile b/qpid/cpp/common/framing/generated/Makefile deleted file mode 100644 index 12ec402760..0000000000 --- a/qpid/cpp/common/framing/generated/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 2006 The Apache Software Foundation -# -# Licensed 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. -# - -QPID_HOME = ../../../.. -include ${QPID_HOME}/cpp/options.mk - -STYLESHEET_DIR = stylesheets -JAVA = java -XSLTP = ${TOOLS_DIR}/saxon8.jar - -SPEC = ${SPEC_DIR}/amqp-8.0.xml -STYLESHEETS = $(wildcard stylesheets/*.xsl) - -GENERATED_SOURCES=amqp_methods.cpp # Seed generation - -.PHONY: all clean - -all: ${GENERATED_SOURCES} - -clean : - -@rm -f *.cpp *.h - -${GENERATED_SOURCES}: ${STYLESHEETS} ${SPEC} - ${JAVA} -jar ${XSLTP} -o results.out ${SPEC} ${STYLESHEET_DIR}/code_gen.xsl - ${JAVA} -jar ${XSLTP} -o results.out ${SPEC} ${STYLESHEET_DIR}/framing.xsl - --include $(GENERATED_SOURCES:.cpp=.d) - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_client.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_client.xsl deleted file mode 100644 index 13a912a926..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_client.xsl +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - -#ifndef _AMQP_ServerProxy_ -#define _AMQP_ServerProxy_ - -#include "AMQP_ServerOperations.h" -#include "FieldTable.h" -#include "OutputHandler.h" - -namespace qpid { -namespace framing { - -class AMQP_ServerProxy : virtual public AMQP_ServerOperations -{ - OutputHandler* out; - - public: - AMQP_ServerProxy(OutputHandler* _out); - virtual ~AMQP_ServerProxy() {} - - - - /** ===== Class: ===== - - */ - - class : virtual public AMQP_ServerOperations::Handler - { - OutputHandler* out; - - public: - /* Constructors and destructors */ - (OutputHandler* _out); - virtual ~(); - - /* Protocol methods */ - - - - - /** ----- Method: . ----- - - */ - - - /** - Rule "": - */ - - virtual void - ( u_int16_t channel, - - - - - , - - - - ); - - - }; /* class */ - - }; /* class AMQP_ServerProxy */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - - - - - - - - -#include "AMQP_ServerProxy.h" - -namespace qpid { -namespace framing { - -AMQP_ServerProxy::AMQP_ServerProxy(OutputHandler* _out) : - out(_out) -{ -} - - - /* ++++++++++ Class: ++++++++++ */ - -AMQP_ServerProxy::::(OutputHandler* _out) : - out(_out) -{ -} - -AMQP_ServerProxy::::~() {} - - - void AMQP_ServerProxy:::: - ( u_int16_t channel - , - - - - - , - - - - ) -{ - out->send( new AMQFrame( channel, - new ( - - - - , - - - ) ) ); -} - - - - - -} /* namespace framing */ -} /* namespace qpid */ - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_client_handler_impl.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_client_handler_impl.xsl deleted file mode 100644 index 0cc34e0ecf..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_client_handler_impl.xsl +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - -#ifndef _AMQP_ClientHandlerImpl_ -#define _AMQP_ClientHandlerImpl_ - -#include "AMQP_ClientOperations.h" -#include "FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ClientHandlerImpl : virtual public AMQP_ClientOperations -{ - - - - - AMQP_ClientOperations::* - Ptr; - - - public: - AMQP_ClientHandlerImpl(); - virtual ~AMQP_ClientHandlerImpl(); - - - - - inline AMQP_ClientOperations:: - * get - () { return Ptr; } - - - - - - - - - - /** - ===== Class: Impl ===== - - */ - - - - class - Impl : virtual public AMQP_ClientOperations:: - { - public: - /* Constructors and destructors */ - Impl(); - virtual ~Impl(); - - /* Protocol methods */ - - - - - - - - - /** - ----- Method: - Impl. ----- - - */ - - - /** - Rule "": - - */ - - - - virtual void - ( u_int16_t channel - - - - , - - - - - , - - - - ); - - - }; /* class Impl */ - - }; /* AMQP_ClientHandlerImpl */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - - - - - - -#include "AMQP_ClientHandlerImpl.h" - -namespace qpid { -namespace framing { - -AMQP_ClientHandlerImpl::AMQP_ClientHandlerImpl() : - - - - HandlerPtr( new HandlerImpl() ) - - , - - - -{ -} - -AMQP_ClientHandlerImpl::~AMQP_ClientHandlerImpl() -{ - - delete HandlerPtr; - } - - - - /* ===== Class: HandlerImpl ===== */ - AMQP_ClientHandlerImpl::HandlerImpl:: - HandlerImpl() { } - AMQP_ClientHandlerImpl::HandlerImpl::~ - HandlerImpl() { } - - - void AMQP_ClientHandlerImpl::HandlerImpl:: - ( u_int16_t /*channel*/ - - , - - - - - , - - - ) { } - - - - - -} /* namespace framing */ -} /* namespace qpid */ - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_client_operations.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_client_operations.xsl deleted file mode 100644 index 234b7080ba..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_client_operations.xsl +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - -#ifndef _AMQP_ClientOperations_ -#define _AMQP_ClientOperations_ - -#include "AMQP_Constants.h" -#include "FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ClientOperations -{ - public: - AMQP_ClientOperations() {} - virtual ~AMQP_ClientOperations() {} - inline u_int16_t getAmqpMajor() { return (u_int16_t); } - inline u_int16_t getAmqpMinor() { return (u_int16_t); } - - - - - - - - /** ===== Class: ===== - - */ - - - - class - { - public: - /* Constructors and destructors */ - () {} - virtual ~() {} - - /* Protocol methods */ - - - - - - - - - /** ----- Method: . - ----- - - */ - - - /** - Rule "": - - */ - - - - virtual void - ( u_int16_t channel - - - - , - - - - - , - - - - ) = 0; - - - }; /* class */ - - }; /* class AMQP_ClientOperations */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_consts.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_consts.xsl deleted file mode 100644 index c1c927f941..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_consts.xsl +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#ifndef _AMQP_Constants_ -#define _AMQP_Constants_ - -#include "amqp_types.h" - -namespace qpid { -namespace framing { - -/**** Constants ****/ - - - /* - - */ - - const u_int16_t ; - - - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_server.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_server.xsl deleted file mode 100644 index 5ff8994888..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_server.xsl +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - -#ifndef _AMQP_ClientProxy_ -#define _AMQP_ClientProxy_ - -#include "AMQP_ClientOperations.h" -#include "FieldTable.h" -#include "OutputHandler.h" - -namespace qpid { -namespace framing { - -class AMQP_ClientProxy : virtual public AMQP_ClientOperations -{ - public: - - AMQP_ClientProxy(OutputHandler* _out); - virtual ~AMQP_ClientProxy() {}; - - - - - - /** ===== Class: ===== - - */ - - class : virtual public AMQP_ClientOperations::Handler - { - OutputHandler* out; - - public: - /* Constructors and destructors */ - (OutputHandler* _out); - virtual ~(); - - /* Protocol methods */ - - - - - /** ----- Method: . ----- - - */ - - - /** - Rule "": - */ - - virtual void - ( u_int16_t channel, - - - - - , - - - - ); - - - }; /* class */ - - - - - ; - - - private: - - OutputHandler* out; - - - - ; - - - - - }; /* class AMQP_ClientProxy */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - - - - - - - -#include "AMQP_ClientProxy.h" - -namespace qpid { -namespace framing { - -AMQP_ClientProxy::AMQP_ClientProxy(OutputHandler* _out) : - out(_out), - - - - , - - - -{ -} - - - - /* ++++++++++ Class: ++++++++++ */ - -AMQP_ClientProxy::::(OutputHandler* _out) : - out(_out) -{ -} - -AMQP_ClientProxy::::~() {} - - - void AMQP_ClientProxy:::: - ( u_int16_t channel - , - - - - - , - - - - ) -{ - out->send( new AMQFrame( channel, - new ( - - - - , - - - ) ) ); -} - - - - - - - { - ; - } - - - - -} /* namespace framing */ -} /* namespace qpid */ - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_server_handler_impl.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_server_handler_impl.xsl deleted file mode 100644 index 6450d3fd0c..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_server_handler_impl.xsl +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - -#ifndef _AMQP_ServerHandlerImpl_ -#define _AMQP_ServerHandlerImpl_ - -#include "AMQP_ServerOperations.h" -#include "FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ServerHandlerImpl : virtual public AMQP_ServerOperations -{ - - - - - AMQP_ServerOperations::* - Ptr; - - - public: - AMQP_ServerHandlerImpl(); - virtual ~AMQP_ServerHandlerImpl(); - - - - - virtual inline AMQP_ServerOperations:: - * get - () { return Ptr; } - - - - - - - - - - /** - ===== Class: Impl ===== - - */ - - - - class - Impl : virtual public AMQP_ServerOperations:: - { - public: - /* Constructors and destructors */ - Impl(); - virtual ~Impl(); - - /* Protocol methods */ - - - - - - - - - /** - ----- Method: - Impl. ----- - - */ - - - /** - Rule "": - - */ - - - - virtual void - ( u_int16_t channel - - - - , - - - - - , - - - - ); - - - }; /* class Impl */ - - }; /* AMQP_ServerHandlerImpl */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - - - - - - -#include "AMQP_ServerHandlerImpl.h" - -namespace qpid { -namespace framing { - -AMQP_ServerHandlerImpl::AMQP_ServerHandlerImpl() : - - - - HandlerPtr( new HandlerImpl() ) - - , - - - -{ -} - -AMQP_ServerHandlerImpl::~AMQP_ServerHandlerImpl() -{ - - delete HandlerPtr; - } - - - - /* ===== Class: HandlerImpl ===== */ - AMQP_ServerHandlerImpl::HandlerImpl:: - HandlerImpl() { } - AMQP_ServerHandlerImpl::HandlerImpl::~ - HandlerImpl() { } - - - void AMQP_ServerHandlerImpl::HandlerImpl:: - ( u_int16_t /*channel*/ - - , - - - - - , - - - ) { } - - - - - -} /* namespace framing */ -} /* namespace qpid */ - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/amqp_server_operations.xsl b/qpid/cpp/common/framing/generated/stylesheets/amqp_server_operations.xsl deleted file mode 100644 index 4b97700f04..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/amqp_server_operations.xsl +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - -#ifndef _AMQP_ServerOperations_ -#define _AMQP_ServerOperations_ - -#include "AMQP_Constants.h" -#include "FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ServerOperations -{ - public: - AMQP_ServerOperations() {} - virtual ~AMQP_ServerOperations() {} - inline u_int16_t getAmqpMajor() { return (u_int16_t); } - inline u_int16_t getAmqpMinor() { return (u_int16_t); } - - - - - - - - /** ===== Class: ===== - - */ - - - - class - { - public: - /* Constructors and destructors */ - () {} - virtual ~() {} - - /* Protocol methods */ - - - - - - - - - /** ----- Method: . - ----- - - */ - - - /** - Rule "": - - */ - - - - virtual void - ( u_int16_t channel - - - - , - - - - - , - - - - ) = 0; - - - }; /* class */ - - - - - virtual AMQP_ServerOperations:: - * get - () = 0; - - - }; /* class AMQP_ServerOperations */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/code_gen.xsl b/qpid/cpp/common/framing/generated/stylesheets/code_gen.xsl deleted file mode 100644 index 5e9f4ef8f0..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/code_gen.xsl +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/code_utils.xsl b/qpid/cpp/common/framing/generated/stylesheets/code_utils.xsl deleted file mode 100644 index f4a0f6e5ce..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/code_utils.xsl +++ /dev/null @@ -1,210 +0,0 @@ - - - - - /** -* -* Copyright (c) 2006 The Apache Software Foundation -* -* Licensed 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. -* -*/ - -/** -* -* NOTE: This file is generated directly from the AMQP XML specification. -* === DO NOT EDIT === -* -*/ - - - - - - - - - - - - - delete_ - return_ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u_int8_t - u_int16_t - string - string - bool - u_int32_t - u_int64_t - u_int64_t - - FieldTable - - unknown_type /* WARNING: undefined type */ - - - - - - - - & - & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/convert_0.81.xsl b/qpid/cpp/common/framing/generated/stylesheets/convert_0.81.xsl deleted file mode 100644 index 9924f165da..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/convert_0.81.xsl +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ==================== - Constants - ==================== - - - - - - - - - - ==================== - Domains - ==================== - - - - - - - - - Elementary domains - - bit - bit - single bit - - - octet - octet - single octet - - - short - short - 16-bit integer - - - long - long - 32-bit integer - - - longlong - longlong - 64-bit integer - - - shortstr - shortstr - short string - - - longstr - longstr - long string - - - timestamp - timestamp - 64-bit timestamp - - - table - table - field table - - - - - - ==================== - Classes - ==================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -rule__ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -doc_rule__ - - - - - - - - - - - -grammar - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/cpp.xsl b/qpid/cpp/common/framing/generated/stylesheets/cpp.xsl deleted file mode 100644 index f9e5ba4141..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/cpp.xsl +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - - - - - - - - - - - - - -#include "amqp_framing.h" - - - - - - - - - - - - -#include "amqp_types.h" -#include "AMQP_ServerOperations.h" -#include "AMQMethodBody.h" -#include "Buffer.h" -#include "FieldTable.h" - -#ifndef __ -#define __ - -namespace qpid { -namespace framing { - - - - -} -} - -#endif - - - - - - - - -/** - * This class is autogenerated, do not modify. [From ] - */ -class : virtual public AMQMethodBody -{ - - - - ; - - -public: - typedef std::tr1::shared_ptr<> shared_ptr; - - virtual ~() {} - - - inline ; } - - - - inline void print(std::ostream& out) const{ - out << "" - - << ", - ="<< - - - ; - } - - inline u_int16_t amqpClassId() const { - return ; - } - - inline u_int16_t amqpMethodId() const { - return ; - } - - inline u_int32_t bodySize() const { - - - return - - + - - - - ; - - return 0; - - } - - - inline void invoke(AMQP_ServerOperations& target, u_int16_t channel) { - - - ); - - - ; - - } - - - inline void encodeContent(Buffer& buffer) const - { - - u_int8_t flags = 0; - - ; - - - - - ; - - - buffer.putOctet(flags); - - - } - - inline void decodeContent(Buffer& buffer) - { - - - - u_int8_t flags = buffer.getOctet(); - ; - - - ; - - - - } - - - - inline () : - { - } - - - inline () - { - } -}; - - - - - -/** - * This file is autogenerated, do not modify. - */ - -#ifndef AMQ_METHODS_H -#define AMQ_METHODS_H - - -#include ".h" - - -namespace qpid { -namespace framing { - - -const ; - - -AMQMethodBody* createAMQMethodBody(u_int16_t classId, u_int16_t methodId); - -} -} - -#endif - - - - - -#include "amqp_methods.h" -#include "QpidError.h" - -namespace qpid { -namespace framing { -/** - * This method is autogenerated, do not modify. - */ -AMQMethodBody* createAMQMethodBody(u_int16_t classId, u_int16_t methodId){ - switch(classId * 1000 + methodId) - { - - case - - * 1000 + - - : return new - (); - - } - THROW_QPID_ERROR(FRAMING_ERROR, "Unknown method"); -} - -} -} - - - - - -#include "amqp_types.h" -#include "FieldTable.h" - -#ifndef _AMQPServer_ -#define _AMQPServer_ - -namespace qpid { -namespace framing { - -class AMQPServer -{ - public: - - - class { - public: - - - virtual void (u_int16_t channel, ) = 0; - - - virtual void (u_int16_t channel) = 0; - - - virtual ~(){} - }; - - virtual () = 0; - - - virtual ~AMQPServer(){} -}; - -} -} - -#endif - - - -#include "amqp_types.h" -#include "FieldTable.h" - -#ifndef _AMQPClient_ -#define _AMQPClient_ - -namespace qpid { -namespace framing { - -class AMQPClient -{ - public: - - - class { - public: - - - virtual void (u_int16_t channel, ) = 0; - - - virtual void (u_int16_t channel) = 0; - - - virtual ~(){} - }; - - virtual () = 0; - - - - virtual ~AMQPClient(){} -}; - -} -} - -#endif - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/framing.xsl b/qpid/cpp/common/framing/generated/stylesheets/framing.xsl deleted file mode 100644 index c63e719a77..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/framing.xsl +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/prepare1.xsl b/qpid/cpp/common/framing/generated/stylesheets/prepare1.xsl deleted file mode 100644 index 2aeda89677..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/prepare1.xsl +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - ( - major= - , minor= - ) - - - - - - - - - - - - - - - - - - - - - - - - Could not inherit from ; file not found. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/prepare2.xsl b/qpid/cpp/common/framing/generated/stylesheets/prepare2.xsl deleted file mode 100644 index 331319de57..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/prepare2.xsl +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/prepare3.xsl b/qpid/cpp/common/framing/generated/stylesheets/prepare3.xsl deleted file mode 100644 index 27a4764e4f..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/prepare3.xsl +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/registry.xsl b/qpid/cpp/common/framing/generated/stylesheets/registry.xsl deleted file mode 100644 index a818a0a871..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/registry.xsl +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/generated/stylesheets/utils.xsl b/qpid/cpp/common/framing/generated/stylesheets/utils.xsl deleted file mode 100644 index 70743112a9..0000000000 --- a/qpid/cpp/common/framing/generated/stylesheets/utils.xsl +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - u_int8_t - u_int16_t - string - string - bool - u_int32_t - u_int64_t - FieldTable - Object /*WARNING: undefined type*/ - - - - - - u_int8_t - u_int16_t - const string& - const string& - bool - u_int32_t - u_int64_t - FieldTable& - Object /*WARNING: undefined type*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* WARNING: COULD NOT DETERMINE FIELD SIZE */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* WARNING: COULD NOT DETERMINE ENCODER */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* WARNING: COULD NOT DETERMINE DECODER */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/common/framing/inc/AMQBody.h b/qpid/cpp/common/framing/inc/AMQBody.h deleted file mode 100644 index a1770820a9..0000000000 --- a/qpid/cpp/common/framing/inc/AMQBody.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "memory.h" -#include "amqp_types.h" -#include "Buffer.h" - -#ifndef _AMQBody_ -#define _AMQBody_ - -namespace qpid { - namespace framing { - - class AMQBody - { - public: - typedef std::tr1::shared_ptr shared_ptr; - - virtual ~AMQBody(); - virtual u_int32_t size() const = 0; - virtual u_int8_t type() const = 0; - virtual void encode(Buffer& buffer) const = 0; - virtual void decode(Buffer& buffer, u_int32_t size) = 0; - virtual void print(std::ostream& out) const; - }; - - std::ostream& operator<<(std::ostream& out, const AMQBody& body) ; - - enum body_types {METHOD_BODY = 1, HEADER_BODY = 2, CONTENT_BODY = 3, HEARTBEAT_BODY = 8}; - } -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQContentBody.h b/qpid/cpp/common/framing/inc/AMQContentBody.h deleted file mode 100644 index daf7d6cd44..0000000000 --- a/qpid/cpp/common/framing/inc/AMQContentBody.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "AMQBody.h" -#include "Buffer.h" - -#ifndef _AMQContentBody_ -#define _AMQContentBody_ - -namespace qpid { -namespace framing { - -class AMQContentBody : virtual public AMQBody -{ - string data; - -public: - typedef std::tr1::shared_ptr shared_ptr; - - AMQContentBody(); - AMQContentBody(const string& data); - inline virtual ~AMQContentBody(){} - inline u_int8_t type() const { return CONTENT_BODY; }; - inline string& getData(){ return data; } - u_int32_t size() const; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer, u_int32_t size); - void print(std::ostream& out) const; -}; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQDataBlock.h b/qpid/cpp/common/framing/inc/AMQDataBlock.h deleted file mode 100644 index 6c47c78864..0000000000 --- a/qpid/cpp/common/framing/inc/AMQDataBlock.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "Buffer.h" - -#ifndef _AMQDataBlock_ -#define _AMQDataBlock_ - -namespace qpid { -namespace framing { - -class AMQDataBlock -{ -public: - virtual ~AMQDataBlock() {} - virtual void encode(Buffer& buffer) = 0; - virtual bool decode(Buffer& buffer) = 0; - virtual u_int32_t size() const = 0; -}; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQFrame.h b/qpid/cpp/common/framing/inc/AMQFrame.h deleted file mode 100644 index 5656d20377..0000000000 --- a/qpid/cpp/common/framing/inc/AMQFrame.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_methods.h" -#include "amqp_types.h" -#include "AMQBody.h" -#include "AMQDataBlock.h" -#include "AMQMethodBody.h" -#include "AMQHeaderBody.h" -#include "AMQContentBody.h" -#include "AMQHeartbeatBody.h" -#include "Buffer.h" - -#ifndef _AMQFrame_ -#define _AMQFrame_ - -namespace qpid { - namespace framing { - - class AMQFrame : virtual public AMQDataBlock - { - u_int16_t channel; - u_int8_t type;//used if the body is decoded separately from the 'head' - AMQBody::shared_ptr body; - - public: - AMQFrame(); - AMQFrame(u_int16_t channel, AMQBody* body); - AMQFrame(u_int16_t channel, AMQBody::shared_ptr& body); - virtual ~AMQFrame(); - virtual void encode(Buffer& buffer); - virtual bool decode(Buffer& buffer); - virtual u_int32_t size() const; - u_int16_t getChannel(); - AMQBody::shared_ptr& getBody(); - - u_int32_t decodeHead(Buffer& buffer); - void decodeBody(Buffer& buffer, uint32_t size); - - friend std::ostream& operator<<(std::ostream& out, const AMQFrame& body); - }; - - } -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQHeaderBody.h b/qpid/cpp/common/framing/inc/AMQHeaderBody.h deleted file mode 100644 index 4f9cdb571a..0000000000 --- a/qpid/cpp/common/framing/inc/AMQHeaderBody.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "AMQBody.h" -#include "Buffer.h" -#include "HeaderProperties.h" - -#ifndef _AMQHeaderBody_ -#define _AMQHeaderBody_ - -namespace qpid { -namespace framing { - -class AMQHeaderBody : virtual public AMQBody -{ - HeaderProperties* properties; - u_int16_t weight; - u_int64_t contentSize; - - void createProperties(int classId); -public: - typedef std::tr1::shared_ptr shared_ptr; - - AMQHeaderBody(int classId); - AMQHeaderBody(); - inline u_int8_t type() const { return HEADER_BODY; } - HeaderProperties* getProperties(){ return properties; } - const HeaderProperties* getProperties() const { return properties; } - inline u_int64_t getContentSize() const { return contentSize; } - inline void setContentSize(u_int64_t _size) { contentSize = _size; } - virtual ~AMQHeaderBody(); - virtual u_int32_t size() const; - virtual void encode(Buffer& buffer) const; - virtual void decode(Buffer& buffer, u_int32_t size); - virtual void print(std::ostream& out) const; -}; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQHeartbeatBody.h b/qpid/cpp/common/framing/inc/AMQHeartbeatBody.h deleted file mode 100644 index da612a2a44..0000000000 --- a/qpid/cpp/common/framing/inc/AMQHeartbeatBody.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "AMQBody.h" -#include "Buffer.h" - -#ifndef _AMQHeartbeatBody_ -#define _AMQHeartbeatBody_ - -namespace qpid { -namespace framing { - -class AMQHeartbeatBody : virtual public AMQBody -{ -public: - typedef std::tr1::shared_ptr shared_ptr; - - virtual ~AMQHeartbeatBody(); - inline u_int32_t size() const { return 0; } - inline u_int8_t type() const { return HEARTBEAT_BODY; } - inline void encode(Buffer& ) const {} - inline void decode(Buffer& , u_int32_t /*size*/) {} - virtual void print(std::ostream& out) const; -}; - -} -} - -#endif diff --git a/qpid/cpp/common/framing/inc/AMQMethodBody.h b/qpid/cpp/common/framing/inc/AMQMethodBody.h deleted file mode 100644 index 59d5dd5212..0000000000 --- a/qpid/cpp/common/framing/inc/AMQMethodBody.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include "amqp_types.h" -#include "AMQBody.h" -#include "Buffer.h" -#include "AMQP_ServerOperations.h" - -#ifndef _AMQMethodBody_ -#define _AMQMethodBody_ - -namespace qpid { -namespace framing { - -class AMQMethodBody : virtual public AMQBody -{ -public: - typedef std::tr1::shared_ptr shared_ptr; - - inline u_int8_t type() const { return METHOD_BODY; } - inline u_int32_t size() const { return 4 + bodySize(); } - 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; - virtual void invoke(AMQP_ServerOperations& target, u_int16_t channel); - virtual void encodeContent(Buffer& buffer) const = 0; - virtual void decodeContent(Buffer& buffer) = 0; - virtual u_int32_t bodySize() const = 0; - void encode(Buffer& buffer) const; - void decode(Buffer& buffer, u_int32_t size); - bool match(AMQMethodBody* other) const; -}; - -std::ostream& operator<<(std::ostream& out, const AMQMethodBody& body); - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/BasicHeaderProperties.h b/qpid/cpp/common/framing/inc/BasicHeaderProperties.h deleted file mode 100644 index c32612221b..0000000000 --- a/qpid/cpp/common/framing/inc/BasicHeaderProperties.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "amqp_methods.h" -#include "Buffer.h" -#include "HeaderProperties.h" - -#ifndef _BasicHeaderProperties_ -#define _BasicHeaderProperties_ - -namespace qpid { -namespace framing { - - //TODO: This could be easily generated from the spec - class BasicHeaderProperties : public HeaderProperties - { - string contentType; - string contentEncoding; - FieldTable headers; - u_int8_t deliveryMode; - u_int8_t priority; - string correlationId; - string replyTo; - string expiration; - string messageId; - u_int64_t timestamp; - string type; - string userId; - string appId; - string clusterId; - - u_int16_t getFlags() const; - - public: - BasicHeaderProperties(); - virtual ~BasicHeaderProperties(); - virtual u_int32_t size() const; - virtual void encode(Buffer& buffer) const; - virtual void decode(Buffer& buffer, u_int32_t size); - - inline virtual u_int8_t classId(){ return BASIC; } - - inline string& getContentType(){ return contentType; } - inline string& getContentEncoding(){ return contentEncoding; } - inline FieldTable& getHeaders(){ return headers; } - inline u_int8_t getDeliveryMode(){ return deliveryMode; } - inline u_int8_t getPriority(){ return priority; } - inline string& getCorrelationId(){return correlationId; } - inline string& getReplyTo(){ return replyTo; } - inline string& getExpiration(){ return expiration; } - inline string& getMessageId(){return messageId; } - inline u_int64_t getTimestamp(){ return timestamp; } - inline string& getType(){ return type; } - inline string& getUserId(){ return userId; } - inline string& getAppId(){ return appId; } - inline string& getClusterId(){ return clusterId; } - - void inline setContentType(string& _type){ contentType = _type; } - void inline setContentEncoding(string& encoding){ contentEncoding = encoding; } - void inline setHeaders(FieldTable& _headers){ headers = _headers; } - void inline setDeliveryMode(u_int8_t mode){ deliveryMode = mode; } - void inline setPriority(u_int8_t _priority){ priority = _priority; } - void inline setCorrelationId(string& _correlationId){ correlationId = _correlationId; } - void inline setReplyTo(string& _replyTo){ replyTo = _replyTo;} - void inline setExpiration(string& _expiration){ expiration = _expiration; } - void inline setMessageId(string& _messageId){ messageId = _messageId; } - void inline setTimestamp(u_int64_t _timestamp){ timestamp = _timestamp; } - void inline setType(string& _type){ type = _type; } - void inline setUserId(string& _userId){ userId = _userId; } - void inline setAppId(string& _appId){appId = _appId; } - void inline setClusterId(string& _clusterId){ clusterId = _clusterId; } - }; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/BodyHandler.h b/qpid/cpp/common/framing/inc/BodyHandler.h deleted file mode 100644 index a4aee2709e..0000000000 --- a/qpid/cpp/common/framing/inc/BodyHandler.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 - -#ifndef _BodyHandler_ -#define _BodyHandler_ - -#include "AMQMethodBody.h" -#include "AMQHeaderBody.h" -#include "AMQContentBody.h" -#include "AMQHeartbeatBody.h" - -namespace qpid { -namespace framing { - - class BodyHandler{ - public: - virtual ~BodyHandler(); - virtual void handleMethod(AMQMethodBody::shared_ptr body) = 0; - virtual void handleHeader(AMQHeaderBody::shared_ptr body) = 0; - virtual void handleContent(AMQContentBody::shared_ptr body) = 0; - virtual void handleHeartbeat(AMQHeartbeatBody::shared_ptr body) = 0; - - void handleBody(AMQBody::shared_ptr& body); - }; - - class UnknownBodyType{ - public: - const u_int16_t type; - inline UnknownBodyType(u_int16_t _type) : type(_type){} - }; -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/Buffer.h b/qpid/cpp/common/framing/inc/Buffer.h deleted file mode 100644 index 4d3d503b00..0000000000 --- a/qpid/cpp/common/framing/inc/Buffer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" - -#ifndef _Buffer_ -#define _Buffer_ - -namespace qpid { -namespace framing { - -class FieldTable; - -class Buffer -{ - const u_int32_t size; - char* data; - u_int32_t position; - u_int32_t limit; - u_int32_t r_position; - u_int32_t r_limit; - -public: - - Buffer(u_int32_t size); - ~Buffer(); - - void flip(); - void clear(); - void compact(); - void record(); - void restore(); - u_int32_t available(); - char* start(); - void move(u_int32_t bytes); - - void putOctet(u_int8_t i); - void putShort(u_int16_t i); - void putLong(u_int32_t i); - void putLongLong(u_int64_t i); - - u_int8_t getOctet(); - u_int16_t getShort(); - u_int32_t getLong(); - u_int64_t getLongLong(); - - void putShortString(const string& s); - void putLongString(const string& s); - void getShortString(string& s); - void getLongString(string& s); - - void putFieldTable(const FieldTable& t); - void getFieldTable(FieldTable& t); - - void putRawData(const string& s); - void getRawData(string& s, u_int32_t size); - -}; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/FieldTable.h b/qpid/cpp/common/framing/inc/FieldTable.h deleted file mode 100644 index 7da914968e..0000000000 --- a/qpid/cpp/common/framing/inc/FieldTable.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include -#include -#include -#include "amqp_types.h" - -#ifndef _FieldTable_ -#define _FieldTable_ - -namespace qpid { -namespace framing { - -class Value; -class Buffer; - -class FieldTable -{ - public: - typedef std::tr1::shared_ptr ValuePtr; - typedef std::tr1::unordered_map ValueMap; - - ~FieldTable(); - u_int32_t size() const; - int count() const; - void setString(const std::string& name, const std::string& value); - void setInt(const std::string& name, int value); - void setTimestamp(const std::string& name, u_int64_t value); - void setTable(const std::string& name, const FieldTable& value); - //void setDecimal(string& name, xxx& value); - std::string getString(const std::string& name) const; - int getInt(const std::string& name) const; - u_int64_t getTimestamp(const std::string& name) const; - void getTable(const std::string& name, FieldTable& value) const; - //void getDecimal(string& name, xxx& value); - void erase(const std::string& name); - - void encode(Buffer& buffer) const; - void decode(Buffer& buffer); - - bool operator==(const FieldTable& other) const; - - // TODO aconway 2006-09-26: Yeuch! Rework FieldTable to have - // a map-like interface. - const ValueMap& getMap() const { return values; } - ValueMap& getMap() { return values; } - - - private: - friend std::ostream& operator<<(std::ostream& out, const FieldTable& body); - ValueMap values; - template T getValue(const std::string& name) const; -}; - -class FieldNotFoundException{}; -class UnknownFieldName : public FieldNotFoundException{}; -class IncorrectFieldType : public FieldNotFoundException{}; -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/HeaderProperties.h b/qpid/cpp/common/framing/inc/HeaderProperties.h deleted file mode 100644 index f84345c203..0000000000 --- a/qpid/cpp/common/framing/inc/HeaderProperties.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "Buffer.h" - -#ifndef _HeaderProperties_ -#define _HeaderProperties_ - -namespace qpid { -namespace framing { - - enum header_classes{BASIC = 60}; - - class HeaderProperties - { - - public: - inline virtual ~HeaderProperties(){} - virtual u_int8_t classId() = 0; - virtual u_int32_t size() const = 0; - virtual void encode(Buffer& buffer) const = 0; - virtual void decode(Buffer& buffer, u_int32_t size) = 0; - }; -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/InitiationHandler.h b/qpid/cpp/common/framing/inc/InitiationHandler.h deleted file mode 100644 index 7b1fb36e2d..0000000000 --- a/qpid/cpp/common/framing/inc/InitiationHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 - -#ifndef _InitiationHandler_ -#define _InitiationHandler_ - -#include "ProtocolInitiation.h" - -namespace qpid { -namespace framing { - - class InitiationHandler{ - public: - virtual ~InitiationHandler(); - virtual void initiated(ProtocolInitiation* header) = 0; - }; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/InputHandler.h b/qpid/cpp/common/framing/inc/InputHandler.h deleted file mode 100644 index 927bd97ab4..0000000000 --- a/qpid/cpp/common/framing/inc/InputHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 - -#ifndef _InputHandler_ -#define _InputHandler_ - -#include "AMQFrame.h" - -namespace qpid { -namespace framing { - - class InputHandler{ - public: - virtual ~InputHandler(); - virtual void received(AMQFrame* frame) = 0; - }; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/OutputHandler.h b/qpid/cpp/common/framing/inc/OutputHandler.h deleted file mode 100644 index afc8d7f257..0000000000 --- a/qpid/cpp/common/framing/inc/OutputHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 - -#ifndef _OutputHandler_ -#define _OutputHandler_ - -#include "AMQFrame.h" - -namespace qpid { -namespace framing { - - class OutputHandler{ - public: - virtual ~OutputHandler(); - virtual void send(AMQFrame* frame) = 0; - }; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/ProtocolInitiation.h b/qpid/cpp/common/framing/inc/ProtocolInitiation.h deleted file mode 100644 index ab9734e6b3..0000000000 --- a/qpid/cpp/common/framing/inc/ProtocolInitiation.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "Buffer.h" -#include "AMQDataBlock.h" - -#ifndef _ProtocolInitiation_ -#define _ProtocolInitiation_ - -namespace qpid { -namespace framing { - -class ProtocolInitiation : virtual public AMQDataBlock -{ - u_int8_t pmajor; - u_int8_t pminor; - -public: - ProtocolInitiation(); - ProtocolInitiation(u_int8_t major, u_int8_t minor); - virtual ~ProtocolInitiation(); - virtual void encode(Buffer& buffer); - virtual bool decode(Buffer& buffer); - inline virtual u_int32_t size() const { return 8; } - inline u_int8_t getMajor(){ return pmajor; } - inline u_int8_t getMinor(){ return pminor; } -}; - -} -} - - -#endif diff --git a/qpid/cpp/common/framing/inc/Value.h b/qpid/cpp/common/framing/inc/Value.h deleted file mode 100644 index fe939e8758..0000000000 --- a/qpid/cpp/common/framing/inc/Value.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include -#include "amqp_types.h" -#include "FieldTable.h" - -#ifndef _Value_ -#define _Value_ - -namespace qpid { -namespace framing { - -class Buffer; - -/** - * Represents a decimal value. - * No arithmetic functionality for now, we only care about encoding/decoding. - */ -struct Decimal { - u_int32_t value; - u_int8_t decimals; - - Decimal(u_int32_t value_=0, u_int8_t decimals_=0) : value(value_), decimals(decimals_) {} - bool operator==(const Decimal& d) const { - return decimals == d.decimals && value == d.value; - } - bool operator!=(const Decimal& d) const { return !(*this == d); } -}; - -std::ostream& operator<<(std::ostream& out, const Decimal& d); - -/** - * Polymorpic base class for values. - */ -class Value { - public: - virtual ~Value(); - virtual u_int32_t size() const = 0; - virtual char getType() const = 0; - virtual void encode(Buffer& buffer) = 0; - virtual void decode(Buffer& buffer) = 0; - virtual bool operator==(const Value&) const = 0; - bool operator!=(const Value& v) const { return !(*this == v); } - virtual void print(std::ostream& out) const = 0; - - /** Create a new value by decoding from the buffer */ - static std::auto_ptr decode_value(Buffer& buffer); -}; - -std::ostream& operator<<(std::ostream& out, const Value& d); - - -/** - * Template for common operations on Value sub-classes. - */ -template -class ValueOps : public Value -{ - protected: - T value; - public: - ValueOps() {} - ValueOps(const T& v) : value(v) {} - const T& getValue() const { return value; } - T& getValue() { return value; } - - virtual bool operator==(const Value& v) const { - const ValueOps* vo = dynamic_cast*>(&v); - if (vo == 0) return false; - else return value == vo->value; - } - - void print(std::ostream& out) const { out << value; } -}; - - -class StringValue : public ValueOps { - public: - StringValue(const std::string& v) : ValueOps(v) {} - StringValue() {} - virtual u_int32_t size() const { return 4 + value.length(); } - virtual char getType() const { return 'S'; } - virtual void encode(Buffer& buffer); - virtual void decode(Buffer& buffer); -}; - -class IntegerValue : public ValueOps { - public: - IntegerValue(int v) : ValueOps(v) {} - IntegerValue(){} - virtual u_int32_t size() const { return 4; } - virtual char getType() const { return 'I'; } - virtual void encode(Buffer& buffer); - virtual void decode(Buffer& buffer); -}; - -class TimeValue : public ValueOps { - public: - TimeValue(u_int64_t v) : ValueOps(v){} - TimeValue(){} - virtual u_int32_t size() const { return 8; } - virtual char getType() const { return 'T'; } - virtual void encode(Buffer& buffer); - virtual void decode(Buffer& buffer); -}; - -class DecimalValue : public ValueOps { - public: - DecimalValue(const Decimal& d) : ValueOps(d) {} - DecimalValue(u_int32_t value_=0, u_int8_t decimals_=0) : - ValueOps(Decimal(value_, decimals_)){} - virtual u_int32_t size() const { return 5; } - virtual char getType() const { return 'D'; } - virtual void encode(Buffer& buffer); - virtual void decode(Buffer& buffer); -}; - - -class FieldTableValue : public ValueOps { - public: - FieldTableValue(const FieldTable& v) : ValueOps(v){} - FieldTableValue(){} - virtual u_int32_t size() const { return 4 + value.size(); } - virtual char getType() const { return 'F'; } - virtual void encode(Buffer& buffer); - virtual void decode(Buffer& buffer); -}; - -class EmptyValue : public Value { - public: - ~EmptyValue(); - virtual u_int32_t size() const { return 0; } - virtual char getType() const { return 0; } - virtual void encode(Buffer& ) {} - virtual void decode(Buffer& ) {} - virtual bool operator==(const Value& v) const { - return dynamic_cast(&v); - } - virtual void print(std::ostream& out) const; -}; - -}} // qpid::framing - -#endif diff --git a/qpid/cpp/common/framing/inc/amqp_framing.h b/qpid/cpp/common/framing/inc/amqp_framing.h deleted file mode 100644 index adb0045ee5..0000000000 --- a/qpid/cpp/common/framing/inc/amqp_framing.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_types.h" -#include "AMQFrame.h" -#include "AMQBody.h" -#include "BodyHandler.h" -#include "AMQMethodBody.h" -#include "AMQHeaderBody.h" -#include "AMQContentBody.h" -#include "AMQHeartbeatBody.h" -#include "amqp_methods.h" -#include "InputHandler.h" -#include "OutputHandler.h" -#include "InitiationHandler.h" -#include "ProtocolInitiation.h" -#include "BasicHeaderProperties.h" diff --git a/qpid/cpp/common/framing/inc/amqp_types.h b/qpid/cpp/common/framing/inc/amqp_types.h deleted file mode 100644 index 6f8ef0862a..0000000000 --- a/qpid/cpp/common/framing/inc/amqp_types.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#ifdef _WINDOWS -#include "windows.h" -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned int u_int32_t; -typedef unsigned __int64 u_int64_t; -#endif -#ifndef _WINDOWS -#include "sys/types.h" -#endif - -#ifndef AMQP_TYPES_H -#define AMQP_TYPES_H - - -typedef std::string string; - -#endif diff --git a/qpid/cpp/common/framing/src/AMQBody.cpp b/qpid/cpp/common/framing/src/AMQBody.cpp deleted file mode 100644 index 08f0b1d7ca..0000000000 --- a/qpid/cpp/common/framing/src/AMQBody.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQBody.h" -#include - -std::ostream& qpid::framing::operator<<(std::ostream& out, const qpid::framing::AMQBody& body) -{ - body.print(out); - return out; -} - - -qpid::framing::AMQBody::~AMQBody() {} - -void qpid::framing::AMQBody::print(std::ostream& out) const { - out << "unknown body"; -} diff --git a/qpid/cpp/common/framing/src/AMQContentBody.cpp b/qpid/cpp/common/framing/src/AMQContentBody.cpp deleted file mode 100644 index 1be8867d53..0000000000 --- a/qpid/cpp/common/framing/src/AMQContentBody.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQContentBody.h" -#include - -qpid::framing::AMQContentBody::AMQContentBody(){ -} - -qpid::framing::AMQContentBody::AMQContentBody(const string& _data) : data(_data){ -} - -u_int32_t qpid::framing::AMQContentBody::size() const{ - return data.size(); -} -void qpid::framing::AMQContentBody::encode(Buffer& buffer) const{ - buffer.putRawData(data); -} -void qpid::framing::AMQContentBody::decode(Buffer& buffer, u_int32_t _size){ - buffer.getRawData(data, _size); -} - -void qpid::framing::AMQContentBody::print(std::ostream& out) const -{ - out << "content (" << size() << " bytes)"; -} diff --git a/qpid/cpp/common/framing/src/AMQFrame.cpp b/qpid/cpp/common/framing/src/AMQFrame.cpp deleted file mode 100644 index 487ab1a443..0000000000 --- a/qpid/cpp/common/framing/src/AMQFrame.cpp +++ /dev/null @@ -1,115 +0,0 @@ - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQFrame.h" -#include "QpidError.h" - -using namespace qpid::framing; - -AMQFrame::AMQFrame(){} - -AMQFrame::AMQFrame(u_int16_t _channel, AMQBody* _body) : channel(_channel), body(_body){} - -AMQFrame::AMQFrame(u_int16_t _channel, AMQBody::shared_ptr& _body) : channel(_channel), body(_body){} - -AMQFrame::~AMQFrame(){ -} - -u_int16_t AMQFrame::getChannel(){ - return channel; -} - -AMQBody::shared_ptr& AMQFrame::getBody(){ - return body; -} - -void AMQFrame::encode(Buffer& buffer) -{ - buffer.putOctet(body->type()); - buffer.putShort(channel); - buffer.putLong(body->size()); - body->encode(buffer); - buffer.putOctet(0xCE); -} - -AMQBody::shared_ptr createMethodBody(Buffer& buffer){ - u_int16_t classId = buffer.getShort(); - u_int16_t methodId = buffer.getShort(); - AMQBody::shared_ptr body(createAMQMethodBody(classId, methodId)); - return body; -} - -u_int32_t AMQFrame::size() const{ - if(!body.get()) THROW_QPID_ERROR(INTERNAL_ERROR, "Attempt to get size of frame with no body set!"); - return 1/*type*/ + 2/*channel*/ + 4/*body size*/ + body->size() + 1/*0xCE*/; -} - -bool AMQFrame::decode(Buffer& buffer) -{ - if(buffer.available() < 7) return false; - buffer.record(); - u_int32_t bufSize = decodeHead(buffer); - - if(buffer.available() < bufSize + 1){ - buffer.restore(); - return false; - } - decodeBody(buffer, bufSize); - u_int8_t end = buffer.getOctet(); - if(end != 0xCE) THROW_QPID_ERROR(FRAMING_ERROR, "Frame end not found"); - return true; -} - -u_int32_t AMQFrame::decodeHead(Buffer& buffer){ - type = buffer.getOctet(); - channel = buffer.getShort(); - return buffer.getLong(); -} - -void AMQFrame::decodeBody(Buffer& buffer, uint32_t bufSize) -{ - switch(type) - { - case METHOD_BODY: - body = createMethodBody(buffer); - break; - case HEADER_BODY: - body = AMQBody::shared_ptr(new AMQHeaderBody()); - break; - case CONTENT_BODY: - body = AMQBody::shared_ptr(new AMQContentBody()); - break; - case HEARTBEAT_BODY: - body = AMQBody::shared_ptr(new AMQHeartbeatBody()); - break; - default: - string msg("Unknown body type: "); - msg += type; - THROW_QPID_ERROR(FRAMING_ERROR, msg); - } - body->decode(buffer, bufSize); -} - -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; - out << "]"; - return out; -} - diff --git a/qpid/cpp/common/framing/src/AMQHeaderBody.cpp b/qpid/cpp/common/framing/src/AMQHeaderBody.cpp deleted file mode 100644 index dce5f1fd54..0000000000 --- a/qpid/cpp/common/framing/src/AMQHeaderBody.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQHeaderBody.h" -#include "QpidError.h" -#include "BasicHeaderProperties.h" - -qpid::framing::AMQHeaderBody::AMQHeaderBody(int classId) : weight(0), contentSize(0){ - createProperties(classId); -} - -qpid::framing::AMQHeaderBody::AMQHeaderBody() : properties(0), weight(0), contentSize(0){ -} - -qpid::framing::AMQHeaderBody::~AMQHeaderBody(){ - delete properties; -} - -u_int32_t qpid::framing::AMQHeaderBody::size() const{ - return 12 + properties->size(); -} - -void qpid::framing::AMQHeaderBody::encode(Buffer& buffer) const { - buffer.putShort(properties->classId()); - buffer.putShort(weight); - buffer.putLongLong(contentSize); - properties->encode(buffer); -} - -void qpid::framing::AMQHeaderBody::decode(Buffer& buffer, u_int32_t bufSize){ - u_int16_t classId = buffer.getShort(); - weight = buffer.getShort(); - contentSize = buffer.getLongLong(); - createProperties(classId); - properties->decode(buffer, bufSize - 12); -} - -void qpid::framing::AMQHeaderBody::createProperties(int classId){ - switch(classId){ - case BASIC: - properties = new qpid::framing::BasicHeaderProperties(); - break; - default: - THROW_QPID_ERROR(FRAMING_ERROR, "Unknown header class"); - } -} - -void qpid::framing::AMQHeaderBody::print(std::ostream& out) const -{ - out << "header, content_size=" << getContentSize() - << " (" << size() << " bytes)" << ", headers=" ; - // TODO aconway 2006-09-26: Hack to see headers. - // Should write proper op << for BasicHeaderProperties. - // - const BasicHeaderProperties* props = - dynamic_cast(getProperties()); - // TODO aconway 2006-09-26: Lose the static cast, fix BasicHeaderProperties - if (props) out << const_cast(props)->getHeaders(); -} diff --git a/qpid/cpp/common/framing/src/AMQHeartbeatBody.cpp b/qpid/cpp/common/framing/src/AMQHeartbeatBody.cpp deleted file mode 100644 index 15cbfeda48..0000000000 --- a/qpid/cpp/common/framing/src/AMQHeartbeatBody.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQHeartbeatBody.h" -#include - -qpid::framing::AMQHeartbeatBody::~AMQHeartbeatBody() {} - -void qpid::framing::AMQHeartbeatBody::print(std::ostream& out) const { - out << "heartbeat"; -} diff --git a/qpid/cpp/common/framing/src/AMQMethodBody.cpp b/qpid/cpp/common/framing/src/AMQMethodBody.cpp deleted file mode 100644 index 7455050377..0000000000 --- a/qpid/cpp/common/framing/src/AMQMethodBody.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "AMQMethodBody.h" -#include "QpidError.h" - -void qpid::framing::AMQMethodBody::encode(Buffer& buffer) const{ - buffer.putShort(amqpClassId()); - buffer.putShort(amqpMethodId()); - encodeContent(buffer); -} - -void qpid::framing::AMQMethodBody::decode(Buffer& buffer, u_int32_t /*size*/){ - decodeContent(buffer); -} - -bool qpid::framing::AMQMethodBody::match(AMQMethodBody* other) const{ - return other != 0 && other->amqpClassId() == amqpClassId() && other->amqpMethodId() == amqpMethodId(); -} - -void qpid::framing::AMQMethodBody::invoke(AMQP_ServerOperations& /*target*/, u_int16_t /*channel*/){ - THROW_QPID_ERROR(PROTOCOL_ERROR, "Method not supported by AMQP Server."); -} - - -std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQMethodBody& m){ - m.print(out); - return out; -} diff --git a/qpid/cpp/common/framing/src/BasicHeaderProperties.cpp b/qpid/cpp/common/framing/src/BasicHeaderProperties.cpp deleted file mode 100644 index c9153665d5..0000000000 --- a/qpid/cpp/common/framing/src/BasicHeaderProperties.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "BasicHeaderProperties.h" - -//TODO: This could be easily generated from the spec - -qpid::framing::BasicHeaderProperties::BasicHeaderProperties() : deliveryMode(0), priority(0), timestamp(0){} -qpid::framing::BasicHeaderProperties::~BasicHeaderProperties(){} - -u_int32_t qpid::framing::BasicHeaderProperties::size() const{ - u_int32_t bytes = 2;//flags - if(contentType.length() > 0) bytes += contentType.length() + 1; - if(contentEncoding.length() > 0) bytes += contentEncoding.length() + 1; - if(headers.count() > 0) bytes += headers.size(); - if(deliveryMode != 0) bytes += 1; - if(priority != 0) bytes += 1; - if(correlationId.length() > 0) bytes += correlationId.length() + 1; - if(replyTo.length() > 0) bytes += replyTo.length() + 1; - if(expiration.length() > 0) bytes += expiration.length() + 1; - if(messageId.length() > 0) bytes += messageId.length() + 1; - if(timestamp != 0) bytes += 8; - if(type.length() > 0) bytes += type.length() + 1; - if(userId.length() > 0) bytes += userId.length() + 1; - if(appId.length() > 0) bytes += appId.length() + 1; - if(clusterId.length() > 0) bytes += clusterId.length() + 1; - - return bytes; -} - -void qpid::framing::BasicHeaderProperties::encode(qpid::framing::Buffer& buffer) const{ - u_int16_t flags = getFlags(); - buffer.putShort(flags); - - if(contentType.length() > 0) buffer.putShortString(contentType); - if(contentEncoding.length() > 0) buffer.putShortString(contentEncoding); - if(headers.count() > 0) buffer.putFieldTable(headers); - if(deliveryMode != 0) buffer.putOctet(deliveryMode); - if(priority != 0) buffer.putOctet(priority); - if(correlationId.length() > 0) buffer.putShortString(correlationId); - if(replyTo.length() > 0) buffer.putShortString(replyTo); - if(expiration.length() > 0) buffer.putShortString(expiration); - if(messageId.length() > 0) buffer.putShortString(messageId); - if(timestamp != 0) buffer.putLongLong(timestamp);; - if(type.length() > 0) buffer.putShortString(type); - if(userId.length() > 0) buffer.putShortString(userId); - if(appId.length() > 0) buffer.putShortString(appId); - if(clusterId.length() > 0) buffer.putShortString(clusterId); -} - -void qpid::framing::BasicHeaderProperties::decode(qpid::framing::Buffer& buffer, u_int32_t /*size*/){ - u_int16_t flags = buffer.getShort(); - if(flags & (1 << 15)) buffer.getShortString(contentType); - if(flags & (1 << 14)) buffer.getShortString(contentEncoding); - if(flags & (1 << 13)) buffer.getFieldTable(headers); - if(flags & (1 << 12)) deliveryMode = buffer.getOctet(); - if(flags & (1 << 11)) priority = buffer.getOctet(); - if(flags & (1 << 10)) buffer.getShortString(correlationId); - if(flags & (1 << 9)) buffer.getShortString(replyTo); - if(flags & (1 << 8)) buffer.getShortString(expiration); - if(flags & (1 << 7)) buffer.getShortString(messageId); - if(flags & (1 << 6)) timestamp = buffer.getLongLong(); - if(flags & (1 << 5)) buffer.getShortString(type); - if(flags & (1 << 4)) buffer.getShortString(userId); - if(flags & (1 << 3)) buffer.getShortString(appId); - if(flags & (1 << 2)) buffer.getShortString(clusterId); -} - -u_int16_t qpid::framing::BasicHeaderProperties::getFlags() const{ - u_int16_t flags(0); - if(contentType.length() > 0) flags |= (1 << 15); - if(contentEncoding.length() > 0) flags |= (1 << 14); - if(headers.count() > 0) flags |= (1 << 13); - if(deliveryMode != 0) flags |= (1 << 12); - if(priority != 0) flags |= (1 << 11); - if(correlationId.length() > 0) flags |= (1 << 10); - if(replyTo.length() > 0) flags |= (1 << 9); - if(expiration.length() > 0) flags |= (1 << 8); - if(messageId.length() > 0) flags |= (1 << 7); - if(timestamp != 0) flags |= (1 << 6); - if(type.length() > 0) flags |= (1 << 5); - if(userId.length() > 0) flags |= (1 << 4); - if(appId.length() > 0) flags |= (1 << 3); - if(clusterId.length() > 0) flags |= (1 << 2); - return flags; -} diff --git a/qpid/cpp/common/framing/src/BodyHandler.cpp b/qpid/cpp/common/framing/src/BodyHandler.cpp deleted file mode 100644 index b428c62637..0000000000 --- a/qpid/cpp/common/framing/src/BodyHandler.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "memory.h" -#include "BodyHandler.h" - -using namespace qpid::framing; -using namespace std::tr1; - -BodyHandler::~BodyHandler() {} - -void BodyHandler::handleBody(AMQBody::shared_ptr& body){ - - switch(body->type()) - { - - case METHOD_BODY: - handleMethod(dynamic_pointer_cast(body)); - break; - - case HEADER_BODY: - handleHeader(dynamic_pointer_cast(body)); - break; - - case CONTENT_BODY: - handleContent(dynamic_pointer_cast(body)); - break; - - case HEARTBEAT_BODY: - handleHeartbeat(dynamic_pointer_cast(body)); - break; - - default: - throw UnknownBodyType(body->type()); - } - -} diff --git a/qpid/cpp/common/framing/src/Buffer.cpp b/qpid/cpp/common/framing/src/Buffer.cpp deleted file mode 100644 index 87aa1df7e9..0000000000 --- a/qpid/cpp/common/framing/src/Buffer.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "Buffer.h" -#include "FieldTable.h" - -qpid::framing::Buffer::Buffer(u_int32_t _size) : size(_size), position(0), limit(_size){ - data = new char[size]; -} - -qpid::framing::Buffer::~Buffer(){ - delete[] data; -} - -void qpid::framing::Buffer::flip(){ - limit = position; - position = 0; -} - -void qpid::framing::Buffer::clear(){ - limit = size; - position = 0; -} - -void qpid::framing::Buffer::compact(){ - u_int32_t p = limit - position; - //copy p chars from position to 0 - memmove(data, data + position, p); - limit = size; - position = p; -} - -void qpid::framing::Buffer::record(){ - r_position = position; - r_limit = limit; -} - -void qpid::framing::Buffer::restore(){ - position = r_position; - limit = r_limit; -} - -u_int32_t qpid::framing::Buffer::available(){ - return limit - position; -} - -char* qpid::framing::Buffer::start(){ - return data + position; -} - -void qpid::framing::Buffer::move(u_int32_t bytes){ - position += bytes; -} - -void qpid::framing::Buffer::putOctet(u_int8_t i){ - data[position++] = i; -} - -void qpid::framing::Buffer::putShort(u_int16_t i){ - u_int16_t b = i; - data[position++] = (u_int8_t) (0xFF & (b >> 8)); - data[position++] = (u_int8_t) (0xFF & b); -} - -void qpid::framing::Buffer::putLong(u_int32_t i){ - u_int32_t b = i; - data[position++] = (u_int8_t) (0xFF & (b >> 24)); - data[position++] = (u_int8_t) (0xFF & (b >> 16)); - data[position++] = (u_int8_t) (0xFF & (b >> 8)); - data[position++] = (u_int8_t) (0xFF & b); -} - -void qpid::framing::Buffer::putLongLong(u_int64_t i){ - u_int32_t hi = i >> 32; - u_int32_t lo = i; - putLong(hi); - putLong(lo); -} - -u_int8_t qpid::framing::Buffer::getOctet(){ - return (u_int8_t) data[position++]; -} - -u_int16_t qpid::framing::Buffer::getShort(){ - u_int16_t hi = (unsigned char) data[position++]; - hi = hi << 8; - hi |= (unsigned char) data[position++]; - return hi; -} - -u_int32_t qpid::framing::Buffer::getLong(){ - u_int32_t a = (unsigned char) data[position++]; - u_int32_t b = (unsigned char) data[position++]; - u_int32_t c = (unsigned char) data[position++]; - u_int32_t d = (unsigned char) data[position++]; - a = a << 24; - a |= b << 16; - a |= c << 8; - a |= d; - return a; -} - -u_int64_t qpid::framing::Buffer::getLongLong(){ - u_int64_t hi = getLong(); - u_int64_t lo = getLong(); - hi = hi << 32; - return hi | lo; -} - - -void qpid::framing::Buffer::putShortString(const string& s){ - u_int8_t len = s.length(); - putOctet(len); - s.copy(data + position, len); - position += len; -} - -void qpid::framing::Buffer::putLongString(const string& s){ - u_int32_t len = s.length(); - putLong(len); - s.copy(data + position, len); - position += len; -} - -void qpid::framing::Buffer::getShortString(string& s){ - u_int8_t len = getOctet(); - s.assign(data + position, len); - position += len; -} - -void qpid::framing::Buffer::getLongString(string& s){ - u_int32_t len = getLong(); - s.assign(data + position, len); - position += len; -} - -void qpid::framing::Buffer::putFieldTable(const FieldTable& t){ - t.encode(*this); -} - -void qpid::framing::Buffer::getFieldTable(FieldTable& t){ - t.decode(*this); -} - -void qpid::framing::Buffer::putRawData(const string& s){ - u_int32_t len = s.length(); - s.copy(data + position, len); - position += len; -} - -void qpid::framing::Buffer::getRawData(string& s, u_int32_t len){ - s.assign(data + position, len); - position += len; -} diff --git a/qpid/cpp/common/framing/src/FieldTable.cpp b/qpid/cpp/common/framing/src/FieldTable.cpp deleted file mode 100644 index 088c8fb500..0000000000 --- a/qpid/cpp/common/framing/src/FieldTable.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "FieldTable.h" -#include "QpidError.h" -#include "Buffer.h" -#include "Value.h" -#include - -namespace qpid { -namespace framing { - -FieldTable::~FieldTable() {} - -u_int32_t FieldTable::size() const { - u_int32_t len(4); - for(ValueMap::const_iterator i = values.begin(); i != values.end(); ++i) { - // 2 = shortstr_len_byyte + type_char_byte - len += 2 + (i->first).size() + (i->second)->size(); - } - return len; -} - -int FieldTable::count() const { - return values.size(); -} - -namespace -{ -std::ostream& operator<<(std::ostream& out, const FieldTable::ValueMap::value_type& i) { - return out << i.first << ":" << *i.second; -} -} - -std::ostream& operator<<(std::ostream& out, const FieldTable& t) { - out << "field_table{"; - FieldTable::ValueMap::const_iterator i = t.getMap().begin(); - if (i != t.getMap().end()) out << *i++; - while (i != t.getMap().end()) - { - out << "," << *i++; - } - return out << "}"; -} - -void FieldTable::setString(const std::string& name, const std::string& value){ - values[name] = ValuePtr(new StringValue(value)); -} - -void FieldTable::setInt(const std::string& name, int value){ - values[name] = ValuePtr(new IntegerValue(value)); -} - -void FieldTable::setTimestamp(const std::string& name, u_int64_t value){ - values[name] = ValuePtr(new TimeValue(value)); -} - -void FieldTable::setTable(const std::string& name, const FieldTable& value){ - values[name] = ValuePtr(new FieldTableValue(value)); -} - -namespace { -template T default_value() { return T(); } -template <> int default_value() { return 0; } -template <> u_int64_t default_value() { return 0; } -} - -template -T FieldTable::getValue(const std::string& name) const -{ - ValueMap::const_iterator i = values.find(name); - if (i == values.end()) return default_value(); - const ValueOps *vt = dynamic_cast*>(i->second.get()); - return vt->getValue(); -} - -std::string FieldTable::getString(const std::string& name) const { - return getValue(name); -} - -int FieldTable::getInt(const std::string& name) const { - return getValue(name); -} - -u_int64_t FieldTable::getTimestamp(const std::string& name) const { - return getValue(name); -} - -void FieldTable::getTable(const std::string& name, FieldTable& value) const { - value = getValue(name); -} - -void FieldTable::encode(Buffer& buffer) const{ - buffer.putLong(size() - 4); - for (ValueMap::const_iterator i = values.begin(); i!=values.end(); ++i) { - buffer.putShortString(i->first); - buffer.putOctet(i->second->getType()); - i->second->encode(buffer); - } -} - -void FieldTable::decode(Buffer& buffer){ - u_int32_t len = buffer.getLong(); - u_int32_t available = buffer.available(); - if (available < len) - THROW_QPID_ERROR(FRAMING_ERROR, "Not enough data for field table."); - u_int32_t leftover = available - len; - while(buffer.available() > leftover){ - std::string name; - buffer.getShortString(name); - std::auto_ptr value(Value::decode_value(buffer)); - values[name] = ValuePtr(value.release()); - } -} - - -bool FieldTable::operator==(const FieldTable& x) const { - if (values.size() != x.values.size()) return false; - for (ValueMap::const_iterator i = values.begin(); i != values.end(); ++i) { - ValueMap::const_iterator j = x.values.find(i->first); - if (j == x.values.end()) return false; - if (*(i->second) != *(j->second)) return false; - } - return true; -} - -void FieldTable::erase(const std::string& name) -{ - values.erase(values.find(name)); -} - -} -} diff --git a/qpid/cpp/common/framing/src/InitiationHandler.cpp b/qpid/cpp/common/framing/src/InitiationHandler.cpp deleted file mode 100644 index 9c18facf44..0000000000 --- a/qpid/cpp/common/framing/src/InitiationHandler.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "InitiationHandler.h" - -qpid::framing::InitiationHandler::~InitiationHandler() {} diff --git a/qpid/cpp/common/framing/src/InputHandler.cpp b/qpid/cpp/common/framing/src/InputHandler.cpp deleted file mode 100644 index 7116caa24a..0000000000 --- a/qpid/cpp/common/framing/src/InputHandler.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "InputHandler.h" - -qpid::framing::InputHandler::~InputHandler() {} diff --git a/qpid/cpp/common/framing/src/OutputHandler.cpp b/qpid/cpp/common/framing/src/OutputHandler.cpp deleted file mode 100644 index 8d99b4ef92..0000000000 --- a/qpid/cpp/common/framing/src/OutputHandler.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "OutputHandler.h" - -qpid::framing::OutputHandler::~OutputHandler() {} diff --git a/qpid/cpp/common/framing/src/ProtocolInitiation.cpp b/qpid/cpp/common/framing/src/ProtocolInitiation.cpp deleted file mode 100644 index 6806d73b55..0000000000 --- a/qpid/cpp/common/framing/src/ProtocolInitiation.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "ProtocolInitiation.h" - -qpid::framing::ProtocolInitiation::ProtocolInitiation(){} - -qpid::framing::ProtocolInitiation::ProtocolInitiation(u_int8_t _major, u_int8_t _minor) : pmajor(_major), pminor(_minor){} - -qpid::framing::ProtocolInitiation::~ProtocolInitiation(){} - -void qpid::framing::ProtocolInitiation::encode(Buffer& buffer){ - buffer.putOctet('A'); - buffer.putOctet('M'); - buffer.putOctet('Q'); - buffer.putOctet('P'); - buffer.putOctet(1);//class - buffer.putOctet(1);//instance - buffer.putOctet(pmajor); - buffer.putOctet(pminor); -} - -bool qpid::framing::ProtocolInitiation::decode(Buffer& buffer){ - if(buffer.available() >= 8){ - buffer.getOctet();//A - buffer.getOctet();//M - buffer.getOctet();//Q - buffer.getOctet();//P - buffer.getOctet();//class - buffer.getOctet();//instance - pmajor = buffer.getOctet(); - pminor = buffer.getOctet(); - return true; - }else{ - return false; - } -} - -//TODO: this should prbably be generated from the spec at some point to keep the version numbers up to date diff --git a/qpid/cpp/common/framing/src/Value.cpp b/qpid/cpp/common/framing/src/Value.cpp deleted file mode 100644 index 1c210fdb12..0000000000 --- a/qpid/cpp/common/framing/src/Value.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "Value.h" -#include "Buffer.h" -#include "FieldTable.h" -#include "QpidError.h" - -namespace qpid { -namespace framing { - -Value::~Value() {} - -void StringValue::encode(Buffer& buffer){ - buffer.putLongString(value); -} -void StringValue::decode(Buffer& buffer){ - buffer.getLongString(value); -} - -void IntegerValue::encode(Buffer& buffer){ - buffer.putLong((u_int32_t) value); -} -void IntegerValue::decode(Buffer& buffer){ - value = buffer.getLong(); -} - -void TimeValue::encode(Buffer& buffer){ - buffer.putLongLong(value); -} -void TimeValue::decode(Buffer& buffer){ - value = buffer.getLongLong(); -} - -void DecimalValue::encode(Buffer& buffer){ - buffer.putOctet(value.decimals); - buffer.putLong(value.value); -} -void DecimalValue::decode(Buffer& buffer){ - value = Decimal(buffer.getLong(), buffer.getOctet()); -} - -void FieldTableValue::encode(Buffer& buffer){ - buffer.putFieldTable(value); -} -void FieldTableValue::decode(Buffer& buffer){ - buffer.getFieldTable(value); -} - -std::auto_ptr Value::decode_value(Buffer& buffer) -{ - std::auto_ptr value; - u_int8_t type = buffer.getOctet(); - switch(type){ - case 'S': - value.reset(new StringValue()); - break; - case 'I': - value.reset(new IntegerValue()); - break; - case 'D': - value.reset(new DecimalValue()); - break; - case 'T': - value.reset(new TimeValue()); - break; - case 'F': - value.reset(new FieldTableValue()); - break; - default: - THROW_QPID_ERROR(FRAMING_ERROR, "Unknown field table value type"); - } - value->decode(buffer); - return value; -} - -EmptyValue::~EmptyValue() {} - -void EmptyValue::print(std::ostream& out) const -{ - out << ""; -} - -std::ostream& operator<<(std::ostream& out, const Value& v) { - v.print(out); - return out; -} - -std::ostream& operator<<(std::ostream& out, const Decimal& d) -{ - return out << "Decimal(" << d.value << "," << d.decimals << ")"; -} - -}} - - - diff --git a/qpid/cpp/common/framing/test/BodyHandlerTest.cpp b/qpid/cpp/common/framing/test/BodyHandlerTest.cpp deleted file mode 100644 index 1cad6afe02..0000000000 --- a/qpid/cpp/common/framing/test/BodyHandlerTest.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include "amqp_framing.h" -#include "qpid_test_plugin.h" -using namespace qpid::framing; - -class BodyHandlerTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(BodyHandlerTest); - CPPUNIT_TEST(testMethod); - CPPUNIT_TEST(testHeader); - CPPUNIT_TEST(testContent); - CPPUNIT_TEST(testHeartbeat); - CPPUNIT_TEST_SUITE_END(); -private: - - class TestBodyHandler : public BodyHandler{ - AMQMethodBody* const method; - AMQHeaderBody* const header; - AMQContentBody* const content; - AMQHeartbeatBody* const heartbeat; - - public: - - TestBodyHandler(AMQMethodBody* _method) : method(_method), header(0), content(0), heartbeat(0){} - TestBodyHandler(AMQHeaderBody* _header) : method(0), header(_header), content(0), heartbeat(0){} - TestBodyHandler(AMQContentBody* _content) : method(0), header(0), content(_content), heartbeat(0){} - TestBodyHandler(AMQHeartbeatBody* _heartbeat) : method(0), header(0), content(0), heartbeat(_heartbeat){} - - virtual void handleMethod(AMQMethodBody::shared_ptr body){ - CPPUNIT_ASSERT(method); - CPPUNIT_ASSERT_EQUAL(method, body.get()); - } - virtual void handleHeader(AMQHeaderBody::shared_ptr body){ - CPPUNIT_ASSERT(header); - CPPUNIT_ASSERT_EQUAL(header, body.get()); - } - virtual void handleContent(AMQContentBody::shared_ptr body){ - CPPUNIT_ASSERT(content); - CPPUNIT_ASSERT_EQUAL(content, body.get()); - } - virtual void handleHeartbeat(AMQHeartbeatBody::shared_ptr body){ - CPPUNIT_ASSERT(heartbeat); - CPPUNIT_ASSERT_EQUAL(heartbeat, body.get()); - } - }; - -public: - - void testMethod() - { - AMQMethodBody* method = new QueueDeclareBody(); - AMQFrame frame(0, method); - TestBodyHandler handler(method); - handler.handleBody(frame.getBody()); - } - - void testHeader() - { - AMQHeaderBody* header = new AMQHeaderBody(); - AMQFrame frame(0, header); - TestBodyHandler handler(header); - handler.handleBody(frame.getBody()); - } - - void testContent() - { - AMQContentBody* content = new AMQContentBody(); - AMQFrame frame(0, content); - TestBodyHandler handler(content); - handler.handleBody(frame.getBody()); - } - - void testHeartbeat() - { - AMQHeartbeatBody* heartbeat = new AMQHeartbeatBody(); - AMQFrame frame(0, heartbeat); - TestBodyHandler handler(heartbeat); - handler.handleBody(frame.getBody()); - } -}; - - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(BodyHandlerTest); - diff --git a/qpid/cpp/common/framing/test/Makefile b/qpid/cpp/common/framing/test/Makefile deleted file mode 100644 index 487b8d537b..0000000000 --- a/qpid/cpp/common/framing/test/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2006 The Apache Software Foundation -# -# Licensed 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. -# - -QPID_HOME = ../../../.. -LDLIBS=-lapr-1 -lcppunit $(COMMON_LIB) -INCLUDES=$(TEST_INCLUDES) -I ../generated -include ${QPID_HOME}/cpp/test_plugins.mk - diff --git a/qpid/cpp/common/framing/test/field_table_test.cpp b/qpid/cpp/common/framing/test/field_table_test.cpp deleted file mode 100644 index 535f7f4a08..0000000000 --- a/qpid/cpp/common/framing/test/field_table_test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include "amqp_framing.h" -#include - -using namespace qpid::framing; - -class FieldTableTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FieldTableTest); - CPPUNIT_TEST(testMe); - CPPUNIT_TEST_SUITE_END(); - - public: - - void testMe() - { - FieldTable ft; - ft.setString("A", "BCDE"); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft.getString("A")); - - Buffer buffer(100); - buffer.putFieldTable(ft); - buffer.flip(); - FieldTable ft2; - buffer.getFieldTable(ft2); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft2.getString("A")); - - } -}; - - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(FieldTableTest); - diff --git a/qpid/cpp/common/framing/test/framing_test.cpp b/qpid/cpp/common/framing/test/framing_test.cpp deleted file mode 100644 index 8c69f8718a..0000000000 --- a/qpid/cpp/common/framing/test/framing_test.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 "amqp_framing.h" -#include "ConnectionRedirectBody.h" -#include -#include -#include -#include - -using namespace qpid::framing; - -// TODO aconway 2006-09-12: Why do we need explicit qpid::framing:: below? - -template -std::string tostring(const T& x) -{ - std::ostringstream out; - out << x; - return out.str(); -} - -class FramingTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FramingTest); - CPPUNIT_TEST(testBasicQosBody); - CPPUNIT_TEST(testConnectionSecureBody); - CPPUNIT_TEST(testConnectionRedirectBody); - CPPUNIT_TEST(testAccessRequestBody); - CPPUNIT_TEST(testBasicConsumeBody); - CPPUNIT_TEST(ConnectionRedirectBody); - CPPUNIT_TEST(BasicConsumeOkBody); - CPPUNIT_TEST_SUITE_END(); - - private: - Buffer buffer; - - public: - - FramingTest() : buffer(100) {} - - void testBasicQosBody() - { - BasicQosBody in(0xCAFEBABE, 0xABBA, true); - in.encodeContent(buffer); - buffer.flip(); - BasicQosBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionSecureBody() - { - std::string s = "security credential"; - ConnectionSecureBody in(s); - in.encodeContent(buffer); - buffer.flip(); - ConnectionSecureBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionRedirectBody() - { - std::string a = "hostA"; - std::string b = "hostB"; - qpid::framing::ConnectionRedirectBody in(a, b); - in.encodeContent(buffer); - buffer.flip(); - qpid::framing::ConnectionRedirectBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testAccessRequestBody() - { - std::string s = "text"; - AccessRequestBody in(s, true, false, true, false, true); - in.encodeContent(buffer); - buffer.flip(); - AccessRequestBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testBasicConsumeBody() - { - std::string q = "queue"; - std::string t = "tag"; - BasicConsumeBody in(0, q, t, false, true, false, false); - in.encodeContent(buffer); - buffer.flip(); - BasicConsumeBody out; - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - - void ConnectionRedirectBody() - { - std::string a = "hostA"; - std::string b = "hostB"; - AMQFrame in(999, new qpid::framing::ConnectionRedirectBody(a, b)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void BasicConsumeOkBody() - { - std::string s = "hostA"; - AMQFrame in(999, new qpid::framing::BasicConsumeOkBody(s)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - for(int i = 0; i < 5; i++){ - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - } -}; - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(FramingTest); - - - diff --git a/qpid/cpp/common/framing/test/header_test.cpp b/qpid/cpp/common/framing/test/header_test.cpp deleted file mode 100644 index f98dd5d108..0000000000 --- a/qpid/cpp/common/framing/test/header_test.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed 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 -#include "amqp_framing.h" -#include - -using namespace qpid::framing; - -class HeaderTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(HeaderTest); - CPPUNIT_TEST(testGenericProperties); - CPPUNIT_TEST(testAllSpecificProperties); - CPPUNIT_TEST(testSomeSpecificProperties); - CPPUNIT_TEST_SUITE_END(); - -public: - - // TODO aconway 2006-09-12: Need more detailed tests, - // need tests to assert something! - // - void testGenericProperties() - { - AMQHeaderBody body(BASIC); - dynamic_cast(body.getProperties())->getHeaders().setString("A", "BCDE"); - Buffer buffer(100); - - body.encode(buffer); - buffer.flip(); - AMQHeaderBody body2; - body2.decode(buffer, body.size()); - BasicHeaderProperties* props = - dynamic_cast(body2.getProperties()); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), - props->getHeaders().getString("A")); - } - - void testAllSpecificProperties(){ - string contentType("text/html"); - string contentEncoding("UTF8"); - u_int8_t deliveryMode(2); - u_int8_t priority(3); - string correlationId("abc"); - string replyTo("no-address"); - string expiration("why is this a string?"); - string messageId("xyz"); - u_int64_t timestamp(0xabcd); - string type("eh?"); - string userId("guest"); - string appId("just testing"); - string clusterId("no clustering required"); - - AMQHeaderBody body(BASIC); - BasicHeaderProperties* properties = - dynamic_cast(body.getProperties()); - properties->setContentType(contentType); - properties->getHeaders().setString("A", "BCDE"); - properties->setDeliveryMode(deliveryMode); - properties->setPriority(priority); - properties->setCorrelationId(correlationId); - properties->setReplyTo(replyTo); - properties->setExpiration(expiration); - properties->setMessageId(messageId); - properties->setTimestamp(timestamp); - properties->setType(type); - properties->setUserId(userId); - properties->setAppId(appId); - properties->setClusterId(clusterId); - - Buffer buffer(10000); - body.encode(buffer); - buffer.flip(); - AMQHeaderBody temp; - temp.decode(buffer, body.size()); - properties = dynamic_cast(temp.getProperties()); - - CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); - CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), properties->getHeaders().getString("A")); - CPPUNIT_ASSERT_EQUAL(deliveryMode, properties->getDeliveryMode()); - CPPUNIT_ASSERT_EQUAL(priority, properties->getPriority()); - CPPUNIT_ASSERT_EQUAL(correlationId, properties->getCorrelationId()); - CPPUNIT_ASSERT_EQUAL(replyTo, properties->getReplyTo()); - CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); - CPPUNIT_ASSERT_EQUAL(messageId, properties->getMessageId()); - CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); - CPPUNIT_ASSERT_EQUAL(type, properties->getType()); - CPPUNIT_ASSERT_EQUAL(userId, properties->getUserId()); - CPPUNIT_ASSERT_EQUAL(appId, properties->getAppId()); - CPPUNIT_ASSERT_EQUAL(clusterId, properties->getClusterId()); - } - - void testSomeSpecificProperties(){ - string contentType("application/octet-stream"); - u_int8_t deliveryMode(5); - u_int8_t priority(6); - string expiration("Z"); - u_int64_t timestamp(0xabe4a34a); - - AMQHeaderBody body(BASIC); - BasicHeaderProperties* properties = - dynamic_cast(body.getProperties()); - properties->setContentType(contentType); - properties->setDeliveryMode(deliveryMode); - properties->setPriority(priority); - properties->setExpiration(expiration); - properties->setTimestamp(timestamp); - - Buffer buffer(100); - body.encode(buffer); - buffer.flip(); - AMQHeaderBody temp; - temp.decode(buffer, body.size()); - properties = dynamic_cast(temp.getProperties()); - - CPPUNIT_ASSERT_EQUAL(contentType, properties->getContentType()); - CPPUNIT_ASSERT_EQUAL((int) deliveryMode, (int) properties->getDeliveryMode()); - CPPUNIT_ASSERT_EQUAL((int) priority, (int) properties->getPriority()); - CPPUNIT_ASSERT_EQUAL(expiration, properties->getExpiration()); - CPPUNIT_ASSERT_EQUAL(timestamp, properties->getTimestamp()); - } -}; - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(HeaderTest); - -- cgit v1.2.1