summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/HostnameLookup.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-24 09:27:55 +0100
committerMattes D <github@xoft.cz>2015-01-24 09:27:55 +0100
commitf91de20ca14725a41ea082b61a98477427c78528 (patch)
tree7925214f6faec943d0bdffc3c2706eed8fe744e9 /src/OSSupport/HostnameLookup.h
parentMerge pull request #1712 from UltraCoderRU/fix_coverity (diff)
parentcNetwork: Added self pointers to keep objects alive for callbacks. (diff)
downloadcuberite-f91de20ca14725a41ea082b61a98477427c78528.tar
cuberite-f91de20ca14725a41ea082b61a98477427c78528.tar.gz
cuberite-f91de20ca14725a41ea082b61a98477427c78528.tar.bz2
cuberite-f91de20ca14725a41ea082b61a98477427c78528.tar.lz
cuberite-f91de20ca14725a41ea082b61a98477427c78528.tar.xz
cuberite-f91de20ca14725a41ea082b61a98477427c78528.tar.zst
cuberite-f91de20ca14725a41ea082b61a98477427c78528.zip
Diffstat (limited to 'src/OSSupport/HostnameLookup.h')
-rw-r--r--src/OSSupport/HostnameLookup.h47
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;
+
+
+
+
+