]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
322345fd LP |
2 | #pragma once |
3 | ||
322345fd | 4 | #include "hashmap.h" |
71d35b6b | 5 | #include "list.h" |
322345fd | 6 | #include "prioq.h" |
37d7a7d9 | 7 | #include "resolve-util.h" |
775ae354 | 8 | #include "resolved-dns-dnssec.h" |
322345fd | 9 | #include "time-util.h" |
322345fd | 10 | |
322345fd | 11 | typedef struct DnsCache { |
7e8e0422 LP |
12 | Hashmap *by_key; |
13 | Prioq *by_expiry; | |
a150ff5e LP |
14 | unsigned n_hit; |
15 | unsigned n_miss; | |
322345fd LP |
16 | } DnsCache; |
17 | ||
faa133f3 | 18 | #include "resolved-dns-answer.h" |
7778dfff | 19 | #include "resolved-dns-packet.h" |
71d35b6b TA |
20 | #include "resolved-dns-question.h" |
21 | #include "resolved-dns-rr.h" | |
322345fd | 22 | |
322345fd LP |
23 | void dns_cache_flush(DnsCache *c); |
24 | void dns_cache_prune(DnsCache *c); | |
25 | ||
775ae354 LP |
26 | int dns_cache_put( |
27 | DnsCache *c, | |
28 | DnsCacheMode cache_mode, | |
29 | DnsResourceKey *key, | |
30 | int rcode, | |
31 | DnsAnswer *answer, | |
32 | DnsPacket *full_packet, | |
33 | bool authenticated, | |
34 | DnssecResult dnssec_result, | |
35 | uint32_t nsec_ttl, | |
775ae354 LP |
36 | int owner_family, |
37 | const union in_addr_union *owner_address); | |
38 | ||
39 | int dns_cache_lookup( | |
40 | DnsCache *c, | |
41 | DnsResourceKey *key, | |
42 | uint64_t query_flags, | |
43 | int *ret_rcode, | |
44 | DnsAnswer **ret_answer, | |
45 | DnsPacket **ret_full_packet, | |
46 | bool *ret_authenticated, | |
47 | DnssecResult *ret_dnssec_result); | |
a4076574 LP |
48 | |
49 | int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address); | |
4d506d6b | 50 | |
ca9fab88 | 51 | void dns_cache_dump(DnsCache *cache, FILE *f); |
4d506d6b | 52 | bool dns_cache_is_empty(DnsCache *cache); |
7778dfff | 53 | |
a150ff5e LP |
54 | unsigned dns_cache_size(DnsCache *cache); |
55 | ||
7778dfff | 56 | int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p); |