#include "time-util.h"
#include "list.h"
-typedef struct DnsCacheItem DnsCacheItem;
-
typedef struct DnsCache {
- Hashmap *rrsets;
- Prioq *expire;
+ Hashmap *by_key;
+ Prioq *by_expiry;
} DnsCache;
#include "resolved-dns-rr.h"
-
-typedef struct DnsCacheItem {
- DnsResourceRecord *rr;
- usec_t timestamp;
- unsigned expire_prioq_idx;
- LIST_FIELDS(DnsCacheItem, rrsets);
-} DnsCacheItem;
+#include "resolved-dns-question.h"
+#include "resolved-dns-answer.h"
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_rrs(DnsCache *c, DnsResourceRecord **rrs, unsigned n_rrs, usec_t timestamp);
+int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, unsigned max_rrs, usec_t timestamp, int owner_family, const union in_addr_union *owner_address);
+int dns_cache_lookup(DnsCache *c, DnsQuestion *q, int *rcode, DnsAnswer **answer);
-DnsCacheItem* dns_cache_lookup(DnsCache *c, DnsResourceKey *key);
-DnsCacheItem* dns_cache_get(DnsCache *c, DnsResourceRecord *rr);
-int dns_cache_lookup_many(DnsCache *c, DnsResourceKey *keys, unsigned n_keys, DnsResourceRecord ***rrs);
+int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address);