diff options
| author | Alan Conway <aconway@apache.org> | 2007-02-13 02:41:14 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-02-13 02:41:14 +0000 |
| commit | 9517deedff9691dbe3429b0b917dfd4208b0b1b8 (patch) | |
| tree | f8868a2fbc63e92c770b401eeff2aee3a522697a /cpp/lib/common | |
| parent | d26ea3376f66f69486fe214c8a7a8b96a7605c99 (diff) | |
| download | qpid-python-9517deedff9691dbe3429b0b917dfd4208b0b1b8.tar.gz | |
* gentools/templ.cpp/*Proxy*, CppGenerator.java: Changes to Proxy
classes to make them directly usable as an API for low-level AMQP access.
- Proxies hold reference to a ChannelAdapter not just an output handler.
- Removed MethodContext parameter, makes no sense on requester end.
- Return RequestId from request methods so caller can correlate
incoming responses.
- Add RequestId parameter to response methods so caller can provide
correlation for outgoing responses.
- No longer inherit from *Operations classes as the signatures no
longer match. Proxy is for caller (client/requester) and Operations
is for callee (server/responder)
* cpp/lib/client/ClientChannel.h: Channel provides a raw proxy to the broker.
Normal users will still use the Channel API to deal with the broker, but
advanced users (incl ourselves!) can use the raw API to directly send
and receive any AMQP message.
* cpp/lib/broker/BrokerChannel,BrokerAdapter: Refactor for new proxies.
broker::Channel is also a ClientProxy
* Sundry files:
- Pass ProtcolVersion by value, it is only two bytes.
- Misc. const correctness fixes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@506823 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/common')
| -rw-r--r-- | cpp/lib/common/Makefile.am | 12 | ||||
| -rw-r--r-- | cpp/lib/common/framing/AMQFrame.cpp | 19 | ||||
| -rw-r--r-- | cpp/lib/common/framing/AMQFrame.h | 8 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ChannelAdapter.cpp | 8 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ChannelAdapter.h | 15 | ||||
| -rw-r--r-- | cpp/lib/common/framing/FramingContent.h | 6 | ||||
| -rw-r--r-- | cpp/lib/common/framing/MethodContext.cpp | 31 | ||||
| -rw-r--r-- | cpp/lib/common/framing/MethodContext.h | 8 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ProtocolInitiation.cpp | 17 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ProtocolInitiation.h | 4 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ProtocolVersion.cpp | 35 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ProtocolVersion.h | 26 | ||||
| -rw-r--r-- | cpp/lib/common/framing/ProtocolVersionException.h | 2 | ||||
| -rw-r--r-- | cpp/lib/common/framing/Proxy.cpp | 32 | ||||
| -rw-r--r-- | cpp/lib/common/framing/Proxy.h | 51 | ||||
| -rw-r--r-- | cpp/lib/common/framing/amqp_types.h | 9 | ||||
| -rw-r--r-- | cpp/lib/common/framing/amqp_types_full.h | 36 |
17 files changed, 239 insertions, 80 deletions
diff --git a/cpp/lib/common/Makefile.am b/cpp/lib/common/Makefile.am index eefff79d6f..c44480bddf 100644 --- a/cpp/lib/common/Makefile.am +++ b/cpp/lib/common/Makefile.am @@ -63,6 +63,7 @@ libqpidcommon_la_SOURCES = \ $(framing)/AMQHeaderBody.cpp \ $(framing)/AMQHeartbeatBody.cpp \ $(framing)/AMQMethodBody.cpp \ + $(framing)/MethodContext.cpp \ $(framing)/BasicHeaderProperties.cpp \ $(framing)/BodyHandler.cpp \ $(framing)/ChannelAdapter.cpp \ @@ -76,8 +77,8 @@ libqpidcommon_la_SOURCES = \ $(framing)/Requester.cpp \ $(framing)/Responder.cpp \ $(framing)/Value.cpp \ + $(framing)/Proxy.cpp \ $(gen)/AMQP_ClientProxy.cpp \ - $(gen)/AMQP_HighestVersion.h \ $(gen)/AMQP_MethodVersionMap.cpp \ $(gen)/AMQP_ServerProxy.cpp \ Exception.cpp \ @@ -87,6 +88,7 @@ libqpidcommon_la_SOURCES = \ sys/Time.cpp nobase_pkginclude_HEADERS = \ + $(gen)/AMQP_HighestVersion.h \ $(platform_hdr) \ $(framing)/AMQBody.h \ $(framing)/AMQContentBody.h \ @@ -95,6 +97,7 @@ nobase_pkginclude_HEADERS = \ $(framing)/AMQHeaderBody.h \ $(framing)/AMQHeartbeatBody.h \ $(framing)/AMQMethodBody.h \ + $(framing)/MethodContext.h \ $(framing)/BasicHeaderProperties.h \ $(framing)/BodyHandler.h \ $(framing)/ChannelAdapter.h \ @@ -111,6 +114,7 @@ nobase_pkginclude_HEADERS = \ $(framing)/Value.h \ $(framing)/amqp_framing.h \ $(framing)/amqp_types.h \ + $(framing)/Proxy.h \ Exception.h \ ExceptionHolder.h \ QpidError.h \ @@ -121,9 +125,9 @@ nobase_pkginclude_HEADERS = \ sys/Monitor.h \ sys/Mutex.h \ sys/Runnable.h \ - sys/ConnectionOutputHandler.h \ - sys/ConnectionInputHandler.h \ - sys/ConnectionInputHandlerFactory.h \ + sys/ConnectionOutputHandler.h \ + sys/ConnectionInputHandler.h \ + sys/ConnectionInputHandlerFactory.h \ sys/ShutdownHandler.h \ sys/Socket.h \ sys/Thread.h \ diff --git a/cpp/lib/common/framing/AMQFrame.cpp b/cpp/lib/common/framing/AMQFrame.cpp index 9c5e295e22..4e061af2e1 100644 --- a/cpp/lib/common/framing/AMQFrame.cpp +++ b/cpp/lib/common/framing/AMQFrame.cpp @@ -26,19 +26,24 @@ #include "AMQRequestBody.h" #include "AMQResponseBody.h" -using namespace qpid::framing; + +namespace qpid { +namespace framing { + AMQP_MethodVersionMap AMQFrame::versionMap; -AMQFrame::AMQFrame(const qpid::framing::ProtocolVersion& _version): +AMQFrame::AMQFrame(ProtocolVersion _version): version(_version) - {} + { + assert(version != ProtocolVersion(0,0)); + } -AMQFrame::AMQFrame(const qpid::framing::ProtocolVersion& _version, u_int16_t _channel, AMQBody* _body) : +AMQFrame::AMQFrame(ProtocolVersion _version, u_int16_t _channel, AMQBody* _body) : version(_version), channel(_channel), body(_body) {} -AMQFrame::AMQFrame(const qpid::framing::ProtocolVersion& _version, u_int16_t _channel, const AMQBody::shared_ptr& _body) : +AMQFrame::AMQFrame(ProtocolVersion _version, u_int16_t _channel, const AMQBody::shared_ptr& _body) : version(_version), channel(_channel), body(_body) {} @@ -119,7 +124,7 @@ void AMQFrame::decodeBody(Buffer& buffer, uint32_t size) body->decode(buffer, size); } -std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t) +std::ostream& operator<<(std::ostream& out, const AMQFrame& t) { out << "Frame[channel=" << t.channel << "; "; if (t.body.get() == 0) @@ -130,3 +135,5 @@ std::ostream& qpid::framing::operator<<(std::ostream& out, const AMQFrame& t) return out; } + +}} // namespace qpid::framing diff --git a/cpp/lib/common/framing/AMQFrame.h b/cpp/lib/common/framing/AMQFrame.h index 15b294a373..4e49b8871f 100644 --- a/cpp/lib/common/framing/AMQFrame.h +++ b/cpp/lib/common/framing/AMQFrame.h @@ -41,9 +41,9 @@ namespace framing { class AMQFrame : public AMQDataBlock { public: - AMQFrame(const qpid::framing::ProtocolVersion& _version = highestProtocolVersion); - AMQFrame(const qpid::framing::ProtocolVersion& _version, u_int16_t channel, AMQBody* body); - AMQFrame(const qpid::framing::ProtocolVersion& _version, u_int16_t channel, const AMQBody::shared_ptr& body); + AMQFrame(ProtocolVersion _version = highestProtocolVersion); + AMQFrame(ProtocolVersion _version, u_int16_t channel, AMQBody* body); + AMQFrame(ProtocolVersion _version, u_int16_t channel, const AMQBody::shared_ptr& body); virtual ~AMQFrame(); virtual void encode(Buffer& buffer); virtual bool decode(Buffer& buffer); @@ -62,7 +62,7 @@ class AMQFrame : public AMQDataBlock private: static AMQP_MethodVersionMap versionMap; - qpid::framing::ProtocolVersion version; + ProtocolVersion version; u_int16_t channel; u_int8_t type; diff --git a/cpp/lib/common/framing/ChannelAdapter.cpp b/cpp/lib/common/framing/ChannelAdapter.cpp index 53ab30faa0..40241660f2 100644 --- a/cpp/lib/common/framing/ChannelAdapter.cpp +++ b/cpp/lib/common/framing/ChannelAdapter.cpp @@ -19,6 +19,7 @@ #include "ChannelAdapter.h" #include "AMQFrame.h" +#include "Exception.h" using boost::format; @@ -26,7 +27,7 @@ namespace qpid { namespace framing { void ChannelAdapter::init( - ChannelId i, OutputHandler& o, const ProtocolVersion& v) + ChannelId i, OutputHandler& o, ProtocolVersion v) { assertChannelNotOpen(); id = i; @@ -34,13 +35,15 @@ void ChannelAdapter::init( version = v; } -void ChannelAdapter::send(AMQBody::shared_ptr body) { +RequestId ChannelAdapter::send(AMQBody::shared_ptr body) { + RequestId result = 0; assertChannelOpen(); switch (body->type()) { case REQUEST_BODY: { AMQRequestBody::shared_ptr request = boost::shared_polymorphic_downcast<AMQRequestBody>(body); requester.sending(request->getData()); + result = request->getData().requestId; break; } case RESPONSE_BODY: { @@ -51,6 +54,7 @@ void ChannelAdapter::send(AMQBody::shared_ptr body) { } } out->send(new AMQFrame(getVersion(), getId(), body)); + return result; } void ChannelAdapter::handleRequest(AMQRequestBody::shared_ptr request) { diff --git a/cpp/lib/common/framing/ChannelAdapter.h b/cpp/lib/common/framing/ChannelAdapter.h index c2eba2f4e9..9f654d9a5b 100644 --- a/cpp/lib/common/framing/ChannelAdapter.h +++ b/cpp/lib/common/framing/ChannelAdapter.h @@ -35,9 +35,8 @@ namespace framing { class MethodContext; /** - * Base class for client and broker channel adapters. + * Base class for client and broker channels. * - * BodyHandler::handl* * - receives frame bodies from the network. * - Updates request/response data. * - Dispatches requests with a MethodContext for responses. @@ -55,21 +54,21 @@ class ChannelAdapter : public BodyHandler { *@param output Processed frames are forwarded to this handler. */ ChannelAdapter(ChannelId id_=0, OutputHandler* out_=0, - const ProtocolVersion& ver=ProtocolVersion()) + ProtocolVersion ver=ProtocolVersion()) : id(id_), out(out_), version(ver) {} /** Initialize the channel adapter. */ - void init(ChannelId, OutputHandler&, const ProtocolVersion&); + void init(ChannelId, OutputHandler&, ProtocolVersion); ChannelId getId() const { return id; } - const ProtocolVersion& getVersion() const { return version; } + ProtocolVersion getVersion() const { return version; } /** * Wrap body in a frame and send the frame. * Takes ownership of body. */ - void send(AMQBody::shared_ptr body); - void send(AMQBody* body) { send(AMQBody::shared_ptr(body)); } + RequestId send(AMQBody::shared_ptr body); + RequestId send(AMQBody* body) { return send(AMQBody::shared_ptr(body)); } void handleMethod(boost::shared_ptr<qpid::framing::AMQMethodBody>); void handleRequest(boost::shared_ptr<qpid::framing::AMQRequestBody>); @@ -95,7 +94,7 @@ class ChannelAdapter : public BodyHandler { ProtocolVersion version; Requester requester; Responder responder; - RequestId requestInProgress; // TODO aconway 2007-01-24: use it. + RequestId requestInProgress; }; }} diff --git a/cpp/lib/common/framing/FramingContent.h b/cpp/lib/common/framing/FramingContent.h index 0f4a4b8f64..cffd46ee24 100644 --- a/cpp/lib/common/framing/FramingContent.h +++ b/cpp/lib/common/framing/FramingContent.h @@ -27,9 +27,9 @@ class Content void encode(Buffer& buffer) const; void decode(Buffer& buffer); size_t size() const; - bool isInline() { return discriminator == INLINE; } - bool isReference() { return discriminator == REFERENCE; } - const string& getValue() { return value; } + bool isInline() const { return discriminator == INLINE; } + bool isReference() const { return discriminator == REFERENCE; } + const string& getValue() const { return value; } friend std::ostream& operator<<(std::ostream&, const Content&); }; diff --git a/cpp/lib/common/framing/MethodContext.cpp b/cpp/lib/common/framing/MethodContext.cpp new file mode 100644 index 0000000000..73af73f8e5 --- /dev/null +++ b/cpp/lib/common/framing/MethodContext.cpp @@ -0,0 +1,31 @@ +/* + * + * 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 "MethodContext.h" +#include "amqp_types.h" +#include "AMQRequestBody.h" + +namespace qpid { +namespace framing { + +RequestId MethodContext::getRequestId() const { + return boost::shared_polymorphic_downcast<AMQRequestBody>(methodBody) + ->getRequestId(); +} + +}} // namespace qpid::framing diff --git a/cpp/lib/common/framing/MethodContext.h b/cpp/lib/common/framing/MethodContext.h index afb499023d..3493924bf6 100644 --- a/cpp/lib/common/framing/MethodContext.h +++ b/cpp/lib/common/framing/MethodContext.h @@ -24,8 +24,6 @@ #include "OutputHandler.h" #include "ProtocolVersion.h" -#include <boost/shared_ptr.hpp> - namespace qpid { namespace framing { @@ -61,6 +59,12 @@ struct MethodContext * It's also provides the request ID when constructing a response. */ BodyPtr methodBody; + + /** + * Return methodBody's request ID. + * It is an error to call this if methodBody is not a request. + */ + RequestId getRequestId() const; }; // FIXME aconway 2007-02-01: Method context only required on Handler diff --git a/cpp/lib/common/framing/ProtocolInitiation.cpp b/cpp/lib/common/framing/ProtocolInitiation.cpp index 471f736a7d..c119b79d6d 100644 --- a/cpp/lib/common/framing/ProtocolInitiation.cpp +++ b/cpp/lib/common/framing/ProtocolInitiation.cpp @@ -20,15 +20,18 @@ */ #include <ProtocolInitiation.h> -qpid::framing::ProtocolInitiation::ProtocolInitiation(){} +namespace qpid { +namespace framing { -qpid::framing::ProtocolInitiation::ProtocolInitiation(u_int8_t _major, u_int8_t _minor) : version(_major, _minor) {} +ProtocolInitiation::ProtocolInitiation(){} -qpid::framing::ProtocolInitiation::ProtocolInitiation(const qpid::framing::ProtocolVersion& p) : version(p) {} +ProtocolInitiation::ProtocolInitiation(u_int8_t _major, u_int8_t _minor) : version(_major, _minor) {} -qpid::framing::ProtocolInitiation::~ProtocolInitiation(){} +ProtocolInitiation::ProtocolInitiation(ProtocolVersion p) : version(p) {} -void qpid::framing::ProtocolInitiation::encode(Buffer& buffer){ +ProtocolInitiation::~ProtocolInitiation(){} + +void ProtocolInitiation::encode(Buffer& buffer){ buffer.putOctet('A'); buffer.putOctet('M'); buffer.putOctet('Q'); @@ -39,7 +42,7 @@ void qpid::framing::ProtocolInitiation::encode(Buffer& buffer){ buffer.putOctet(version.getMinor()); } -bool qpid::framing::ProtocolInitiation::decode(Buffer& buffer){ +bool ProtocolInitiation::decode(Buffer& buffer){ if(buffer.available() >= 8){ buffer.getOctet();//A buffer.getOctet();//M @@ -56,3 +59,5 @@ bool qpid::framing::ProtocolInitiation::decode(Buffer& buffer){ } //TODO: this should prbably be generated from the spec at some point to keep the version numbers up to date + +}} // namespace qpid::framing diff --git a/cpp/lib/common/framing/ProtocolInitiation.h b/cpp/lib/common/framing/ProtocolInitiation.h index 6b3dbac88d..fb5cb3abed 100644 --- a/cpp/lib/common/framing/ProtocolInitiation.h +++ b/cpp/lib/common/framing/ProtocolInitiation.h @@ -37,14 +37,14 @@ private: public: ProtocolInitiation(); ProtocolInitiation(u_int8_t major, u_int8_t minor); - ProtocolInitiation(const ProtocolVersion& p); + ProtocolInitiation(ProtocolVersion p); 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() const { return version.getMajor(); } inline u_int8_t getMinor() const { return version.getMinor(); } - inline const ProtocolVersion& getVersion() const { return version; } + inline ProtocolVersion getVersion() const { return version; } }; } diff --git a/cpp/lib/common/framing/ProtocolVersion.cpp b/cpp/lib/common/framing/ProtocolVersion.cpp index e65c8b79b8..fd4b1a645f 100644 --- a/cpp/lib/common/framing/ProtocolVersion.cpp +++ b/cpp/lib/common/framing/ProtocolVersion.cpp @@ -20,37 +20,9 @@ */ #include <ProtocolVersion.h> #include <sstream> -#include "AMQP_HighestVersion.h" using namespace qpid::framing; -ProtocolVersion::ProtocolVersion() { - *this = highestProtocolVersion; -} - -ProtocolVersion::ProtocolVersion(u_int8_t _major, u_int8_t _minor) : - major_(_major), - minor_(_minor) -{} - -ProtocolVersion::ProtocolVersion(const ProtocolVersion::ProtocolVersion& p): - major_(p.major_), - minor_(p.minor_) -{} - -ProtocolVersion::~ProtocolVersion() -{} - -bool ProtocolVersion::equals(u_int8_t _major, u_int8_t _minor) const -{ - return major_ == _major && minor_ == _minor; -} - -bool ProtocolVersion::equals(const ProtocolVersion::ProtocolVersion& p) const -{ - return major_ == p.major_ && minor_ == p.minor_; -} - const std::string ProtocolVersion::toString() const { std::stringstream ss; @@ -58,10 +30,15 @@ const std::string ProtocolVersion::toString() const return ss.str(); } -ProtocolVersion::ProtocolVersion ProtocolVersion::operator=(const ProtocolVersion& p) +ProtocolVersion& ProtocolVersion::operator=(ProtocolVersion p) { major_ = p.major_; minor_ = p.minor_; return *this; } +bool ProtocolVersion::operator==(ProtocolVersion p) const +{ + return major_ == p.major_ && minor_ == p.minor_; +} + diff --git a/cpp/lib/common/framing/ProtocolVersion.h b/cpp/lib/common/framing/ProtocolVersion.h index 6aba87c6f5..aa526aa293 100644 --- a/cpp/lib/common/framing/ProtocolVersion.h +++ b/cpp/lib/common/framing/ProtocolVersion.h @@ -35,19 +35,19 @@ private: u_int8_t minor_; public: - ProtocolVersion(); - ProtocolVersion(u_int8_t _major, u_int8_t _minor); - ProtocolVersion(const ProtocolVersion& p); - virtual ~ProtocolVersion(); - - inline u_int8_t getMajor() const { return major_; } - inline void setMajor(u_int8_t major) { major_ = major; } - inline u_int8_t getMinor() const { return minor_; } - inline void setMinor(u_int8_t minor) { minor_ = minor; } - virtual bool equals(u_int8_t _major, u_int8_t _minor) const; - virtual bool equals(const ProtocolVersion& p) const; - virtual const std::string toString() const; - ProtocolVersion operator=(const ProtocolVersion& p); + ProtocolVersion(u_int8_t _major=0, u_int8_t _minor=0) + : major_(_major), minor_(_minor) {} + + u_int8_t getMajor() const { return major_; } + void setMajor(u_int8_t major) { major_ = major; } + u_int8_t getMinor() const { return minor_; } + void setMinor(u_int8_t minor) { minor_ = minor; } + const std::string toString() const; + + ProtocolVersion& operator=(ProtocolVersion p); + + bool operator==(ProtocolVersion p) const; + bool operator!=(ProtocolVersion p) const { return ! (*this == p); } }; } // namespace framing diff --git a/cpp/lib/common/framing/ProtocolVersionException.h b/cpp/lib/common/framing/ProtocolVersionException.h index aff0cd91d6..8e2de8b843 100644 --- a/cpp/lib/common/framing/ProtocolVersionException.h +++ b/cpp/lib/common/framing/ProtocolVersionException.h @@ -40,7 +40,7 @@ public: template <class T> ProtocolVersionException( - const ProtocolVersion& ver, const T& msg) throw () : versionFound(ver) + ProtocolVersion ver, const T& msg) throw () : versionFound(ver) { init(boost::lexical_cast<std::string>(msg)); } template <class T> diff --git a/cpp/lib/common/framing/Proxy.cpp b/cpp/lib/common/framing/Proxy.cpp new file mode 100644 index 0000000000..0b2a882a49 --- /dev/null +++ b/cpp/lib/common/framing/Proxy.cpp @@ -0,0 +1,32 @@ +/* + * + * 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 "Proxy.h" +#include "ChannelAdapter.h" +#include "ProtocolVersion.h" + +namespace qpid { +namespace framing { + +Proxy::~Proxy() {} + +ProtocolVersion Proxy::getProtocolVersion() const { + return channel.getVersion(); +} + +}} // namespace qpid::framing diff --git a/cpp/lib/common/framing/Proxy.h b/cpp/lib/common/framing/Proxy.h new file mode 100644 index 0000000000..8ed46ed748 --- /dev/null +++ b/cpp/lib/common/framing/Proxy.h @@ -0,0 +1,51 @@ +#ifndef _framing_Proxy_h +#define _framing_Proxy_h + +/* + * + * 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 "ProtocolVersion.h" + +namespace qpid { +namespace framing { + +class ChannelAdapter; +class FieldTable; +class Content; + +/** + * Base class for proxies. + */ +class Proxy +{ + + public: + Proxy(ChannelAdapter& ch) : channel(ch) {} + virtual ~Proxy(); + + ProtocolVersion getProtocolVersion() const; + + protected: + ChannelAdapter& channel; +}; + +}} // namespace qpid::framing + + + +#endif /*!_framing_Proxy_h*/ diff --git a/cpp/lib/common/framing/amqp_types.h b/cpp/lib/common/framing/amqp_types.h index 777d9e7bc5..2f56cb877e 100644 --- a/cpp/lib/common/framing/amqp_types.h +++ b/cpp/lib/common/framing/amqp_types.h @@ -20,6 +20,12 @@ * under the License. * */ + +/** \file + * Type definitions and forward declarations of all types used to + * in AMQP messages. + */ + #include <string> #ifdef _WINDOWS #include "windows.h" @@ -44,5 +50,8 @@ typedef u_int16_t ClassId; typedef u_int16_t MethodId; typedef u_int16_t ReplyCode; +// Types represented by classes. +class Content; +class FieldTable; }} // namespace qpid::framing #endif diff --git a/cpp/lib/common/framing/amqp_types_full.h b/cpp/lib/common/framing/amqp_types_full.h new file mode 100644 index 0000000000..6a24a99d38 --- /dev/null +++ b/cpp/lib/common/framing/amqp_types_full.h @@ -0,0 +1,36 @@ +#ifndef _framing_amqp_types_decl_h +#define _framing_amqp_types_decl_h + +/* + * + * 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. + * + */ + +/** \file + * Type definitions and full declarations of all types used to + * in AMQP messages. + * + * Its better to include amqp_types.h in another header instead of this file + * unless the header actually needs the full declarations. Including + * full declarations when forward declarations would do increases compile + * times. + */ + +#include "amqp_types.h" +#include "FramingContent.h" +#include "FieldTable.h" + +#endif /*!_framing_amqp_types_decl_h*/ |
