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)
00054 : next(f), cluster(c) {}
00055 sys::ConnectionCodec* create(framing::ProtocolVersion, sys::OutputControl&, const std::string& id);
00056 sys::ConnectionCodec* create(sys::OutputControl&, const std::string& id);
00057 };
00058
00059 ConnectionCodec(sys::OutputControl& out, const std::string& id, Cluster& c, bool catchUp);
00060 ~ConnectionCodec();
00061
00062
00063 size_t decode(const char* buffer, size_t size);
00064 size_t encode(const char* buffer, size_t size);
00065 bool canEncode();
00066 void closed();
00067 bool isClosed() const;
00068 framing::ProtocolVersion getVersion() const;
00069
00070
00071 private:
00072 amqp_0_10::Connection codec;
00073 boost::intrusive_ptr<cluster::Connection> interceptor;
00074 cluster::ConnectionId id;
00075 std::string localId;
00076 };
00077
00078 }}
00079
00080 #endif