]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-zone.h
resolved: implement LLMNR uniqueness verification
[thirdparty/systemd.git] / src / resolve / resolved-dns-zone.h
CommitLineData
623a4c97
LP
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
ec2c5e43
LP
31typedef struct DnsZoneItem DnsZoneItem;
32typedef enum DnsZoneItemState DnsZoneItemState;
33
623a4c97
LP
34#include "resolved-dns-rr.h"
35#include "resolved-dns-question.h"
36#include "resolved-dns-answer.h"
ec2c5e43
LP
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};
623a4c97
LP
64
65void dns_zone_flush(DnsZone *z);
66
ec2c5e43 67int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe);
623a4c97
LP
68void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr);
69
ec2c5e43 70int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **answer, DnsAnswer **soa, bool *tentative);
57f5ad31 71
ec2c5e43
LP
72void dns_zone_item_conflict(DnsZoneItem *i);
73void dns_zone_item_ready(DnsZoneItem *i);