1 #include "DNSCommon.h" // Defines general DNS utility routines
3 mDNSexport mStatus
handle_client_request_ut(void *req
)
5 return handle_client_request((request_state
*)req
);
8 mDNSexport
void LogCacheRecords_ut(mDNSs32 now
, mDNSu32
* retCacheUsed
, mDNSu32
* retCacheActive
)
10 mDNSu32 CacheUsed
=0, CacheActive
=0, slot
;
12 const CacheRecord
*cr
;
14 LogMsgNoIdent("------------ Cache -------------");
15 LogMsgNoIdent("Slt Q TTL if U Type rdlen");
16 for (slot
= 0; slot
< CACHE_HASH_SLOTS
; slot
++)
18 for (cg
= mDNSStorage
.rrcache_hash
[slot
]; cg
; cg
=cg
->next
)
20 CacheUsed
++; // Count one cache entity for the CacheGroup object
21 for (cr
= cg
->members
; cr
; cr
=cr
->next
)
23 const mDNSs32 remain
= cr
->resrec
.rroriginalttl
- (now
- cr
->TimeRcvd
) / mDNSPlatformOneSecond
;
25 mDNSInterfaceID InterfaceID
= cr
->resrec
.InterfaceID
;
26 if (!InterfaceID
&& cr
->resrec
.rDNSServer
&& (cr
->resrec
.rDNSServer
->scopeType
!= kScopeNone
))
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
);
36 *retCacheUsed
= CacheUsed
;
37 *retCacheActive
= CacheActive
;
40 mDNSexport
int LogEtcHosts_ut(mDNS
*const m
)
42 return LogEtcHosts(m
);