summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/IPLookup.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-18 12:35:02 +0100
committerMattes D <github@xoft.cz>2015-01-22 20:13:02 +0100
commitd4682463a1d503c349ac95e275b11d67d402268c (patch)
treede3167d2b81eb909a419c1355021353e00e71074 /src/OSSupport/IPLookup.h
parentcNetwork: Split the main cpp file into several files. (diff)
downloadcuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar.gz
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar.bz2
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar.lz
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar.xz
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.tar.zst
cuberite-d4682463a1d503c349ac95e275b11d67d402268c.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/IPLookup.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/OSSupport/IPLookup.h b/src/OSSupport/IPLookup.h
index f39b955aa..af878cbf1 100644
--- a/src/OSSupport/IPLookup.h
+++ b/src/OSSupport/IPLookup.h
@@ -20,16 +20,25 @@
/** Holds information about an in-progress IP-to-Hostname lookup. */
class cIPLookup
{
+public:
+ /** Creates the lookup object. Doesn't start the lookup yet. */
+ cIPLookup(cNetwork::cResolveNameCallbacksPtr a_Callbacks);
+
+ /** Starts the lookup.
+ Returns true if lookup started successfully, false on failure (invalid IP format etc.) */
+ bool Lookup(const AString & a_IP);
+
+protected:
+
/** The callbacks to call for resolved names / errors. */
cNetwork::cResolveNameCallbacksPtr m_Callbacks;
/** The IP that was queried (needed for the callbacks). */
AString m_IP;
- static void Callback(int a_Result, char a_Type, int a_Count, int a_Ttl, void * a_Addresses, void * a_Self);
-public:
- cIPLookup(const AString & a_IP, cNetwork::cResolveNameCallbacksPtr a_Callbacks);
+ /** Callback that is called by LibEvent when there's an event for the request. */
+ static void Callback(int a_Result, char a_Type, int a_Count, int a_Ttl, void * a_Addresses, void * a_Self);
};
typedef SharedPtr<cIPLookup> cIPLookupPtr;
typedef std::vector<cIPLookupPtr> cIPLookupPtrs;