diff options
-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 | ||||
-rwxr-xr-x | python/commands/qpid-route | 11 | ||||
-rw-r--r-- | specs/management-schema.xml | 4 |
8 files changed, 39 insertions, 24 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, diff --git a/python/commands/qpid-route b/python/commands/qpid-route index 8077e95278..d7140d5e4b 100755 --- a/python/commands/qpid-route +++ b/python/commands/qpid-route @@ -50,6 +50,7 @@ _verbose = False _quiet = False _durable = False _dellink = False +_transport = "tcp" class RouteManager: def __init__ (self, destBroker): @@ -84,8 +85,9 @@ class RouteManager: mech = "ANONYMOUS" else: mech = "PLAIN" - res = broker.connect(self.src.host, self.src.port, False, _durable, - mech, self.src.authName, self.src.authPass) + res = broker.connect(self.src.host, self.src.port, _durable, + mech, self.src.authName, self.src.authPass, + _transport) if _verbose: print "Connect method returned:", res.status, res.text link = self.getLink() @@ -131,8 +133,9 @@ class RouteManager: mech = "ANONYMOUS" else: mech = "PLAIN" - res = broker.connect(self.src.host, self.src.port, False, _durable, - mech, self.src.authName, self.src.authPass) + res = broker.connect(self.src.host, self.src.port, _durable, + mech, self.src.authName, self.src.authPass, + _transport) if _verbose: print "Connect method returned:", res.status, res.text link = self.getLink() diff --git a/specs/management-schema.xml b/specs/management-schema.xml index 649832dffa..3e20902504 100644 --- a/specs/management-schema.xml +++ b/specs/management-schema.xml @@ -79,11 +79,11 @@ <method name="connect" desc="Establish a connection to another broker"> <arg name="host" dir="I" type="sstr"/> <arg name="port" dir="I" type="uint32"/> - <arg name="useSsl" dir="I" type="bool"/> <arg name="durable" dir="I" type="bool"/> <arg name="authMechanism" dir="I" type="sstr"/> <arg name="username" dir="I" type="sstr"/> <arg name="password" dir="I" type="sstr"/> + <arg name="transport" dir="I" type="sstr"/> </method> <method name="queueMoveMessages" desc="Move messages from one queue to another"> @@ -233,7 +233,7 @@ <property name="vhostRef" type="objId" references="Vhost" access="RC" index="y" parentRef="y"/> <property name="host" type="sstr" access="RC" index="y"/> <property name="port" type="uint16" access="RC" index="y"/> - <property name="useSsl" type="bool" access="RC"/> + <property name="transport" type="sstr" access="RC"/> <property name="durable" type="bool" access="RC"/> <statistic name="state" type="sstr" desc="Operational state of the link"/> |