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 #include "qpid/client/ClientImportExport.h"
00028 #include "qpid/client/ConnectionSettings.h"
00029 #include "qpid/framing/ProtocolVersion.h"
00030
00031 #include "boost/function.hpp"
00032
00033 namespace qpid {
00034
00035 struct Url;
00036
00037 namespace client {
00038
00039 class ConnectionImpl;
00040
00063 class Connection
00064 {
00065 framing::ProtocolVersion version;
00066
00067 boost::function<void ()> failureCallback;
00068
00069
00070 protected:
00071 boost::shared_ptr<ConnectionImpl> impl;
00072
00073
00074 public:
00079 QPID_CLIENT_EXTERN Connection();
00080
00085 QPID_CLIENT_EXTERN ~Connection();
00086
00104 QPID_CLIENT_EXTERN void open(const std::string& host, int port = 5672,
00105 const std::string& uid = "guest",
00106 const std::string& pwd = "guest",
00107 const std::string& virtualhost = "/", uint16_t maxFrameSize=65535);
00108
00126 QPID_CLIENT_EXTERN void open(const Url& url,
00127 const std::string& uid = "guest",
00128 const std::string& pwd = "guest",
00129 const std::string& virtualhost = "/", uint16_t maxFrameSize=65535);
00130
00141 QPID_CLIENT_EXTERN void open(const Url& url, const ConnectionSettings& settings);
00142
00148 QPID_CLIENT_EXTERN void open(const ConnectionSettings& settings);
00149
00156 QPID_CLIENT_EXTERN void close();
00157
00199 QPID_CLIENT_EXTERN Session newSession(const std::string& name=std::string(), uint32_t timeoutSeconds = 0);
00200
00205 QPID_CLIENT_EXTERN void resume(Session& session);
00206
00207 QPID_CLIENT_EXTERN bool isOpen() const;
00208
00212 QPID_CLIENT_EXTERN std::vector<Url> getInitialBrokers();
00213
00214 QPID_CLIENT_EXTERN void registerFailureCallback ( boost::function<void ()> fn );
00215
00219 QPID_CLIENT_EXTERN const ConnectionSettings& getNegotiatedSettings();
00220
00221 friend struct ConnectionAccess;
00222 friend class SessionBase_0_10;
00223 };
00224
00225 }}
00226
00227
00228 #endif