]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-zone.h
resolved: explicitly refuse zone transfers using the bus API
[thirdparty/systemd.git] / src / resolve / resolved-dns-zone.h
CommitLineData
623a4c97
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2014 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
22#include "hashmap.h"
23
24typedef struct DnsZone {
25 Hashmap *by_key;
26 Hashmap *by_name;
27} DnsZone;
28
ec2c5e43
LP
29typedef struct DnsZoneItem DnsZoneItem;
30typedef enum DnsZoneItemState DnsZoneItemState;
31
623a4c97 32#include "resolved-dns-answer.h"
71d35b6b
TA
33#include "resolved-dns-question.h"
34#include "resolved-dns-rr.h"
ec2c5e43
LP
35#include "resolved-dns-transaction.h"
36
37/* RFC 4795 Section 2.8. suggests a TTL of 30s by default */
38#define LLMNR_DEFAULT_TTL (30)
39
40enum DnsZoneItemState {
41 DNS_ZONE_ITEM_PROBING,
42 DNS_ZONE_ITEM_ESTABLISHED,
43 DNS_ZONE_ITEM_VERIFYING,
44 DNS_ZONE_ITEM_WITHDRAWN,
45};
46
47struct DnsZoneItem {
48 DnsScope *scope;
49 DnsResourceRecord *rr;
50
51 DnsZoneItemState state;
52
53 unsigned block_ready;
54
55 bool probing_enabled;
56
57 LIST_FIELDS(DnsZoneItem, by_key);
58 LIST_FIELDS(DnsZoneItem, by_name);
59
60 DnsTransaction *probe_transaction;
61};
623a4c97
LP
62
63void dns_zone_flush(DnsZone *z);
64
ec2c5e43 65int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe);
623a4c97
LP
66void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr);
67
97ebebbc 68int dns_zone_lookup(DnsZone *z, DnsResourceKey *key, int ifindex, DnsAnswer **answer, DnsAnswer **soa, bool *tentative);
57f5ad31 69
ec2c5e43 70void dns_zone_item_conflict(DnsZoneItem *i);
547973de 71void dns_zone_item_notify(DnsZoneItem *i);
a4076574
LP
72
73int dns_zone_check_conflicts(DnsZone *zone, DnsResourceRecord *rr);
74int dns_zone_verify_conflicts(DnsZone *zone, DnsResourceKey *key);
902bb5d8
LP
75
76void dns_zone_verify_all(DnsZone *zone);
3ef64445
LP
77
78void dns_zone_item_probe_stop(DnsZoneItem *i);
4d506d6b
LP
79
80void dns_zone_dump(DnsZone *zone, FILE *f);
81bool dns_zone_is_empty(DnsZone *zone);