diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/Broker.cpp | 13 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Broker.h | 6 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Link.cpp | 19 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Link.h | 4 | ||||
-rw-r--r-- | cpp/src/qpid/broker/LinkRegistry.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/broker/LinkRegistry.h | 2 |
6 files changed, 30 insertions, 18 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 5ffac46474..410c5cdef0 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -341,15 +341,18 @@ Manageable::status_t Broker::ManagementMethod (uint32_t methodId, _qmf::ArgsBrokerConnect& hp= dynamic_cast<_qmf::ArgsBrokerConnect&>(args); - if (hp.i_useSsl) - return Manageable::STATUS_FEATURE_NOT_IMPLEMENTED; + string transport = hp.i_transport.empty() ? TCP_TRANSPORT : hp.i_transport; + if (!getProtocolFactory(transport)) { + QPID_LOG(error, "Transport '" << transport << "' not supported"); + return Manageable::STATUS_NOT_IMPLEMENTED; + } + QPID_LOG(info, "Connecting to " << hp.i_host << ":" << hp.i_port << " using '" << transport << "' as " << "'" << hp.i_username << "'"); std::pair<Link::shared_ptr, bool> response = - links.declare (hp.i_host, hp.i_port, hp.i_useSsl, hp.i_durable, + links.declare (hp.i_host, hp.i_port, transport, hp.i_durable, hp.i_authMechanism, hp.i_username, hp.i_password); if (hp.i_durable && response.second) store->create(*response.first); - status = Manageable::STATUS_OK; break; } @@ -398,7 +401,7 @@ void Broker::connect( { boost::shared_ptr<ProtocolFactory> pf = getProtocolFactory(transport); if (pf) pf->connect(poller, host, port, f ? f : factory.get(), failed); - else throw Exception(QPID_MSG("Unsupported transport type: " << transport)); + else throw NoSuchTransportException(QPID_MSG("Unsupported transport type: " << transport)); } void Broker::connect( diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h index 4b77c05209..c0c74a1493 100644 --- a/cpp/src/qpid/broker/Broker.h +++ b/cpp/src/qpid/broker/Broker.h @@ -64,6 +64,12 @@ namespace broker { static const uint16_t DEFAULT_PORT=5672; +struct NoSuchTransportException : qpid::Exception +{ + NoSuchTransportException(const std::string& s) : Exception(s) {} + virtual ~NoSuchTransportException() throw() {} +}; + /** * A broker instance. */ diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp index 02c8833541..7a06d7e0b9 100644 --- a/cpp/src/qpid/broker/Link.cpp +++ b/cpp/src/qpid/broker/Link.cpp @@ -44,14 +44,16 @@ Link::Link(LinkRegistry* _links, MessageStore* _store, string& _host, uint16_t _port, - bool _useSsl, + string& _transport, bool _durable, string& _authMechanism, string& _username, string& _password, Broker* _broker, management::Manageable* parent) - : links(_links), store(_store), host(_host), port(_port), useSsl(_useSsl), durable(_durable), + : links(_links), store(_store), host(_host), port(_port), + transport(_transport), + durable(_durable), authMechanism(_authMechanism), username(_username), password(_password), persistenceId(0), mgmtObject(0), broker(_broker), state(0), visitCount(0), @@ -65,7 +67,7 @@ Link::Link(LinkRegistry* _links, ManagementAgent* agent = ManagementAgent::Singleton::getInstance(); if (agent != 0) { - mgmtObject = new _qmf::Link(agent, this, parent, _host, _port, _useSsl, _durable); + mgmtObject = new _qmf::Link(agent, this, parent, _host, _port, _transport, _durable); if (!durable) agent->addObject(mgmtObject); } @@ -107,7 +109,7 @@ void Link::startConnectionLH () // Set the state before calling connect. It is possible that connect // will fail synchronously and call Link::closed before returning. setStateLH(STATE_CONNECTING); - broker->connect (host, port, useSsl ? "ssl" : Broker::TCP_TRANSPORT, + broker->connect (host, port, transport, boost::bind (&Link::closed, this, _1, _2)); } catch(std::exception& e) { setStateLH(STATE_WAITING); @@ -289,19 +291,20 @@ Link::shared_ptr Link::decode(LinkRegistry& links, Buffer& buffer) { string host; uint16_t port; + string transport; string authMechanism; string username; string password; buffer.getShortString(host); port = buffer.getShort(); - bool useSsl(buffer.getOctet()); + buffer.getShortString(transport); bool durable(buffer.getOctet()); buffer.getShortString(authMechanism); buffer.getShortString(username); buffer.getShortString(password); - return links.declare(host, port, useSsl, durable, authMechanism, username, password).first; + return links.declare(host, port, transport, durable, authMechanism, username, password).first; } void Link::encode(Buffer& buffer) const @@ -309,7 +312,7 @@ void Link::encode(Buffer& buffer) const buffer.putShortString(string("link")); buffer.putShortString(host); buffer.putShort(port); - buffer.putOctet(useSsl ? 1 : 0); + buffer.putShortString(transport); buffer.putOctet(durable ? 1 : 0); buffer.putShortString(authMechanism); buffer.putShortString(username); @@ -321,7 +324,7 @@ uint32_t Link::encodedSize() const return host.size() + 1 // short-string (host) + 5 // short-string ("link") + 2 // port - + 1 // useSsl + + transport.size() + 1 // short-string(transport) + 1 // durable + authMechanism.size() + 1 + username.size() + 1 diff --git a/cpp/src/qpid/broker/Link.h b/cpp/src/qpid/broker/Link.h index d09f58d9e4..69461472b1 100644 --- a/cpp/src/qpid/broker/Link.h +++ b/cpp/src/qpid/broker/Link.h @@ -47,7 +47,7 @@ namespace qpid { MessageStore* store; string host; uint16_t port; - bool useSsl; + string transport; bool durable; string authMechanism; string username; @@ -86,7 +86,7 @@ namespace qpid { MessageStore* store, string& host, uint16_t port, - bool useSsl, + string& transport, bool durable, string& authMechanism, string& username, diff --git a/cpp/src/qpid/broker/LinkRegistry.cpp b/cpp/src/qpid/broker/LinkRegistry.cpp index 8b0bebfcb2..5caf3ec801 100644 --- a/cpp/src/qpid/broker/LinkRegistry.cpp +++ b/cpp/src/qpid/broker/LinkRegistry.cpp @@ -56,7 +56,7 @@ void LinkRegistry::periodicMaintenance () pair<Link::shared_ptr, bool> LinkRegistry::declare(string& host, uint16_t port, - bool useSsl, + string& transport, bool durable, string& authMechanism, string& username, @@ -73,7 +73,7 @@ pair<Link::shared_ptr, bool> LinkRegistry::declare(string& host, { Link::shared_ptr link; - link = Link::shared_ptr (new Link (this, store, host, port, useSsl, durable, + link = Link::shared_ptr (new Link (this, store, host, port, transport, durable, authMechanism, username, password, broker, parent)); links[key] = link; diff --git a/cpp/src/qpid/broker/LinkRegistry.h b/cpp/src/qpid/broker/LinkRegistry.h index 5b5fe4fec9..d563412cc1 100644 --- a/cpp/src/qpid/broker/LinkRegistry.h +++ b/cpp/src/qpid/broker/LinkRegistry.h @@ -69,7 +69,7 @@ namespace broker { std::pair<Link::shared_ptr, bool> declare(std::string& host, uint16_t port, - bool useSsl, + std::string& transport, bool durable, std::string& authMechanism, std::string& username, |