]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/resolved-dns-cache.h
3231998c13e2df441bd4760a34044cc6030a2c83
[thirdparty/systemd.git] / src / resolve / resolved-dns-cache.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright 2014 Lennart Poettering
6 ***/
7
8 #include "hashmap.h"
9 #include "list.h"
10 #include "prioq.h"
11 #include "time-util.h"
12
13 typedef struct DnsCache {
14 Hashmap *by_key;
15 Prioq *by_expiry;
16 unsigned n_hit;
17 unsigned n_miss;
18 } DnsCache;
19
20 #include "resolved-dns-answer.h"
21 #include "resolved-dns-packet.h"
22 #include "resolved-dns-question.h"
23 #include "resolved-dns-rr.h"
24
25 void dns_cache_flush(DnsCache *c);
26 void dns_cache_prune(DnsCache *c);
27
28 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);
29 int dns_cache_lookup(DnsCache *c, DnsResourceKey *key, bool clamp_ttl, int *rcode, DnsAnswer **answer, bool *authenticated);
30
31 int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address);
32
33 void dns_cache_dump(DnsCache *cache, FILE *f);
34 bool dns_cache_is_empty(DnsCache *cache);
35
36 unsigned dns_cache_size(DnsCache *cache);
37
38 int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p);