00001 #ifndef QPID_CLUSTER_CONNCTIONCODEC_H
00002 #define QPID_CLUSTER_CONNCTIONCODEC_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "qpid/amqp_0_10/Connection.h"
00026 #include "qpid/cluster/Connection.h"
00027 #include <boost/shared_ptr.hpp>
00028 #include <boost/intrusive_ptr.hpp>
00029
00030 namespace qpid {
00031
00032 namespace broker {
00033 class Connection;
00034 }
00035
00036 namespace cluster {
00037 class Cluster;
00038
00048 class ConnectionCodec : public sys::ConnectionCodec {
00049 public:
00050 struct Factory : public sys::ConnectionCodec::Factory {
00051 boost::shared_ptr<sys::ConnectionCodec::Factory> next;
00052 Cluster& cluster;
00053 Factory(boost::shared_ptr<sys::ConnectionCodec::Factory> f, Cluster& c) : next(f), cluster(c) {}
00054 sys::ConnectionCodec* create(framing::ProtocolVersion, sys::OutputControl&, const std::string& id);
00055 sys::ConnectionCodec* create(sys::OutputControl&, const std::string& id);
00056 };
00057
00058 ConnectionCodec(sys::OutputControl& out, const std::string& id, Cluster& c);
00059 ~ConnectionCodec();
00060
00061
00062 size_t decode(const char* buffer, size_t size);
00063 size_t encode(const char* buffer, size_t size);
00064 bool canEncode();
00065 void closed();
00066 bool isClosed() const;
00067 framing::ProtocolVersion getVersion() const;
00068
00069
00070 private:
00071 amqp_0_10::Connection codec;
00072 boost::intrusive_ptr<cluster::Connection> interceptor;
00073 };
00074
00075 }}
00076
00077 #endif