00001 #ifndef QPID_CLIENT_CONNECTION_H
00002 #define QPID_CLIENT_CONNECTION_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <map>
00025 #include <string>
00026 #include "qpid/client/Session.h"
00027
00028 namespace qpid {
00029
00030 class Url;
00031
00032 namespace client {
00033
00034 class ConnectionSettings;
00035 class ConnectionImpl;
00036
00044 class Connection
00045 {
00046 framing::ProtocolVersion version;
00047
00048 boost::function<void ()> failureCallback;
00049
00050
00051 protected:
00052 boost::shared_ptr<ConnectionImpl> impl;
00053
00054
00055 public:
00060 Connection();
00061
00062 ~Connection();
00063
00081 void open(const std::string& host, int port = 5672,
00082 const std::string& uid = "guest",
00083 const std::string& pwd = "guest",
00084 const std::string& virtualhost = "/", uint16_t maxFrameSize=65535);
00085
00103 void open(const Url& url,
00104 const std::string& uid = "guest",
00105 const std::string& pwd = "guest",
00106 const std::string& virtualhost = "/", uint16_t maxFrameSize=65535);
00107
00113 void open(const ConnectionSettings& settings);
00114
00121 void close();
00122
00164 Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0);
00165
00170 void resume(Session& session);
00171
00172 bool isOpen() const;
00173
00174 std::vector<Url> getKnownBrokers();
00175 void registerFailureCallback ( boost::function<void ()> fn );
00176
00177 friend class ConnectionAccess;
00178 friend class SessionBase_0_10;
00179 };
00180
00181 }}
00182
00183
00184 #endif