/
DNSCache.h
60 lines (44 loc) · 962 Bytes
/
DNSCache.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "StdString.h"
#include <map>
using namespace std;
#define DNSC_PER_STATIC 0
#define DNSC_PER_SESSION 1
#define DNSC_PER_DYNAMIC 2
class CDNSEntry
{
public:
CDNSEntry();
DWORD GetNextServer( bool bForce );
void AddServerIP( DWORD dwServerIP );
bool m_bValid;
int m_iIPIndex;
int m_iPersistence;
FILETIME m_dwLastAccess;
DWORD m_dwaKnownIPs[16];
};
typedef map<CStdString, CDNSEntry *> TDNSMap;
class CDNSCache
{
public:
CDNSCache( void );
};
void DNS_SaveCache( bool bOnlyIfDirty = false );
void DNS_LoadCache( void );
CDNSEntry * DNS_GetEntry( LPCTSTR szServer );
CDNSEntry * DNS_AddEntry( LPCTSTR szServer );
DWORD DNS_Lookup( LPCTSTR szServer );
/*
<Hosts>
<Host name="something.com">
<Persistence>static</Persistence>
</Host>
<Host name="no-ip.com">
<Persistence>dynamic</Persistence>
</Host>
<Host name="super.com">
<Persistence>static</Persistence>
<KnownIP>214.16.120.4</KnownIP>
</Host>
</Hosts>
*/