1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include <sys/types.h>
28 #include "time-util.h"
31 typedef struct DnsCacheItem DnsCacheItem;
33 typedef struct DnsCache {
38 #include "resolved-dns-rr.h"
40 typedef struct DnsCacheItem {
41 DnsResourceRecord *rr;
43 unsigned expire_prioq_idx;
44 LIST_FIELDS(DnsCacheItem, rrsets);
47 void dns_cache_flush(DnsCache *c);
48 void dns_cache_prune(DnsCache *c);
50 void dns_cache_remove(DnsCache *c, DnsResourceKey *key);
52 int dns_cache_put(DnsCache *c, DnsResourceRecord *rr, usec_t timestamp);
53 int dns_cache_put_rrs(DnsCache *c, DnsResourceRecord **rrs, unsigned n_rrs, usec_t timestamp);
55 DnsCacheItem* dns_cache_lookup(DnsCache *c, DnsResourceKey *key);
56 DnsCacheItem* dns_cache_get(DnsCache *c, DnsResourceRecord *rr);
57 int dns_cache_lookup_many(DnsCache *c, DnsResourceKey *keys, unsigned n_keys, DnsResourceRecord ***rrs);