Cuberite
A lightweight, fast and extensible game server for Minecraft
LuaNameLookup.h
Go to the documentation of this file.
1 
2 // LuaNameLookup.h
3 
4 // Declares the cLuaNameLookup class used as the cNetwork API callbacks for name and IP lookups from Lua
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "../OSSupport/Network.h"
13 #include "LuaState.h"
14 
15 
16 
17 
18 
21 {
22 public:
25  cLuaNameLookup(const AString & a_Query, cLuaState::cTableRefPtr && a_Callbacks);
26 
27 protected:
30 
33 
34 
35  // cNetwork::cResolveNameCallbacks overrides:
36  virtual void OnNameResolved(const AString & a_Name, const AString & a_IP) override;
37  virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override;
38  virtual void OnFinished(void) override;
39 };
40 
41 
42 
43 
std::string AString
Definition: StringUtils.h:11
virtual void OnError(int a_ErrorCode, const AString &a_ErrorMsg) override
Called when an error is encountered while resolving.
AString m_Query
The query used to start the lookup (either hostname or IP).
Definition: LuaNameLookup.h:32
cLuaState::cTableRefPtr m_Callbacks
The Lua table that holds the callbacks to be invoked.
Definition: LuaNameLookup.h:29
virtual void OnNameResolved(const AString &a_Name, const AString &a_IP) override
Called when the hostname is successfully resolved into an IP address.
cLuaNameLookup(const AString &a_Query, cLuaState::cTableRefPtr &&a_Callbacks)
Creates a new instance of the lookup callbacks for the specified query, using the callbacks that are ...
virtual void OnFinished(void) override
Called when all the addresses resolved have been reported via the OnNameResolved() callback.
std::unique_ptr< cTableRef > cTableRefPtr
Definition: LuaState.h:419
Callbacks used when resolving names to IPs.
Definition: Network.h:278