Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | List of all members
cNetwork::cResolveNameCallbacks Class Referenceabstract

Callbacks used when resolving names to IPs. More...

#include <Network.h>

Inheritance diagram for cNetwork::cResolveNameCallbacks:
Inheritance graph
[legend]

Public Member Functions

virtual void OnError (int a_ErrorCode, const AString &a_ErrorMsg)=0
 Called when an error is encountered while resolving. More...
 
virtual void OnFinished (void)=0
 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)=0
 Called when the hostname is successfully resolved into an IP address. More...
 
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 ()
 

Detailed Description

Callbacks used when resolving names to IPs.

Definition at line 277 of file Network.h.

Constructor & Destructor Documentation

◆ ~cResolveNameCallbacks()

virtual cNetwork::cResolveNameCallbacks::~cResolveNameCallbacks ( )
inlinevirtual

Definition at line 281 of file Network.h.

Member Function Documentation

◆ OnError()

virtual void cNetwork::cResolveNameCallbacks::OnError ( int  a_ErrorCode,
const AString a_ErrorMsg 
)
pure virtual

Called when an error is encountered while resolving.

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

Implemented in cUDPSendAfterLookup, and cLuaNameLookup.

◆ OnFinished()

virtual void cNetwork::cResolveNameCallbacks::OnFinished ( void  )
pure virtual

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

Only called if there was no error reported.

Implemented in cUDPSendAfterLookup, and cLuaNameLookup.

◆ OnNameResolved()

virtual void cNetwork::cResolveNameCallbacks::OnNameResolved ( const AString a_Name,
const AString a_IP 
)
pure virtual

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().

Implemented in cUDPSendAfterLookup, and cLuaNameLookup.

◆ OnNameResolvedV4()

virtual bool cNetwork::cResolveNameCallbacks::OnNameResolvedV4 ( const AString a_Name,
const sockaddr_in *  a_IP 
)
inlinevirtual

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

May be called multiple times if a name resolves to multiple addresses. Each call to OnNameResolvedV4 is followed by OnNameResolved with the IP address serialized to a string. If this callback returns false, the OnNameResolved() call is skipped for this address.

Reimplemented in cUDPSendAfterLookup.

Definition at line 293 of file Network.h.

◆ OnNameResolvedV6()

virtual bool cNetwork::cResolveNameCallbacks::OnNameResolvedV6 ( const AString a_Name,
const sockaddr_in6 *  a_IP 
)
inlinevirtual

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

May be called multiple times if a name resolves to multiple addresses. Each call to OnNameResolvedV4 is followed by OnNameResolved with the IP address serialized to a string. If this callback returns false, the OnNameResolved() call is skipped for this address.

Reimplemented in cUDPSendAfterLookup.

Definition at line 299 of file Network.h.


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