summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/BoostConnection.cpp2
-rw-r--r--Swiften/Network/CAresDomainNameResolver.cpp16
-rw-r--r--Swiften/Network/CAresDomainNameResolver.h4
-rw-r--r--Swiften/Network/Connection.h2
-rw-r--r--Swiften/Network/Connector.cpp4
-rw-r--r--Swiften/Network/Connector.h10
-rw-r--r--Swiften/Network/DomainNameResolver.h8
-rw-r--r--Swiften/Network/DomainNameServiceQuery.h6
-rw-r--r--Swiften/Network/HostAddress.cpp6
-rw-r--r--Swiften/Network/HostAddress.h4
-rw-r--r--Swiften/Network/PlatformDomainNameAddressQuery.cpp4
-rw-r--r--Swiften/Network/PlatformDomainNameAddressQuery.h6
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.cpp6
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.h6
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.cpp10
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.h6
-rw-r--r--Swiften/Network/StaticDomainNameResolver.cpp24
-rw-r--r--Swiften/Network/StaticDomainNameResolver.h18
-rw-r--r--Swiften/Network/UnitTest/HostAddressTest.cpp2
19 files changed, 72 insertions, 72 deletions
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index 3f33cfc..f7ff8c4 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -12,7 +12,7 @@
#include <Swiften/Base/Log.h>
#include "Swiften/EventLoop/EventLoop.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Network/HostAddressPort.h"
#include "Swiften/Base/sleep.h"
diff --git a/Swiften/Network/CAresDomainNameResolver.cpp b/Swiften/Network/CAresDomainNameResolver.cpp
index 8462e4f..dd49139 100644
--- a/Swiften/Network/CAresDomainNameResolver.cpp
+++ b/Swiften/Network/CAresDomainNameResolver.cpp
@@ -26,7 +26,7 @@ namespace Swift {
class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public EventOwner {
public:
- CAresQuery(const String& query, int dnsclass, int type, CAresDomainNameResolver* resolver) : query(query), dnsclass(dnsclass), type(type), resolver(resolver) {
+ CAresQuery(const std::string& query, int dnsclass, int type, CAresDomainNameResolver* resolver) : query(query), dnsclass(dnsclass), type(type), resolver(resolver) {
}
virtual ~CAresQuery() {
@@ -37,7 +37,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve
}
void doRun(ares_channel* channel) {
- ares_query(*channel, query.getUTF8Data(), dnsclass, type, &CAresQuery::handleResult, this);
+ ares_query(*channel, query.c_str(), dnsclass, type, &CAresQuery::handleResult, this);
}
static void handleResult(void* arg, int status, int timeouts, unsigned char* buffer, int len) {
@@ -47,7 +47,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve
virtual void handleResult(int status, int, unsigned char* buffer, int len) = 0;
private:
- String query;
+ std::string query;
int dnsclass;
int type;
CAresDomainNameResolver* resolver;
@@ -55,7 +55,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve
class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQuery {
public:
- CAresDomainNameServiceQuery(const String& service, CAresDomainNameResolver* resolver) : CAresQuery(service, 1, 33, resolver) {
+ CAresDomainNameServiceQuery(const std::string& service, CAresDomainNameResolver* resolver) : CAresQuery(service, 1, 33, resolver) {
}
virtual void run() {
@@ -72,7 +72,7 @@ class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQ
record.priority = rawRecords->priority;
record.weight = rawRecords->weight;
record.port = rawRecords->port;
- record.hostname = String(rawRecords->host);
+ record.hostname = std::string(rawRecords->host);
records.push_back(record);
}
}
@@ -87,7 +87,7 @@ class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQ
class CAresDomainNameAddressQuery : public DomainNameAddressQuery, public CAresQuery {
public:
- CAresDomainNameAddressQuery(const String& host, CAresDomainNameResolver* resolver) : CAresQuery(host, 1, 1, resolver) {
+ CAresDomainNameAddressQuery(const std::string& host, CAresDomainNameResolver* resolver) : CAresQuery(host, 1, 1, resolver) {
}
virtual void run() {
@@ -129,11 +129,11 @@ CAresDomainNameResolver::~CAresDomainNameResolver() {
ares_destroy(channel);
}
-boost::shared_ptr<DomainNameServiceQuery> CAresDomainNameResolver::createServiceQuery(const String& name) {
+boost::shared_ptr<DomainNameServiceQuery> CAresDomainNameResolver::createServiceQuery(const std::string& name) {
return boost::shared_ptr<DomainNameServiceQuery>(new CAresDomainNameServiceQuery(getNormalized(name), this));
}
-boost::shared_ptr<DomainNameAddressQuery> CAresDomainNameResolver::createAddressQuery(const String& name) {
+boost::shared_ptr<DomainNameAddressQuery> CAresDomainNameResolver::createAddressQuery(const std::string& name) {
return boost::shared_ptr<DomainNameAddressQuery>(new CAresDomainNameAddressQuery(getNormalized(name), this));
}
diff --git a/Swiften/Network/CAresDomainNameResolver.h b/Swiften/Network/CAresDomainNameResolver.h
index 74bb6ae..a630b61 100644
--- a/Swiften/Network/CAresDomainNameResolver.h
+++ b/Swiften/Network/CAresDomainNameResolver.h
@@ -21,8 +21,8 @@ namespace Swift {
CAresDomainNameResolver();
~CAresDomainNameResolver();
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name);
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name);
+ virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name);
+ virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
private:
friend class CAresQuery;
diff --git a/Swiften/Network/Connection.h b/Swiften/Network/Connection.h
index 712f145..529dd82 100644
--- a/Swiften/Network/Connection.h
+++ b/Swiften/Network/Connection.h
@@ -10,7 +10,7 @@
#include "Swiften/Base/boost_bsignals.h"
#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Network/HostAddressPort.h"
namespace Swift {
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index 28088c5..868bd50 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -17,7 +17,7 @@
namespace Swift {
-Connector::Connector(const String& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true) {
+Connector::Connector(const std::string& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true) {
}
void Connector::setTimeoutMilliseconds(int milliseconds) {
@@ -45,7 +45,7 @@ void Connector::stop() {
finish(boost::shared_ptr<Connection>());
}
-void Connector::queryAddress(const String& hostname) {
+void Connector::queryAddress(const std::string& hostname) {
assert(!addressQuery);
addressQuery = resolver->createAddressQuery(hostname);
addressQuery->onResult.connect(boost::bind(&Connector::handleAddressQueryResult, shared_from_this(), _1, _2));
diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h
index 52779c2..b3e7d83 100644
--- a/Swiften/Network/Connector.h
+++ b/Swiften/Network/Connector.h
@@ -14,7 +14,7 @@
#include "Swiften/Network/Connection.h"
#include "Swiften/Network/Timer.h"
#include "Swiften/Network/HostAddressPort.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Network/DomainNameResolveError.h"
namespace Swift {
@@ -27,7 +27,7 @@ namespace Swift {
public:
typedef boost::shared_ptr<Connector> ref;
- static Connector::ref create(const String& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
+ static Connector::ref create(const std::string& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
return Connector::ref(new Connector(hostname, resolver, connectionFactory, timerFactory));
}
@@ -38,11 +38,11 @@ namespace Swift {
boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished;
private:
- Connector(const String& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
+ Connector(const std::string& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
void handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result);
void handleAddressQueryResult(const std::vector<HostAddress>& address, boost::optional<DomainNameResolveError> error);
- void queryAddress(const String& hostname);
+ void queryAddress(const std::string& hostname);
void tryNextServiceOrFallback();
void tryNextAddress();
@@ -54,7 +54,7 @@ namespace Swift {
private:
- String hostname;
+ std::string hostname;
DomainNameResolver* resolver;
ConnectionFactory* connectionFactory;
TimerFactory* timerFactory;
diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h
index cf9d521..b0ebc35 100644
--- a/Swiften/Network/DomainNameResolver.h
+++ b/Swiften/Network/DomainNameResolver.h
@@ -8,18 +8,18 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/String.h"
+#include <string>
namespace Swift {
class DomainNameServiceQuery;
class DomainNameAddressQuery;
- class String;
+
class DomainNameResolver {
public:
virtual ~DomainNameResolver();
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name) = 0;
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name) = 0;
+ virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name) = 0;
+ virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0;
};
}
diff --git a/Swiften/Network/DomainNameServiceQuery.h b/Swiften/Network/DomainNameServiceQuery.h
index fb44e82..63d5841 100644
--- a/Swiften/Network/DomainNameServiceQuery.h
+++ b/Swiften/Network/DomainNameServiceQuery.h
@@ -11,7 +11,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Network/DomainNameResolveError.h"
namespace Swift {
@@ -20,8 +20,8 @@ namespace Swift {
typedef boost::shared_ptr<DomainNameServiceQuery> ref;
struct Result {
- Result(const String& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {}
- String hostname;
+ Result(const std::string& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {}
+ std::string hostname;
int port;
int priority;
int weight;
diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp
index b3876c0..7acd407 100644
--- a/Swiften/Network/HostAddress.cpp
+++ b/Swiften/Network/HostAddress.cpp
@@ -13,16 +13,16 @@
#include <boost/array.hpp>
#include "Swiften/Base/foreach.h"
-#include "Swiften/Base/String.h"
+#include <string>
namespace Swift {
HostAddress::HostAddress() {
}
-HostAddress::HostAddress(const String& address) {
+HostAddress::HostAddress(const std::string& address) {
try {
- address_ = boost::asio::ip::address::from_string(address.getUTF8String());
+ address_ = boost::asio::ip::address::from_string(address);
}
catch (const std::exception& t) {
}
diff --git a/Swiften/Network/HostAddress.h b/Swiften/Network/HostAddress.h
index 6e2bde0..34ccd24 100644
--- a/Swiften/Network/HostAddress.h
+++ b/Swiften/Network/HostAddress.h
@@ -11,12 +11,12 @@
#include <boost/asio.hpp>
namespace Swift {
- class String;
+
class HostAddress {
public:
HostAddress();
- HostAddress(const String&);
+ HostAddress(const std::string&);
HostAddress(const unsigned char* address, int length);
HostAddress(const boost::asio::ip::address& address);
diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.cpp b/Swiften/Network/PlatformDomainNameAddressQuery.cpp
index 2a8574d..1832255 100644
--- a/Swiften/Network/PlatformDomainNameAddressQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameAddressQuery.cpp
@@ -11,7 +11,7 @@
namespace Swift {
-PlatformDomainNameAddressQuery::PlatformDomainNameAddressQuery(const String& host, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), hostname(host), eventLoop(eventLoop) {
+PlatformDomainNameAddressQuery::PlatformDomainNameAddressQuery(const std::string& host, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), hostname(host), eventLoop(eventLoop) {
}
void PlatformDomainNameAddressQuery::run() {
@@ -21,7 +21,7 @@ void PlatformDomainNameAddressQuery::run() {
void PlatformDomainNameAddressQuery::runBlocking() {
//std::cout << "PlatformDomainNameResolver::doRun()" << std::endl;
boost::asio::ip::tcp::resolver resolver(ioService);
- boost::asio::ip::tcp::resolver::query query(hostname.getUTF8String(), "5222");
+ boost::asio::ip::tcp::resolver::query query(hostname, "5222");
try {
//std::cout << "PlatformDomainNameResolver::doRun(): Resolving" << std::endl;
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(query);
diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.h b/Swiften/Network/PlatformDomainNameAddressQuery.h
index 0153688..c2854ac 100644
--- a/Swiften/Network/PlatformDomainNameAddressQuery.h
+++ b/Swiften/Network/PlatformDomainNameAddressQuery.h
@@ -12,7 +12,7 @@
#include <Swiften/Network/DomainNameAddressQuery.h>
#include <Swiften/Network/PlatformDomainNameQuery.h>
#include <Swiften/EventLoop/EventOwner.h>
-#include <Swiften/Base/String.h>
+#include <string>
namespace Swift {
class PlatformDomainNameResolver;
@@ -20,7 +20,7 @@ namespace Swift {
class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner {
public:
- PlatformDomainNameAddressQuery(const String& host, EventLoop* eventLoop, PlatformDomainNameResolver*);
+ PlatformDomainNameAddressQuery(const std::string& host, EventLoop* eventLoop, PlatformDomainNameResolver*);
void run();
@@ -30,7 +30,7 @@ namespace Swift {
private:
boost::asio::io_service ioService;
- String hostname;
+ std::string hostname;
EventLoop* eventLoop;
};
}
diff --git a/Swiften/Network/PlatformDomainNameResolver.cpp b/Swiften/Network/PlatformDomainNameResolver.cpp
index ec23091..f2c1e36 100644
--- a/Swiften/Network/PlatformDomainNameResolver.cpp
+++ b/Swiften/Network/PlatformDomainNameResolver.cpp
@@ -15,7 +15,7 @@
#include <boost/thread.hpp>
#include <algorithm>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/IDN/IDNA.h"
#include "Swiften/Network/HostAddress.h"
#include "Swiften/EventLoop/EventLoop.h"
@@ -38,11 +38,11 @@ PlatformDomainNameResolver::~PlatformDomainNameResolver() {
delete thread;
}
-boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const String& name) {
+boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& name) {
return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(IDNA::getEncoded(name), eventLoop, this));
}
-boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const String& name) {
+boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) {
return boost::shared_ptr<DomainNameAddressQuery>(new PlatformDomainNameAddressQuery(IDNA::getEncoded(name), eventLoop, this));
}
diff --git a/Swiften/Network/PlatformDomainNameResolver.h b/Swiften/Network/PlatformDomainNameResolver.h
index 249f2e3..e681331 100644
--- a/Swiften/Network/PlatformDomainNameResolver.h
+++ b/Swiften/Network/PlatformDomainNameResolver.h
@@ -17,7 +17,7 @@
#include <Swiften/Network/DomainNameAddressQuery.h>
namespace Swift {
- class String;
+
class EventLoop;
class PlatformDomainNameResolver : public DomainNameResolver {
@@ -25,8 +25,8 @@ namespace Swift {
PlatformDomainNameResolver(EventLoop* eventLoop);
~PlatformDomainNameResolver();
- virtual DomainNameServiceQuery::ref createServiceQuery(const String& name);
- virtual DomainNameAddressQuery::ref createAddressQuery(const String& name);
+ virtual DomainNameServiceQuery::ref createServiceQuery(const std::string& name);
+ virtual DomainNameAddressQuery::ref createAddressQuery(const std::string& name);
private:
void run();
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
index 838b3cf..d3b3561 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
@@ -36,7 +36,7 @@ using namespace Swift;
namespace Swift {
-PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const String& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), eventLoop(eventLoop), service(service) {
+PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const std::string& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), eventLoop(eventLoop), service(service) {
}
void PlatformDomainNameServiceQuery::run() {
@@ -51,7 +51,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
#if defined(SWIFTEN_PLATFORM_WINDOWS)
DNS_RECORD* responses;
// FIXME: This conversion doesn't work if unicode is deffed above
- if (DnsQuery(service.getUTF8Data(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &responses, NULL) != ERROR_SUCCESS) {
+ if (DnsQuery(service.c_str(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &responses, NULL) != ERROR_SUCCESS) {
emitError();
return;
}
@@ -68,7 +68,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
// conversion to not work at all, but it does.
// Actually, it doesn't. Fix this and remove explicit cast
// Remove unicode undef above as well
- record.hostname = String((const char*) currentEntry->Data.SRV.pNameTarget);
+ record.hostname = std::string((const char*) currentEntry->Data.SRV.pNameTarget);
records.push_back(record);
}
currentEntry = currentEntry->pNext;
@@ -81,7 +81,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
ByteArray response;
response.resize(NS_PACKETSZ);
- int responseLength = res_query(const_cast<char*>(service.getUTF8Data()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(response.getData()), response.getSize());
+ int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(response.getData()), response.getSize());
if (responseLength == -1) {
SWIFT_LOG(debug) << "Error" << std::endl;
emitError();
@@ -151,7 +151,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
emitError();
return;
}
- record.hostname = String(entry.getData());
+ record.hostname = std::string(entry.getData());
records.push_back(record);
currentEntry += entryLength;
answersCount--;
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.h b/Swiften/Network/PlatformDomainNameServiceQuery.h
index c9dbd65..52f8bc1 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.h
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.h
@@ -10,7 +10,7 @@
#include "Swiften/Network/DomainNameServiceQuery.h"
#include "Swiften/EventLoop/EventOwner.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include <Swiften/Network/PlatformDomainNameQuery.h>
namespace Swift {
@@ -18,7 +18,7 @@ namespace Swift {
class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner {
public:
- PlatformDomainNameServiceQuery(const String& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver);
+ PlatformDomainNameServiceQuery(const std::string& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver);
virtual void run();
@@ -28,6 +28,6 @@ namespace Swift {
private:
EventLoop* eventLoop;
- String service;
+ std::string service;
};
}
diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp
index ccea2b7..a338272 100644
--- a/Swiften/Network/StaticDomainNameResolver.cpp
+++ b/Swiften/Network/StaticDomainNameResolver.cpp
@@ -10,13 +10,13 @@
#include <boost/lexical_cast.hpp>
#include "Swiften/Network/DomainNameResolveError.h"
-#include "Swiften/Base/String.h"
+#include <string>
using namespace Swift;
namespace {
struct ServiceQuery : public DomainNameServiceQuery, public boost::enable_shared_from_this<ServiceQuery> {
- ServiceQuery(const String& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), service(service), resolver(resolver) {}
+ ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), service(service), resolver(resolver) {}
virtual void run() {
if (!resolver->getIsResponsive()) {
@@ -36,12 +36,12 @@ namespace {
}
EventLoop* eventLoop;
- String service;
+ std::string service;
StaticDomainNameResolver* resolver;
};
struct AddressQuery : public DomainNameAddressQuery, public boost::enable_shared_from_this<AddressQuery> {
- AddressQuery(const String& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), host(host), resolver(resolver) {}
+ AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), host(host), resolver(resolver) {}
virtual void run() {
if (!resolver->getIsResponsive()) {
@@ -62,7 +62,7 @@ namespace {
}
EventLoop* eventLoop;
- String host;
+ std::string host;
StaticDomainNameResolver* resolver;
};
}
@@ -72,32 +72,32 @@ namespace Swift {
StaticDomainNameResolver::StaticDomainNameResolver(EventLoop* eventLoop) : eventLoop(eventLoop), isResponsive(true) {
}
-void StaticDomainNameResolver::addAddress(const String& domain, const HostAddress& address) {
+void StaticDomainNameResolver::addAddress(const std::string& domain, const HostAddress& address) {
addresses[domain].push_back(address);
}
-void StaticDomainNameResolver::addService(const String& service, const DomainNameServiceQuery::Result& result) {
+void StaticDomainNameResolver::addService(const std::string& service, const DomainNameServiceQuery::Result& result) {
services.push_back(std::make_pair(service, result));
}
-void StaticDomainNameResolver::addXMPPClientService(const String& domain, const HostAddressPort& address) {
+void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const HostAddressPort& address) {
static int hostid = 0;
- String hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid));
+ std::string hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid));
hostid++;
addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, address.getPort(), 0, 0));
addAddress(hostname, address.getAddress());
}
-void StaticDomainNameResolver::addXMPPClientService(const String& domain, const String& hostname, int port) {
+void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const std::string& hostname, int port) {
addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, port, 0, 0));
}
-boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const String& name) {
+boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& name) {
return boost::shared_ptr<DomainNameServiceQuery>(new ServiceQuery(name, this, eventLoop));
}
-boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const String& name) {
+boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) {
return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(name, this, eventLoop));
}
diff --git a/Swiften/Network/StaticDomainNameResolver.h b/Swiften/Network/StaticDomainNameResolver.h
index 39b2782..2ef1295 100644
--- a/Swiften/Network/StaticDomainNameResolver.h
+++ b/Swiften/Network/StaticDomainNameResolver.h
@@ -17,20 +17,20 @@
#include "Swiften/EventLoop/EventLoop.h"
namespace Swift {
- class String;
+
class StaticDomainNameResolver : public DomainNameResolver {
public:
- typedef std::map<String, std::vector<HostAddress> > AddressesMap;
- typedef std::vector< std::pair<String, DomainNameServiceQuery::Result> > ServicesCollection;
+ typedef std::map<std::string, std::vector<HostAddress> > AddressesMap;
+ typedef std::vector< std::pair<std::string, DomainNameServiceQuery::Result> > ServicesCollection;
public:
StaticDomainNameResolver(EventLoop* eventLoop);
- void addAddress(const String& domain, const HostAddress& address);
- void addService(const String& service, const DomainNameServiceQuery::Result& result);
- void addXMPPClientService(const String& domain, const HostAddressPort&);
- void addXMPPClientService(const String& domain, const String& host, int port);
+ void addAddress(const std::string& domain, const HostAddress& address);
+ void addService(const std::string& service, const DomainNameServiceQuery::Result& result);
+ void addXMPPClientService(const std::string& domain, const HostAddressPort&);
+ void addXMPPClientService(const std::string& domain, const std::string& host, int port);
const AddressesMap& getAddresses() const {
return addresses;
@@ -48,8 +48,8 @@ namespace Swift {
isResponsive = b;
}
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name);
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name);
+ virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name);
+ virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
private:
EventLoop* eventLoop;
diff --git a/Swiften/Network/UnitTest/HostAddressTest.cpp b/Swiften/Network/UnitTest/HostAddressTest.cpp
index 45793fa..7fb33ca 100644
--- a/Swiften/Network/UnitTest/HostAddressTest.cpp
+++ b/Swiften/Network/UnitTest/HostAddressTest.cpp
@@ -8,7 +8,7 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include "Swiften/Network/HostAddress.h"
-#include "Swiften/Base/String.h"
+#include <string>
using namespace Swift;