Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cLuaNameLookup Class Reference

#include <LuaNameLookup.h>

Inheritance diagram for cLuaNameLookup:
Inheritance graph
[legend]
Collaboration diagram for cLuaNameLookup:
Collaboration graph
[legend]

Public Member Functions

 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 in the specified table. More...
 
- Public Member Functions inherited from cNetwork::cResolveNameCallbacks
virtual bool OnNameResolvedV4 (const AString &a_Name, const sockaddr_in *a_IP)
 Called when the hostname is successfully resolved into an IPv4 address. More...
 
virtual bool OnNameResolvedV6 (const AString &a_Name, const sockaddr_in6 *a_IP)
 Called when the hostname is successfully resolved into an IPv6 address. More...
 
virtual ~cResolveNameCallbacks ()
 

Protected Member Functions

virtual void OnError (int a_ErrorCode, const AString &a_ErrorMsg) override
 Called when an error is encountered while resolving. More...
 
virtual void OnFinished (void) override
 Called when all the addresses resolved have been reported via the OnNameResolved() callback. More...
 
virtual void OnNameResolved (const AString &a_Name, const AString &a_IP) override
 Called when the hostname is successfully resolved into an IP address. More...
 

Protected Attributes

cLuaState::cTableRefPtr m_Callbacks
 The Lua table that holds the callbacks to be invoked. More...
 
AString m_Query
 The query used to start the lookup (either hostname or IP). More...
 

Detailed Description

Definition at line 19 of file LuaNameLookup.h.

Constructor & Destructor Documentation

◆ cLuaNameLookup()

cLuaNameLookup::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 in the specified table.

Definition at line 13 of file LuaNameLookup.cpp.

Member Function Documentation

◆ OnError()

void cLuaNameLookup::OnError ( int  a_ErrorCode,
const AString a_ErrorMsg 
)
overrideprotectedvirtual

Called when an error is encountered while resolving.

If an error is reported, the OnFinished() callback is not called.

Implements cNetwork::cResolveNameCallbacks.

Definition at line 32 of file LuaNameLookup.cpp.

◆ OnFinished()

void cLuaNameLookup::OnFinished ( void  )
overrideprotectedvirtual

Called when all the addresses resolved have been reported via the OnNameResolved() callback.

Only called if there was no error reported.

Implements cNetwork::cResolveNameCallbacks.

Definition at line 41 of file LuaNameLookup.cpp.

◆ OnNameResolved()

void cLuaNameLookup::OnNameResolved ( const AString a_Name,
const AString a_IP 
)
overrideprotectedvirtual

Called when the hostname is successfully resolved into an IP address.

May be called multiple times if a name resolves to multiple addresses. a_IP may be either an IPv4 or an IPv6 address with their proper formatting. Each call to OnNameResolved() is preceded by a call to either OnNameResolvedV4() or OnNameResolvedV6().

Implements cNetwork::cResolveNameCallbacks.

Definition at line 23 of file LuaNameLookup.cpp.

Member Data Documentation

◆ m_Callbacks

cLuaState::cTableRefPtr cLuaNameLookup::m_Callbacks
protected

The Lua table that holds the callbacks to be invoked.

Definition at line 29 of file LuaNameLookup.h.

◆ m_Query

AString cLuaNameLookup::m_Query
protected

The query used to start the lookup (either hostname or IP).

Definition at line 32 of file LuaNameLookup.h.


The documentation for this class was generated from the following files: