]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
623a4c97 LP |
2 | #pragma once |
3 | ||
623a4c97 LP |
4 | #include "hashmap.h" |
5 | ||
6 | typedef struct DnsZone { | |
7 | Hashmap *by_key; | |
8 | Hashmap *by_name; | |
9 | } DnsZone; | |
10 | ||
ec2c5e43 LP |
11 | typedef struct DnsZoneItem DnsZoneItem; |
12 | typedef enum DnsZoneItemState DnsZoneItemState; | |
13 | ||
623a4c97 | 14 | #include "resolved-dns-answer.h" |
71d35b6b TA |
15 | #include "resolved-dns-question.h" |
16 | #include "resolved-dns-rr.h" | |
ec2c5e43 LP |
17 | #include "resolved-dns-transaction.h" |
18 | ||
19 | /* RFC 4795 Section 2.8. suggests a TTL of 30s by default */ | |
20 | #define LLMNR_DEFAULT_TTL (30) | |
21 | ||
400cb36e DR |
22 | /* RFC 6762 Section 10. suggests a TTL of 120s by default */ |
23 | #define MDNS_DEFAULT_TTL (120) | |
24 | ||
ec2c5e43 LP |
25 | enum DnsZoneItemState { |
26 | DNS_ZONE_ITEM_PROBING, | |
27 | DNS_ZONE_ITEM_ESTABLISHED, | |
28 | DNS_ZONE_ITEM_VERIFYING, | |
29 | DNS_ZONE_ITEM_WITHDRAWN, | |
30 | }; | |
31 | ||
32 | struct DnsZoneItem { | |
33 | DnsScope *scope; | |
34 | DnsResourceRecord *rr; | |
35 | ||
36 | DnsZoneItemState state; | |
37 | ||
38 | unsigned block_ready; | |
39 | ||
40 | bool probing_enabled; | |
41 | ||
42 | LIST_FIELDS(DnsZoneItem, by_key); | |
43 | LIST_FIELDS(DnsZoneItem, by_name); | |
44 | ||
45 | DnsTransaction *probe_transaction; | |
46 | }; | |
623a4c97 LP |
47 | |
48 | void dns_zone_flush(DnsZone *z); | |
49 | ||
ec2c5e43 | 50 | int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe); |
8d67e72c | 51 | DnsZoneItem* dns_zone_get(DnsZone *z, DnsResourceRecord *rr); |
623a4c97 | 52 | void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr); |
6db6a464 | 53 | int dns_zone_remove_rrs_by_key(DnsZone *z, DnsResourceKey *key); |
623a4c97 | 54 | |
97ebebbc | 55 | int dns_zone_lookup(DnsZone *z, DnsResourceKey *key, int ifindex, DnsAnswer **answer, DnsAnswer **soa, bool *tentative); |
57f5ad31 | 56 | |
ec2c5e43 | 57 | void dns_zone_item_conflict(DnsZoneItem *i); |
547973de | 58 | void dns_zone_item_notify(DnsZoneItem *i); |
a4076574 LP |
59 | |
60 | int dns_zone_check_conflicts(DnsZone *zone, DnsResourceRecord *rr); | |
61 | int dns_zone_verify_conflicts(DnsZone *zone, DnsResourceKey *key); | |
902bb5d8 LP |
62 | |
63 | void dns_zone_verify_all(DnsZone *zone); | |
3ef64445 LP |
64 | |
65 | void dns_zone_item_probe_stop(DnsZoneItem *i); | |
4d506d6b LP |
66 | |
67 | void dns_zone_dump(DnsZone *zone, FILE *f); | |
68 | bool dns_zone_is_empty(DnsZone *zone); | |
a2bf8a19 | 69 | bool dns_zone_contains_name(DnsZone *z, const char *name); |