]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - src/resolve/resolved-dns-zone.h
Merge pull request #1945 from phomes/indentation-fix
[thirdparty/systemd.git] / src / resolve / resolved-dns-zone.h
... / ...
CommitLineData
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2014 Lennart Poettering
9
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.
14
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.
19
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/>.
22***/
23
24#include "hashmap.h"
25
26typedef struct DnsZone {
27 Hashmap *by_key;
28 Hashmap *by_name;
29} DnsZone;
30
31typedef struct DnsZoneItem DnsZoneItem;
32typedef enum DnsZoneItemState DnsZoneItemState;
33
34#include "resolved-dns-rr.h"
35#include "resolved-dns-question.h"
36#include "resolved-dns-answer.h"
37#include "resolved-dns-transaction.h"
38
39/* RFC 4795 Section 2.8. suggests a TTL of 30s by default */
40#define LLMNR_DEFAULT_TTL (30)
41
42enum DnsZoneItemState {
43 DNS_ZONE_ITEM_PROBING,
44 DNS_ZONE_ITEM_ESTABLISHED,
45 DNS_ZONE_ITEM_VERIFYING,
46 DNS_ZONE_ITEM_WITHDRAWN,
47};
48
49struct DnsZoneItem {
50 DnsScope *scope;
51 DnsResourceRecord *rr;
52
53 DnsZoneItemState state;
54
55 unsigned block_ready;
56
57 bool probing_enabled;
58
59 LIST_FIELDS(DnsZoneItem, by_key);
60 LIST_FIELDS(DnsZoneItem, by_name);
61
62 DnsTransaction *probe_transaction;
63};
64
65void dns_zone_flush(DnsZone *z);
66
67int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe);
68void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr);
69
70int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **answer, DnsAnswer **soa, bool *tentative);
71
72void dns_zone_item_conflict(DnsZoneItem *i);
73void dns_zone_item_ready(DnsZoneItem *i);
74
75int dns_zone_check_conflicts(DnsZone *zone, DnsResourceRecord *rr);
76int dns_zone_verify_conflicts(DnsZone *zone, DnsResourceKey *key);
77
78void dns_zone_verify_all(DnsZone *zone);
79
80void dns_zone_item_probe_stop(DnsZoneItem *i);
81
82void dns_zone_dump(DnsZone *zone, FILE *f);
83bool dns_zone_is_empty(DnsZone *zone);