]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-scope.h
Merge pull request #7388 from keszybz/doc-tweak
[thirdparty/systemd.git] / src / resolve / resolved-dns-scope.h
CommitLineData
74b2466e
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 "list.h"
23
24typedef struct DnsScope DnsScope;
25
322345fd 26#include "resolved-dns-cache.h"
24710c48 27#include "resolved-dns-dnssec.h"
71d35b6b 28#include "resolved-dns-packet.h"
07f264e4
DM
29#include "resolved-dns-query.h"
30#include "resolved-dns-search-domain.h"
71d35b6b 31#include "resolved-dns-server.h"
07f264e4 32#include "resolved-dns-stream.h"
623a4c97 33#include "resolved-dns-zone.h"
39d8db04 34#include "resolved-link.h"
74b2466e 35
74b2466e
LP
36typedef enum DnsScopeMatch {
37 DNS_SCOPE_NO,
38 DNS_SCOPE_MAYBE,
39 DNS_SCOPE_YES,
40 _DNS_SCOPE_MATCH_MAX,
41 _DNS_SCOPE_INVALID = -1
42} DnsScopeMatch;
43
44struct DnsScope {
45 Manager *manager;
46
1716f6dc 47 DnsProtocol protocol;
0dd25fb9 48 int family;
24710c48 49 DnssecMode dnssec_mode;
74b2466e
LP
50
51 Link *link;
52
322345fd 53 DnsCache cache;
623a4c97 54 DnsZone zone;
322345fd 55
1e43061b 56 OrderedHashmap *conflict_queue;
a4076574
LP
57 sd_event_source *conflict_event_source;
58
53fda2bb
DR
59 bool announced:1;
60 sd_event_source *announce_event_source;
61
aea2429d
LP
62 RateLimit ratelimit;
63
9df3ba6c
TG
64 usec_t resend_timeout;
65 usec_t max_rtt;
66
801ad6a6 67 LIST_HEAD(DnsQueryCandidate, query_candidates);
74b2466e 68
f9ebb22a
LP
69 /* Note that we keep track of ongoing transactions in two
70 * ways: once in a hashmap, indexed by the rr key, and once in
71 * a linked list. We use the hashmap to quickly find
72 * transactions we can reuse for a key. But note that there
73 * might be multiple transactions for the same key (because
74 * the zone probing can't reuse a transaction answered from
75 * the zone or the cache), and the hashmap only tracks the
76 * most recent entry. */
77 Hashmap *transactions_by_key;
78 LIST_HEAD(DnsTransaction, transactions);
79
74b2466e
LP
80 LIST_FIELDS(DnsScope, scopes);
81};
82
0dd25fb9 83int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, int family);
74b2466e
LP
84DnsScope* dns_scope_free(DnsScope *s);
85
9df3ba6c
TG
86void dns_scope_packet_received(DnsScope *s, usec_t rtt);
87void dns_scope_packet_lost(DnsScope *s, usec_t usec);
88
519ef046
LP
89int dns_scope_emit_udp(DnsScope *s, int fd, DnsPacket *p);
90int dns_scope_socket_tcp(DnsScope *s, int family, const union in_addr_union *address, DnsServer *server, uint16_t port);
91int dns_scope_socket_udp(DnsScope *s, DnsServer *server, uint16_t port);
ad867662 92
51323288 93DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain);
011696f7 94bool dns_scope_good_key(DnsScope *s, const DnsResourceKey *key);
74b2466e 95
2c27fbca 96DnsServer *dns_scope_get_dns_server(DnsScope *s);
74b2466e 97void dns_scope_next_dns_server(DnsScope *s);
1716f6dc
LP
98
99int dns_scope_llmnr_membership(DnsScope *s, bool b);
0db4c90a 100int dns_scope_mdns_membership(DnsScope *s, bool b);
623a4c97 101
3b991089 102int dns_scope_make_reply_packet(DnsScope *s, uint16_t id, int rcode, DnsQuestion *q, DnsAnswer *answer, DnsAnswer *soa, bool tentative, DnsPacket **ret);
623a4c97 103void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p);
ec2c5e43 104
f52e61da 105DnsTransaction *dns_scope_find_transaction(DnsScope *scope, DnsResourceKey *key, bool cache_ok);
a4076574
LP
106
107int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr);
108void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p);
4d506d6b
LP
109
110void dns_scope_dump(DnsScope *s, FILE *f);
a51c1048
LP
111
112DnsSearchDomain *dns_scope_get_search_domains(DnsScope *s);
801ad6a6 113
dc477e73 114bool dns_scope_name_needs_search_domain(DnsScope *s, const char *name);
edbcc1fd
LP
115
116bool dns_scope_network_good(DnsScope *s);
97ebebbc
LP
117
118int dns_scope_ifindex(DnsScope *s);
53fda2bb 119
1a63fc54 120int dns_scope_announce(DnsScope *scope, bool goodbye);