summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaNameLookup.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-29 11:09:56 +0100
committerMattes D <github@xoft.cz>2015-02-04 08:40:52 +0100
commit17498a97a289119debdb651ab898ddea99e86ff9 (patch)
tree04f103b0c0f5d120cec59756618bcafeafb53cb2 /src/Bindings/LuaNameLookup.h
parentNetworkTest plugin: Added cNetwork:Connect test code. (diff)
downloadcuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar.gz
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar.bz2
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar.lz
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar.xz
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.tar.zst
cuberite-17498a97a289119debdb651ab898ddea99e86ff9.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/LuaNameLookup.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Bindings/LuaNameLookup.h b/src/Bindings/LuaNameLookup.h
new file mode 100644
index 000000000..8b456ad90
--- /dev/null
+++ b/src/Bindings/LuaNameLookup.h
@@ -0,0 +1,46 @@
+
+// LuaNameLookup.h
+
+// Declares the cLuaNameLookup class used as the cNetwork API callbacks for name and IP lookups from Lua
+
+
+
+
+
+#pragma once
+
+#include "../OSSupport/Network.h"
+#include "PluginLua.h"
+
+
+
+
+
+class cLuaNameLookup:
+ public cNetwork::cResolveNameCallbacks
+{
+public:
+ /** Creates a new instance of the lookup callbacks for the specified query,
+ attached to the specified lua plugin and wrapping the callbacks that are in a table at the specified stack pos. */
+ cLuaNameLookup(const AString & a_Query, cPluginLua & a_Plugin, int a_CallbacksTableStackPos);
+
+protected:
+ /** The plugin for which the link is created. */
+ cPluginLua & m_Plugin;
+
+ /** The Lua table that holds the callbacks to be invoked. */
+ cLuaState::cRef m_Callbacks;
+
+ /** The query used to start the lookup (either hostname or IP). */
+ AString m_Query;
+
+
+ // cNetwork::cResolveNameCallbacks overrides:
+ virtual void OnNameResolved(const AString & a_Name, const AString & a_IP) override;
+ virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override;
+ virtual void OnFinished(void) override;
+};
+
+
+
+