summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/ChannelAdapter.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-06-27 21:19:14 +0000
committerAlan Conway <aconway@apache.org>2007-06-27 21:19:14 +0000
commit0efcf2c5c91f4927ccc00ad1cf391c2f964cc2e1 (patch)
treea9318ac4787cf588dd1329c2e557d8f870be20cc /cpp/src/qpid/framing/ChannelAdapter.h
parent548abd065f91bc1f238ac98c24edf410edf10356 (diff)
downloadqpid-python-0efcf2c5c91f4927ccc00ad1cf391c2f964cc2e1.tar.gz
* src/qpid/framing/ChannelAdapter.cpp: Use handler chains
for in and outbound frames. * src/qpid/framing/InputHandler.h, OutputHandler.h, FrameHandler.h: All handlers pass AMQFrame& and have consistent memory management. Terminal OutputHandlers used to take ownership and delete frame, now they make a shallow copy instead. * src/qpid/framing/Handler.h, FrameHandler.h: Simplified. * src/qpid/client/ClientConnection.cpp: * src/qpid/broker/Connection.cpp: * src/qpid/broker/BrokerChannel.cpp: Update for ChannelAdapter changes. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551336 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/ChannelAdapter.h')
-rw-r--r--cpp/src/qpid/framing/ChannelAdapter.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/cpp/src/qpid/framing/ChannelAdapter.h b/cpp/src/qpid/framing/ChannelAdapter.h
index 75e4d26ab3..0597e5e372 100644
--- a/cpp/src/qpid/framing/ChannelAdapter.h
+++ b/cpp/src/qpid/framing/ChannelAdapter.h
@@ -1,3 +1,6 @@
+
+
+
#ifndef _ChannelAdapter_
#define _ChannelAdapter_
@@ -28,40 +31,39 @@
#include "Responder.h"
#include "Correlator.h"
#include "amqp_types.h"
+#include "FrameHandler.h"
namespace qpid {
namespace framing {
class MethodContext;
-// FIXME aconway 2007-02-20: Rename as ChannelBase or just Channel.
-
/**
* Base class for client and broker channels.
*
- * - receives frame bodies from the network.
- * - Updates request/response data.
- * - Dispatches requests with a MethodContext for responses.
+ * Provides in/out handler chains containing channel handlers.
+ * Chains may be modified by ChannelUpdaters registered with the broker.
+ *
+ * The handlers provided by the ChannelAdapter update request/response data.
*
- * send()
- * - Updates request/resposne ID data.
- * - Forwards frame to the peer.
+ * send() constructs a frame, updates request/resposne ID and forwards it
+ * to the out() chain.
*
* Thread safety: OBJECT UNSAFE. Instances must not be called
* concurrently. AMQP defines channels to be serialized.
*/
-class ChannelAdapter : public BodyHandler {
+class ChannelAdapter : private BodyHandler {
public:
/**
*@param output Processed frames are forwarded to this handler.
*/
- ChannelAdapter(ChannelId id_=0, OutputHandler* out_=0,
- ProtocolVersion ver=ProtocolVersion())
- : id(id_), out(out_), version(ver) {}
+ ChannelAdapter() : id(0) {}
/** Initialize the channel adapter. */
void init(ChannelId, OutputHandler&, ProtocolVersion);
+ FrameHandler::Chains& getHandlers() { return handlers; }
+
ChannelId getId() const { return id; }
ProtocolVersion getVersion() const { return version; }
@@ -79,10 +81,6 @@ class ChannelAdapter : public BodyHandler {
/**@deprecated Use make_shared_ptr with the other send() override */
RequestId send(AMQBody* body) { return send(AMQBody::shared_ptr(body)); }
- void handleMethod(shared_ptr<AMQMethodBody>);
- void handleRequest(shared_ptr<AMQRequestBody>);
- void handleResponse(shared_ptr<AMQResponseBody>);
-
virtual bool isOpen() const = 0;
protected:
@@ -99,12 +97,19 @@ class ChannelAdapter : public BodyHandler {
RequestId getNextSendRequestId() { return requester.getNextId(); }
private:
+ class ChannelAdapterHandler;
+ friend class ChannelAdapterHandler;
+
+ void handleMethod(shared_ptr<AMQMethodBody>);
+ void handleRequest(shared_ptr<AMQRequestBody>);
+ void handleResponse(shared_ptr<AMQResponseBody>);
+
ChannelId id;
- OutputHandler* out;
ProtocolVersion version;
Requester requester;
Responder responder;
Correlator correlator;
+ FrameHandler::Chains handlers;
};
}}