diff options
| author | Alan Conway <aconway@apache.org> | 2010-05-11 14:39:58 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2010-05-11 14:39:58 +0000 |
| commit | 16da0e0c511c0c1cf4ea592640c522754065200a (patch) | |
| tree | 59fb80994db731fabe19897c95a6912e68716360 /cpp/src/qpid/Address.cpp | |
| parent | be8e1bf6b6a0d760bddbbe6642d477a95f36ab42 (diff) | |
| download | qpid-python-16da0e0c511c0c1cf4ea592640c522754065200a.tar.gz | |
Support for multiple protocols in qpid::Url.
- simplified qpid::Address to hold (protocol,host,port) triples.
- protocol plugins call Url:addProtocol to add tags to Url parser.
- use Address::protocol when establishing connections.
- ssl_test: tests using URL to connect.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@943130 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Address.cpp')
| -rw-r--r-- | cpp/src/qpid/Address.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/cpp/src/qpid/Address.cpp b/cpp/src/qpid/Address.cpp index c3f6829fd3..e2b2dfbcdf 100644 --- a/cpp/src/qpid/Address.cpp +++ b/cpp/src/qpid/Address.cpp @@ -17,6 +17,7 @@ */ #include "qpid/Address.h" +#include "qpid/client/ConnectionSettings.h" #include <ostream> @@ -24,35 +25,14 @@ using namespace std; namespace qpid { -TcpAddress::TcpAddress(const std::string& h, uint16_t p): host(h), port(p) {} +const string Address::TCP("tcp"); -struct AddressOstreamVisitor : public boost::static_visitor<ostream&> { - ostream& out; - AddressOstreamVisitor(ostream& o) : out(o) {} - template <class T> ostream& operator()(const T& data) { return out << data; } -}; - -ostream& operator<<(ostream& os, const Address& addr) { - AddressOstreamVisitor visitor(os); - return boost::apply_visitor(visitor, addr.value); -} - -bool operator==(const TcpAddress& x, const TcpAddress& y) { - return y.host==x.host && y.port == x.port; -} - -ostream& operator<<(ostream& os, const TcpAddress& a) { - return os << "tcp:" << a.host << ":" << a.port; -} - -ExampleAddress::ExampleAddress(const char c) : data(c) {} - -bool operator==(const ExampleAddress& x, const ExampleAddress& y) { - return x.data == y.data; +ostream& operator<<(ostream& os, const Address& a) { + return os << a.protocol << ":" << a.host << ":" << a.port; } -ostream& operator<<(ostream& os, const ExampleAddress& ex) { - return os << "example:" << ex.data; +bool operator==(const Address& x, const Address& y) { + return y.protocol==x.protocol && y.host==x.host && y.port == x.port; } } // namespace qpid |
