diff options
author | Mattes D <github@xoft.cz> | 2015-02-07 17:46:16 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-02-07 17:46:16 +0100 |
commit | 512b1a6b0e3d68c62f638399061e129dcf61067f (patch) | |
tree | 0201d601f4f5e125a22298b730ac4903fa264415 /src/Bindings/LuaNameLookup.h | |
parent | Merge pull request #1727 from mc-server/Entities (diff) | |
parent | APIDump: Added client and server examples. (diff) | |
download | cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar.gz cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar.bz2 cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar.lz cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar.xz cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.tar.zst cuberite-512b1a6b0e3d68c62f638399061e129dcf61067f.zip |
Diffstat (limited to 'src/Bindings/LuaNameLookup.h')
-rw-r--r-- | src/Bindings/LuaNameLookup.h | 46 |
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..e4cdb9f53 --- /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 query 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; +}; + + + + |