resolved-dns-cache.h revision 7778dffff3d8bd7438fe19a248c16203668324c9
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen#pragma once
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen/***
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen This file is part of systemd.
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen Copyright 2014 Lennart Poettering
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen systemd is free software; you can redistribute it and/or modify it
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen under the terms of the GNU Lesser General Public License as published by
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen (at your option) any later version.
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen systemd is distributed in the hope that it will be useful, but
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen Lesser General Public License for more details.
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen You should have received a copy of the GNU Lesser General Public License
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen***/
ff734080aa02cd70b13bc0fdeec4a5886166163aTom Gundersen
ff734080aa02cd70b13bc0fdeec4a5886166163aTom Gundersen#include "hashmap.h"
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen#include "list.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "prioq.h"
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering#include "time-util.h"
ff734080aa02cd70b13bc0fdeec4a5886166163aTom Gundersen
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poetteringtypedef struct DnsCache {
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering Hashmap *by_key;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering Prioq *by_expiry;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering} DnsCache;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
b44cd8821087f2afebf85fec5b588f5720a9415cTom Gundersen#include "resolved-dns-answer.h"
586ac6f711e2eccceb12421df22fca4f117226c4Lennart Poettering#include "resolved-dns-packet.h"
586ac6f711e2eccceb12421df22fca4f117226c4Lennart Poettering#include "resolved-dns-question.h"
4dc355680460fdc8e0d590d8572dff1b6a257d88Tom Gundersen#include "resolved-dns-rr.h"
99634696183dfabae20104e58157c69029a11594Tom Gundersen
99634696183dfabae20104e58157c69029a11594Tom Gundersenvoid dns_cache_flush(DnsCache *c);
99634696183dfabae20104e58157c69029a11594Tom Gundersenvoid dns_cache_prune(DnsCache *c);
99634696183dfabae20104e58157c69029a11594Tom Gundersen
99634696183dfabae20104e58157c69029a11594Tom Gundersenint dns_cache_put(DnsCache *c, DnsResourceKey *key, int rcode, DnsAnswer *answer, unsigned max_rrs, bool authenticated, usec_t timestamp, int owner_family, const union in_addr_union *owner_address);
99634696183dfabae20104e58157c69029a11594Tom Gundersenint dns_cache_lookup(DnsCache *c, DnsResourceKey *key, int *rcode, DnsAnswer **answer, bool *authenticated);
99634696183dfabae20104e58157c69029a11594Tom Gundersen
99634696183dfabae20104e58157c69029a11594Tom Gundersenint dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address);
99634696183dfabae20104e58157c69029a11594Tom Gundersen
2dead8129f7b6fe644e17e1dc1739bebacfe1364Tom Gundersenvoid dns_cache_dump(DnsCache *cache, FILE *f);
2dead8129f7b6fe644e17e1dc1739bebacfe1364Tom Gundersenbool dns_cache_is_empty(DnsCache *cache);
99634696183dfabae20104e58157c69029a11594Tom Gundersen
99634696183dfabae20104e58157c69029a11594Tom Gundersenint dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p);
99634696183dfabae20104e58157c69029a11594Tom Gundersen