summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-cache.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-23 00:57:25 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-23 02:00:40 +0200
commit7e8e0422aeb16f2a09a40546c61df753d10029b6 (patch)
treec5fd640ba84c1b3c92367aa4540e90c69c557a0b /src/resolve/resolved-dns-cache.h
parentresolved: rework logic so that we can share transactions between queries of d... (diff)
downloadsystemd-7e8e0422aeb16f2a09a40546c61df753d10029b6.tar.xz
systemd-7e8e0422aeb16f2a09a40546c61df753d10029b6.zip
resolved: implement negative caching
Diffstat (limited to 'src/resolve/resolved-dns-cache.h')
-rw-r--r--src/resolve/resolved-dns-cache.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/resolve/resolved-dns-cache.h b/src/resolve/resolved-dns-cache.h
index 1ede5bfd81..6f5bf45a38 100644
--- a/src/resolve/resolved-dns-cache.h
+++ b/src/resolve/resolved-dns-cache.h
@@ -31,27 +31,31 @@
typedef struct DnsCacheItem DnsCacheItem;
typedef struct DnsCache {
- Hashmap *rrsets;
- Prioq *expire;
+ Hashmap *by_key;
+ Prioq *by_expiry;
} DnsCache;
#include "resolved-dns-rr.h"
#include "resolved-dns-question.h"
#include "resolved-dns-answer.h"
+typedef enum DnsCacheItemType {
+ DNS_CACHE_POSITIVE,
+ DNS_CACHE_NODATA,
+ DNS_CACHE_NXDOMAIN,
+} DnsCacheItemType;
+
typedef struct DnsCacheItem {
+ DnsResourceKey *key;
DnsResourceRecord *rr;
- usec_t timestamp;
- unsigned expire_prioq_idx;
- LIST_FIELDS(DnsCacheItem, rrsets);
+ usec_t until;
+ DnsCacheItemType type;
+ unsigned prioq_idx;
+ LIST_FIELDS(DnsCacheItem, by_key);
} DnsCacheItem;
void dns_cache_flush(DnsCache *c);
void dns_cache_prune(DnsCache *c);
-void dns_cache_remove(DnsCache *c, DnsResourceKey *key);
-
-int dns_cache_put(DnsCache *c, DnsResourceRecord *rr, usec_t timestamp);
-int dns_cache_put_answer(DnsCache *c, DnsAnswer *answer, usec_t timestamp);
-
-int dns_cache_lookup(DnsCache *c, DnsQuestion *q, DnsAnswer **ret);
+int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, usec_t timestamp);
+int dns_cache_lookup(DnsCache *c, DnsQuestion *q, int *rcode, DnsAnswer **answer);