Cuberite
A lightweight, fast and extensible game server for Minecraft
HostnameLookup.h
Go to the documentation of this file.
1 
2 // HostnameLookup.h
3 
4 // Declares the cHostnameLookup class representing an in-progress hostname-to-IP lookup
5 
6 // This is an internal header, no-one outside OSSupport should need to include it; use Network.h instead
7 
8 
9 
10 
11 
12 #pragma once
13 
14 #include "Network.h"
15 
16 
17 
18 
19 
22 {
23 public:
25  static void Lookup(const AString & a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks);
26 
27 protected:
28 
30  cHostnameLookup(const AString & a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks);
31 
34 
37 
38  void Callback(int a_ErrCode, struct addrinfo * a_Addr);
39 };
40 typedef std::shared_ptr<cHostnameLookup> cHostnameLookupPtr;
41 typedef std::vector<cHostnameLookupPtr> cHostnameLookupPtrs;
42 
43 
44 
45 
46 
std::vector< cHostnameLookupPtr > cHostnameLookupPtrs
std::shared_ptr< cHostnameLookup > cHostnameLookupPtr
std::string AString
Definition: StringUtils.h:11
Holds information about an in-progress Hostname-to-IP lookup.
cHostnameLookup(const AString &a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks)
Creates the lookup object.
static void Lookup(const AString &a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks)
Creates a lookup object and schedules the lookup.
AString m_Hostname
The hostname that was queried (needed for the callbacks).
cNetwork::cResolveNameCallbacksPtr m_Callbacks
The callbacks to call for resolved names / errors.
void Callback(int a_ErrCode, struct addrinfo *a_Addr)
std::shared_ptr< cResolveNameCallbacks > cResolveNameCallbacksPtr
Definition: Network.h:309