summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/IPLookup.h
blob: f612f14ee1364f9a6b3f9a6da715cbb0bb91abcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

// IPLookup.h

// Declares the cIPLookup class representing an IP-to-hostname lookup in progress.

// 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 IP-to-Hostname lookup. */
class cIPLookup
{
  public:
	/** Creates a lookup object and schedules the lookup. */
	static void Lookup(const AString & a_IP, cNetwork::cResolveNameCallbacksPtr a_Callbacks);

  protected:
	/** The callbacks to call for resolved names / errors. */
	cNetwork::cResolveNameCallbacksPtr m_Callbacks;

	/** The IP that was queried (needed for the callbacks). */
	AString m_IP;

	/** Creates the lookup object. Doesn't start the lookup yet. */
	cIPLookup(const AString & a_IP, cNetwork::cResolveNameCallbacksPtr a_Callbacks);

	/** Callback that is called by LibEvent when there's an event for the request. */
	void Callback(int a_Result, const char * a_Address);
};
typedef std::shared_ptr<cIPLookup> cIPLookupPtr;
typedef std::vector<cIPLookupPtr> cIPLookupPtrs;