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