2015-01-18 05:57:16 -05:00
|
|
|
|
|
|
|
// HostnameLookup.h
|
|
|
|
|
|
|
|
// Declares the cHostnameLookup class representing an in-progress hostname-to-IP lookup
|
|
|
|
|
|
|
|
// This is an internal header, no-one outside OSSupport should need to include it; use Network.h instead
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Network.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Holds information about an in-progress Hostname-to-IP lookup. */
|
|
|
|
class cHostnameLookup
|
|
|
|
{
|
2015-01-18 06:35:02 -05:00
|
|
|
public:
|
2017-06-15 05:03:49 -04:00
|
|
|
/** Creates a lookup object and schedules the lookup. */
|
|
|
|
static void Lookup(const AString & a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks);
|
2015-01-18 06:35:02 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2017-06-15 05:03:49 -04:00
|
|
|
/** Creates the lookup object. Doesn't start the lookup yet. */
|
|
|
|
cHostnameLookup(const AString & a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks);
|
|
|
|
|
2015-01-18 05:57:16 -05:00
|
|
|
/** The callbacks to call for resolved names / errors. */
|
|
|
|
cNetwork::cResolveNameCallbacksPtr m_Callbacks;
|
|
|
|
|
|
|
|
/** The hostname that was queried (needed for the callbacks). */
|
|
|
|
AString m_Hostname;
|
|
|
|
|
2017-06-15 05:03:49 -04:00
|
|
|
void Callback(int a_ErrCode, struct addrinfo * a_Addr);
|
2015-01-18 05:57:16 -05:00
|
|
|
};
|
2017-07-20 07:19:18 -04:00
|
|
|
typedef std::shared_ptr<cHostnameLookup> cHostnameLookupPtr;
|
2015-01-18 05:57:16 -05:00
|
|
|
typedef std::vector<cHostnameLookupPtr> cHostnameLookupPtrs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|