diff options
author | Howaner <franzi.moos@googlemail.com> | 2015-01-25 00:57:20 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2015-01-25 00:57:20 +0100 |
commit | 6678863f7f7c0fd29bc81e13144f0f054b0162eb (patch) | |
tree | a2ce3bb46e396f50f4742711864d9e0327df6457 /src/OSSupport/HostnameLookup.h | |
parent | Added sponge. (diff) | |
parent | Gamosocm support (diff) | |
download | cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar.gz cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar.bz2 cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar.lz cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar.xz cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.tar.zst cuberite-6678863f7f7c0fd29bc81e13144f0f054b0162eb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/HostnameLookup.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/OSSupport/HostnameLookup.h b/src/OSSupport/HostnameLookup.h new file mode 100644 index 000000000..d69f24707 --- /dev/null +++ b/src/OSSupport/HostnameLookup.h @@ -0,0 +1,47 @@ + +// HostnameLookup.h + +// Declares the cHostnameLookup class representing an in-progress hostname-to-IP lookup + +// This is an internal header, no-one outside OSSupport should need to include it; use Network.h instead + + + + + +#pragma once + +#include "Network.h" +#include <event2/util.h> + + + + + +/** Holds information about an in-progress Hostname-to-IP lookup. */ +class cHostnameLookup +{ +public: + /** Creates the lookup object. Doesn't start the lookup yet. */ + cHostnameLookup(cNetwork::cResolveNameCallbacksPtr a_Callbacks); + + /** Starts the lookup. */ + void Lookup(const AString & a_Hostname); + +protected: + + /** The callbacks to call for resolved names / errors. */ + cNetwork::cResolveNameCallbacksPtr m_Callbacks; + + /** The hostname that was queried (needed for the callbacks). */ + AString m_Hostname; + + static void Callback(int a_ErrCode, struct evutil_addrinfo * a_Addr, void * a_Self); +}; +typedef SharedPtr<cHostnameLookup> cHostnameLookupPtr; +typedef std::vector<cHostnameLookupPtr> cHostnameLookupPtrs; + + + + + |