chiark / gitweb /
resolved: provide properly named way to access SPF data in RRs
[elogind.git] / src / resolve / resolved-dns-zone.h
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
26 typedef struct DnsZone {
27         Hashmap *by_key;
28         Hashmap *by_name;
29 } DnsZone;
30
31 typedef struct DnsZoneItem DnsZoneItem;
32 typedef 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
42 enum DnsZoneItemState {
43         DNS_ZONE_ITEM_PROBING,
44         DNS_ZONE_ITEM_ESTABLISHED,
45         DNS_ZONE_ITEM_VERIFYING,
46         DNS_ZONE_ITEM_WITHDRAWN,
47 };
48
49 struct 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
65 void dns_zone_flush(DnsZone *z);
66
67 int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe);
68 void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr);
69
70 int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **answer, DnsAnswer **soa, bool *tentative);
71
72 void dns_zone_item_conflict(DnsZoneItem *i);
73 void dns_zone_item_ready(DnsZoneItem *i);