diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-12-02 20:42:30 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-12-03 08:09:01 (GMT) |
commit | 5608da36a3a319070494d5a70ff984e7c172186e (patch) | |
tree | 2c44df5a9f0ea0ab180763222e54aece5dc65c93 /Swiften/Network/StaticDomainNameResolver.h | |
parent | 6e50bd41dc3f11815a40dfef500dc0d61ea5d737 (diff) | |
download | swift-contrib-5608da36a3a319070494d5a70ff984e7c172186e.zip swift-contrib-5608da36a3a319070494d5a70ff984e7c172186e.tar.bz2 |
DNS querying is now asynchronous.
This means we can now move them to a separate thread.
Diffstat (limited to 'Swiften/Network/StaticDomainNameResolver.h')
-rw-r--r-- | Swiften/Network/StaticDomainNameResolver.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Swiften/Network/StaticDomainNameResolver.h b/Swiften/Network/StaticDomainNameResolver.h index 8688429..ed8c613 100644 --- a/Swiften/Network/StaticDomainNameResolver.h +++ b/Swiften/Network/StaticDomainNameResolver.h @@ -3,21 +3,38 @@ #include <vector> #include <map> +#include "Swiften/Network/HostAddress.h" +#include "Swiften/Network/HostAddressPort.h" #include "Swiften/Network/DomainNameResolver.h" +#include "Swiften/Network/DomainNameServiceQuery.h" +#include "Swiften/Network/DomainNameAddressQuery.h" namespace Swift { class String; class StaticDomainNameResolver : public DomainNameResolver { public: - StaticDomainNameResolver(); + typedef std::map<String, HostAddress> AddressesMap; + typedef std::vector< std::pair<String, DomainNameServiceQuery::Result> > ServicesCollection; - virtual std::vector<HostAddressPort> resolve(const String& domain); + public: + void addAddress(const String& domain, const HostAddress& address); + void addService(const String& service, const DomainNameServiceQuery::Result& result); + void addXMPPClientService(const String& domain, const HostAddressPort&); + + const AddressesMap& getAddresses() const { + return addresses; + } + + const ServicesCollection& getServices() const { + return services; + } - void addDomain(const String& domain, const HostAddressPort& addressPort); + virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name); + virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name); private: - typedef std::vector< std::pair<String, HostAddressPort> > DomainCollection; - DomainCollection domains; + AddressesMap addresses; + ServicesCollection services; }; } |