-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkdns_cache.h
More file actions
48 lines (38 loc) · 1001 Bytes
/
Copy pathkdns_cache.h
File metadata and controls
48 lines (38 loc) · 1001 Bytes
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
#pragma once
#include "kdns_types.h"
// =============================================================
// DNS CACHE API
// =============================================================
#define DNS_CACHE_SIZE 32
#define DNS_CACHE_TTL_SECONDS 300
typedef struct _DNS_CACHE_ENTRY {
CHAR Hostname[256];
ULONG IpAddress;
LARGE_INTEGER Timestamp;
BOOLEAN Valid;
} DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY;
typedef struct _DNS_CACHE_STATS {
ULONG Hits;
ULONG Misses;
ULONG Evictions;
} DNS_CACHE_STATS, *PDNS_CACHE_STATS;
// Initialize DNS cache
VOID KdnsCacheInitialize(VOID);
// Cleanup DNS cache
VOID KdnsCacheCleanup(VOID);
// Lookup entry in cache
BOOLEAN KdnsCacheLookup(
_In_ PCHAR Hostname,
_Out_ PULONG IpAddress
);
// Update cache with new entry
VOID KdnsCacheUpdate(
_In_ PCHAR Hostname,
_In_ ULONG IpAddress
);
// Get cache statistics
VOID KdnsCacheGetStats(
_Out_ PDNS_CACHE_STATS Stats
);
// Clear all cache entries
VOID KdnsCacheClear(VOID);