diff options
Diffstat (limited to 'net/host_resolver_helper')
-rw-r--r-- | net/host_resolver_helper/dyn_lib_loader.cc | 76 | ||||
-rw-r--r-- | net/host_resolver_helper/dyn_lib_loader.h | 103 | ||||
-rw-r--r-- | net/host_resolver_helper/dyn_lib_loader_decl.h | 51 | ||||
-rw-r--r-- | net/host_resolver_helper/host_resolver_helper.cc | 157 | ||||
-rw-r--r-- | net/host_resolver_helper/host_resolver_helper.h | 105 | ||||
-rw-r--r-- | net/host_resolver_helper/hosts_provider.h | 44 |
6 files changed, 0 insertions, 536 deletions
diff --git a/net/host_resolver_helper/dyn_lib_loader.cc b/net/host_resolver_helper/dyn_lib_loader.cc deleted file mode 100644 index 043e81a..0000000 --- a/net/host_resolver_helper/dyn_lib_loader.cc +++ /dev/null @@ -1,76 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ -#include "dyn_lib_loader.h" - -LibraryManager* LibraryManager::GetInstance() { - static LibraryManager mgr; - return &mgr; -} - -LibraryManager::~LibraryManager() { - for (LibDictionary::iterator it = libdict.begin(); it != libdict.end(); - it++) { - if (it->second) { - ReleaseLibraryModule(it->second); - } - } -} - -LibraryManager::MODULE_HANDLE_TYPE LibraryManager::GetLibraryHandleInternal(const std::string& libname) { - LibHandle& handle = libdict[libname]; - if (NULL == handle) { - //load module - handle = LoadLibraryModule(libname); - } - return handle; -} - -void* LibraryManager::GetSymbolInternal(const std::string& libname, const std::string& symbol) { - return LoadLibrarySymbol(GetLibraryHandleInternal(libname), symbol); -} - -void * LibraryManager::LoadLibrarySymbol(const MODULE_HANDLE_TYPE& lh, - const std::string& symname) { - void* symptr = NULL; - if (lh) { - symptr = dlsym(lh, symname.c_str()); - } - return symptr; -} - -LibraryManager::MODULE_HANDLE_TYPE LibraryManager::LoadLibraryModule(const std::string& libname) { - return dlopen(libname.c_str(), RTLD_LAZY); -} - -void LibraryManager::ReleaseLibraryModule(const MODULE_HANDLE_TYPE& lh) { - if (lh) { - dlclose(lh); - } -} - diff --git a/net/host_resolver_helper/dyn_lib_loader.h b/net/host_resolver_helper/dyn_lib_loader.h deleted file mode 100644 index 6e3b0f0..0000000 --- a/net/host_resolver_helper/dyn_lib_loader.h +++ /dev/null @@ -1,103 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ -#ifndef __DYN_LIB_LOADER_H__ -#define __DYN_LIB_LOADER_H__ - -#include <map> -#include <string> -#include <dlfcn.h> -#include "dyn_lib_loader_decl.h" - -template<class T> -inline T* GetInterfacePtr(void* funptr) { - typedef T* (*InterfaceFunPtr)(void); - if (NULL==funptr) { - return NULL; - } - InterfaceFunPtr fun = (InterfaceFunPtr) (funptr); - return fun(); -} - -//This macro is used by module which wishes to use the interface object exported by some other module -// libname - is the dynamic library full name, interface_class - is the interface class for which -// the object will be imported -// EXAMPLE: Interface* ptr = GET_DYNAMIC_OBJECT_INTERFACE_PTR("libmy.so",Interface); -#define GET_DYNAMIC_OBJECT_INTERFACE_PTR(__libname__,__interface_class__) \ - GetInterfacePtr<__interface_class__>(LibraryManager::GetFunctionPtr<__interface_class__>(__libname__,"Get" #__interface_class__ "Object")) - -//LibraryManager Connects to shared library reusing the lib handle -//if called from mutiple places. Get retrieve exported functions and library handle. -//This class is module level singletone. -class LibraryManager { -public: - - typedef void* MODULE_HANDLE_TYPE; - template<class RET_TYPE> - static RET_TYPE* GetFunctionPtr(const char* libname, const char* symbol) { - return static_cast<RET_TYPE*>(GetInstance()->GetSymbolInternal(libname, - symbol)); - } - - static MODULE_HANDLE_TYPE GetLibraryHandle(const char* libname) { - return GetInstance()->GetLibraryHandleInternal(libname); - } - -private: - template<class MODULE_HANDLE_TYPE> - class LibHandleType { - public: - LibHandleType() : - handle(NULL) { - } - LibHandleType(MODULE_HANDLE_TYPE h) : - handle(h) { - } - operator MODULE_HANDLE_TYPE() { - return handle; - } - private: - MODULE_HANDLE_TYPE handle; - }; - - typedef LibHandleType<MODULE_HANDLE_TYPE> LibHandle; - typedef std::map<std::string, LibHandle> LibDictionary; - - static LibraryManager* GetInstance(); - LibraryManager() {} - ~LibraryManager(); - void* GetSymbolInternal(const std::string& libname, const std::string& symbol); - MODULE_HANDLE_TYPE GetLibraryHandleInternal(const std::string& libname); - void * LoadLibrarySymbol(const MODULE_HANDLE_TYPE& lh, const std::string& symname); - MODULE_HANDLE_TYPE LoadLibraryModule(const std::string& libname); - void ReleaseLibraryModule(const MODULE_HANDLE_TYPE& lh); - - std::map<std::string, LibHandle> libdict; -}; - -#endif //__DYN_LIB_LOADER_H__ diff --git a/net/host_resolver_helper/dyn_lib_loader_decl.h b/net/host_resolver_helper/dyn_lib_loader_decl.h deleted file mode 100644 index a0ca0d6..0000000 --- a/net/host_resolver_helper/dyn_lib_loader_decl.h +++ /dev/null @@ -1,51 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ - -#ifndef __DYN_LIB_LOADER_DECL_H__ -#define __DYN_LIB_LOADER_DECL_H__ - -//This macro should be placed in module which is exporting the interface -//first parameter is the interface class, second is the function which returns the interface object -//EXAMPLE: DECLARE_DYNAMIC_OBJECT_INTERFACE(Interface,InterfaceImpl::GetInstance) -#define DECLARE_DYNAMIC_OBJECT_INTERFACE_EX(__interface_class__, __get_instance_method__) \ - extern "C" void* Get##__interface_class__##Object() \ - __attribute__ ((visibility ("default"))); \ - void* Get##__interface_class__##Object() {\ - __interface_class__* ptr = __get_instance_method__();\ - return static_cast<void*>(ptr);\ - } \ - -//This macro should be placed in module which is exporting the interface -//first parameter is the interface class, second is the class implemeting the static -//GetInstance function to get the interface object -//EXAMPLE: DECLARE_DYNAMIC_OBJECT_INTERFACE(Interface,InterfaceImpl) -#define DECLARE_DYNAMIC_OBJECT_INTERFACE(__interface_class__,__impl_class__) \ - DECLARE_DYNAMIC_OBJECT_INTERFACE_EX(__interface_class__,__impl_class__::GetInstance) \ - -#endif //__DYN_LIB_LOADER_DECL_H__ diff --git a/net/host_resolver_helper/host_resolver_helper.cc b/net/host_resolver_helper/host_resolver_helper.cc deleted file mode 100644 index 7c60fb5..0000000 --- a/net/host_resolver_helper/host_resolver_helper.cc +++ /dev/null @@ -1,157 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ -#include "host_resolver_helper.h" - -#include <config.h> -#include <unistd.h> - -#include "net/base/address_list.h" -#include "net/base/host_port_pair.h" -#include "net/base/completion_callback.h" -#include "net/base/host_port_pair.h" -#include "net/base/host_resolver.h" -#include "net/base/net_errors.h" -#include "net/base/net_log.h" -#include <cutils/properties.h> -#include "dyn_lib_loader.h" - -#define NUM_HOSTS_TO_RESOLVE 30 - -HostResolverHelper::HostResolverHelper(net::HostResolver* hostresolver) : - num_of_hosts_to_resolve(NUM_HOSTS_TO_RESOLVE), hostresolver_( - hostresolver), hostname_provider_(NULL) -{ - char value[PROPERTY_VALUE_MAX] = { '\0' }; - property_get("net.dnshostprio.num_hosts", value, NULL); - if (NULL != value && value[0] != '\0') { - int host_num = atol(value); - if (host_num <= 0) { - host_num = NUM_HOSTS_TO_RESOLVE; - } - num_of_hosts_to_resolve = host_num; - } -} - -HostResolverHelper::~HostResolverHelper() { -} - -void HostResolverHelper::Init(HostsProvider* provider) { - hostname_provider_ = provider; - LOG(INFO) << "DNSPreResolver::Init got hostprovider:" << provider; - if (hostresolver_) - hostresolver_->SetResolverExt(this); -} - -void HostResolverHelper::DoResolve(HostResolverHelper* obj) { - //TODO: Check there is another task like this in the queue and - // skip execution of the current one - obj->StartHostsResolution(); -} - -void HostResolverHelper::CancelAllRequests() { - //loop through all requests and cancel those that still pending - for (unsigned int i = 0; i < hostinfo_list_.size(); i++) { - if (hostinfo_list_[i]->pending) { - hostinfo_list_[i]->pending = false; - hostresolver_->CancelRequest(hostinfo_list_[i]->reqhandle); - } - } -} - -void HostResolverHelper::PrepareRequestsData(const std::vector<std::string>& hostnames) { - const int actual_hosts_num = hostnames.size(); - hostinfo_list_.clear(); - hostinfo_list_.reserve(actual_hosts_num); - for (int i = 0; i < actual_hosts_num; i++) { - hostinfo_list_.push_back(new HostInfo(hostnames[i].c_str())); - } -} - -bool HostResolverHelper::StartHostsResolution() { - if (NULL == hostresolver_) { - return false; - } - if (NULL == hostname_provider_) { - return false; - } - - //get hosts from the provider - std::vector < std::string > hostnames; - hostname_provider_->GetHosts(num_of_hosts_to_resolve, hostnames); - if (0 == hostnames.size()) { - return true; - } - //free old requests if any still active - CancelAllRequests(); - PrepareRequestsData(hostnames); - - const int actual_hosts_num = hostnames.size(); - //now issue resolve for each host - for (int i = 0; i < actual_hosts_num; i++) { - //TODO: set request priority - hostinfo_list_[i]->pending = true; - int rv = hostresolver_->Resolve(hostinfo_list_[i]->reqinfo, &hostinfo_list_[i]->addrlist, - &hostinfo_list_[i]->completion_callback_, &hostinfo_list_[i]->reqhandle, net::BoundNetLog()); - //in case we got it resolved synchronously (or error) - set as not pending - if (rv != net::ERR_IO_PENDING) { - hostinfo_list_[i]->pending = false; - } - } - return true; -} - -void HostResolverHelper::HostInfo::OnLookupFinished(int result) { - pending = false; -} - -HostResolverHelper::HostInfo::HostInfo(const std::string& hostname) : - reqinfo(net::HostPortPair(hostname, 80)), reqhandle(NULL), pending(false), completion_callback_(this, - &HostInfo::OnLookupFinished) { -} - - -net::HostResolver::HostnameResolverExt* CreateResolverIPObserver(net::HostResolver* hostResolver) { - char value[PROPERTY_VALUE_MAX] = { '\0' }; - const char* DNS_PRIORITY_EXTERNAL_LIB = "libdnshostprio.so"; - - if (NULL == hostResolver) { - return NULL; - } - property_get("net.dnshostprio.enable", value, NULL); - if (NULL != value && value[0] == '0') { - return NULL; - } - HostResolverHelper* dnsPreresolver = new HostResolverHelper(hostResolver); - if (NULL == dnsPreresolver) { - return NULL; - } - HostsProvider* provider = GET_DYNAMIC_OBJECT_INTERFACE_PTR(DNS_PRIORITY_EXTERNAL_LIB,HostsProvider); - dnsPreresolver->Init(provider); - return dnsPreresolver; -} diff --git a/net/host_resolver_helper/host_resolver_helper.h b/net/host_resolver_helper/host_resolver_helper.h deleted file mode 100644 index bc18a21..0000000 --- a/net/host_resolver_helper/host_resolver_helper.h +++ /dev/null @@ -1,105 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ -#ifndef __DNSRESOLVERHELPER_H__ -#define __DNSRESOLVERHELPER_H__ - -#include <vector> -#include <string> - -#include "config.h" -#include "net/base/host_resolver.h" -#include "net/base/address_list.h" -#include "net/base/net_log.h" -#include "net/base/net_errors.h" -#include "base/message_loop.h" -#include "net/base/completion_callback.h" -#include "hosts_provider.h" - -//This class does DNS pre-resolution and should be used by net::HostResolver -//It's lifetime is depending on the host resolver and they should be created and destroyed -// in the correct order -//TODO: make sure the resolver is never destroyed before the pre-resolver -class HostResolverHelper: public net::HostResolver::HostnameResolverExt { -public: - HostResolverHelper(net::HostResolver* hostresolver); - virtual ~HostResolverHelper(); - - /////////////////////////////////////////////////////////////////////////////////////// - // net::HostResolver::HostnamePreresolver interface - virtual void Resolve() { - MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableFunction(&HostResolverHelper::DoResolve, this), - 500); - } - /////////////////////////////////////////////////////////////////////////////////////// - - //task which is executed through the message loop - static void DoResolve(HostResolverHelper* obj); - - //call it to connect with the hostnames provider - void Init(HostsProvider* provider); - -private: - - //to be called when hosts pre-resolution is requested (worker function) - bool StartHostsResolution(); - -private: - int num_of_hosts_to_resolve; - net::HostResolver* hostresolver_; - HostsProvider* hostname_provider_; - // Delegate interface, for notification when the ResolveRequest completes. - - class HostInfo: public base::RefCounted<HostInfo> { - public: - net::AddressList addrlist; - net::HostResolver::RequestInfo reqinfo; - net::HostResolver::RequestHandle reqhandle; - bool pending; - net::CompletionCallbackImpl<HostInfo> completion_callback_; - - HostInfo(const std::string& hostname); - ~HostInfo() { - } - - void OnLookupFinished(int result); - - }; - - std::vector<scoped_refptr<HostInfo> > hostinfo_list_; - - //used to cancel all pending requests before issuing new ones - void CancelAllRequests(); - void PrepareRequestsData(const std::vector<std::string>& hostnames); - -}; - -//intialization for the webkit -net::HostResolver::HostnameResolverExt* CreateResolverIPObserver(net::HostResolver* hostResolver); - -#endif diff --git a/net/host_resolver_helper/hosts_provider.h b/net/host_resolver_helper/hosts_provider.h deleted file mode 100644 index 19b847d..0000000 --- a/net/host_resolver_helper/hosts_provider.h +++ /dev/null @@ -1,44 +0,0 @@ -/** --------------------------------------------------------------------------- - Copyright (c) 2011, Code Aurora Forum. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Code Aurora Forum, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -----------------------------------------------------------------------------**/ -#ifndef __HOSTSPROVIDER_H_INCL__ -#define __HOSTSPROVIDER_H_INCL__ - -#include <vector> -#include <string> - -class HostsProvider { -public: - virtual bool GetHosts(int max_hosts, std::vector<std::string>& list)=0; - virtual void ClearStatistics()=0; - virtual ~HostsProvider() { - } - ; -}; - -#endif // __HOSTSPROVIDER_H_INCL__ |