]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
322345fd LP |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2014 Lennart Poettering | |
322345fd LP |
8 | ***/ |
9 | ||
322345fd | 10 | #include "hashmap.h" |
71d35b6b | 11 | #include "list.h" |
322345fd LP |
12 | #include "prioq.h" |
13 | #include "time-util.h" | |
322345fd | 14 | |
322345fd | 15 | typedef struct DnsCache { |
7e8e0422 LP |
16 | Hashmap *by_key; |
17 | Prioq *by_expiry; | |
a150ff5e LP |
18 | unsigned n_hit; |
19 | unsigned n_miss; | |
322345fd LP |
20 | } DnsCache; |
21 | ||
faa133f3 | 22 | #include "resolved-dns-answer.h" |
7778dfff | 23 | #include "resolved-dns-packet.h" |
71d35b6b TA |
24 | #include "resolved-dns-question.h" |
25 | #include "resolved-dns-rr.h" | |
322345fd | 26 | |
322345fd LP |
27 | void dns_cache_flush(DnsCache *c); |
28 | void dns_cache_prune(DnsCache *c); | |
29 | ||
d3760be0 | 30 | int dns_cache_put(DnsCache *c, DnsResourceKey *key, int rcode, DnsAnswer *answer, bool authenticated, uint32_t nsec_ttl, usec_t timestamp, int owner_family, const union in_addr_union *owner_address); |
17c8de63 | 31 | int dns_cache_lookup(DnsCache *c, DnsResourceKey *key, bool clamp_ttl, int *rcode, DnsAnswer **answer, bool *authenticated); |
a4076574 LP |
32 | |
33 | int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address); | |
4d506d6b LP |
34 | |
35 | void dns_cache_dump(DnsCache *cache, FILE *f); | |
36 | bool dns_cache_is_empty(DnsCache *cache); | |
7778dfff | 37 | |
a150ff5e LP |
38 | unsigned dns_cache_size(DnsCache *cache); |
39 | ||
7778dfff | 40 | int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p); |