00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _Bridge_
00022 #define _Bridge_
00023
00024 #include "PersistableConfig.h"
00025 #include "qpid/framing/AMQP_ServerProxy.h"
00026 #include "qpid/framing/ChannelHandler.h"
00027 #include "qpid/framing/Buffer.h"
00028 #include "qpid/management/Manageable.h"
00029 #include "qpid/management/ArgsLinkBridge.h"
00030 #include "qpid/management/Bridge.h"
00031
00032 #include <boost/function.hpp>
00033 #include <memory>
00034
00035 namespace qpid {
00036 namespace broker {
00037
00038 class ConnectionState;
00039 class Link;
00040 class LinkRegistry;
00041
00042 class Bridge : public PersistableConfig, public management::Manageable
00043 {
00044 public:
00045 typedef boost::shared_ptr<Bridge> shared_ptr;
00046 typedef boost::function<void(Bridge*)> CancellationListener;
00047
00048 Bridge(Link* link, framing::ChannelId id, CancellationListener l, const management::ArgsLinkBridge& args);
00049 ~Bridge();
00050
00051 void create(ConnectionState& c);
00052 void cancel();
00053 void destroy();
00054 bool isDurable() { return args.i_durable; }
00055
00056 management::ManagementObject::shared_ptr GetManagementObject() const;
00057 management::Manageable::status_t ManagementMethod(uint32_t methodId, management::Args& args);
00058
00059
00060 void setPersistenceId(uint64_t id) const;
00061 uint64_t getPersistenceId() const { return persistenceId; }
00062 uint32_t encodedSize() const;
00063 void encode(framing::Buffer& buffer) const;
00064 const std::string& getName() const;
00065 static Bridge::shared_ptr decode(LinkRegistry& links, framing::Buffer& buffer);
00066
00067 private:
00068 std::auto_ptr<framing::ChannelHandler> channelHandler;
00069 std::auto_ptr<framing::AMQP_ServerProxy::Session> session;
00070 std::auto_ptr<framing::AMQP_ServerProxy> peer;
00071
00072 Link* link;
00073 framing::ChannelId id;
00074 management::ArgsLinkBridge args;
00075 management::Bridge::shared_ptr mgmtObject;
00076 CancellationListener listener;
00077 std::string name;
00078 mutable uint64_t persistenceId;
00079 };
00080
00081
00082 }}
00083
00084 #endif