1#include "DNSCommon.h"                  // Defines general DNS utility routines
2
3mDNSexport mStatus handle_client_request_ut(void *req)
4{
5	return handle_client_request((request_state*)req);
6}
7
8mDNSexport void LogCacheRecords_ut(mDNSs32 now, mDNSu32* retCacheUsed, mDNSu32* retCacheActive)
9{
10	mDNSu32 CacheUsed =0, CacheActive =0, slot;
11	const CacheGroup *cg;
12	const CacheRecord *cr;
13
14	LogMsgNoIdent("------------ Cache -------------");
15	LogMsgNoIdent("Slt Q     TTL if     U Type rdlen");
16	for (slot = 0; slot < CACHE_HASH_SLOTS; slot++)
17	{
18		for (cg = mDNSStorage.rrcache_hash[slot]; cg; cg=cg->next)
19		{
20			CacheUsed++;    // Count one cache entity for the CacheGroup object
21			for (cr = cg->members; cr; cr=cr->next)
22			{
23				const mDNSs32 remain = cr->resrec.rroriginalttl - (now - cr->TimeRcvd) / mDNSPlatformOneSecond;
24				const char *ifname;
25				mDNSInterfaceID InterfaceID = cr->resrec.InterfaceID;
26				if (!InterfaceID && cr->resrec.rDNSServer && cr->resrec.rDNSServer->scoped)
27					InterfaceID = cr->resrec.rDNSServer->interface;
28				ifname = InterfaceNameForID(&mDNSStorage, InterfaceID);
29				if (cr->CRActiveQuestion) CacheActive++;
30				PrintOneCacheRecord(cr, slot, remain, ifname, &CacheUsed);
31				PrintCachedRecords(cr, slot, remain, ifname, &CacheUsed);
32			}
33		}
34	}
35
36	*retCacheUsed = CacheUsed;
37	*retCacheActive = CacheActive;
38}
39
40mDNSexport int LogEtcHosts_ut(mDNS *const m)
41{
42	return LogEtcHosts(m);
43}
44