]>
Commit | Line | Data |
---|---|---|
74b2466e 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 "list.h" | |
25 | ||
26 | typedef struct DnsScope DnsScope; | |
27 | ||
74b2466e LP |
28 | #include "resolved-dns-server.h" |
29 | #include "resolved-dns-packet.h" | |
322345fd | 30 | #include "resolved-dns-cache.h" |
623a4c97 | 31 | #include "resolved-dns-zone.h" |
39d8db04 | 32 | #include "resolved-link.h" |
74b2466e | 33 | |
74b2466e LP |
34 | typedef enum DnsScopeMatch { |
35 | DNS_SCOPE_NO, | |
36 | DNS_SCOPE_MAYBE, | |
37 | DNS_SCOPE_YES, | |
38 | _DNS_SCOPE_MATCH_MAX, | |
39 | _DNS_SCOPE_INVALID = -1 | |
40 | } DnsScopeMatch; | |
41 | ||
42 | struct DnsScope { | |
43 | Manager *manager; | |
44 | ||
1716f6dc | 45 | DnsProtocol protocol; |
0dd25fb9 | 46 | int family; |
74b2466e LP |
47 | |
48 | Link *link; | |
49 | ||
50 | char **domains; | |
51 | ||
322345fd | 52 | DnsCache cache; |
623a4c97 | 53 | DnsZone zone; |
322345fd | 54 | |
1e43061b | 55 | OrderedHashmap *conflict_queue; |
a4076574 LP |
56 | sd_event_source *conflict_event_source; |
57 | ||
aea2429d LP |
58 | RateLimit ratelimit; |
59 | ||
9df3ba6c TG |
60 | usec_t resend_timeout; |
61 | usec_t max_rtt; | |
62 | ||
da0c630e | 63 | Hashmap *transactions; |
74b2466e LP |
64 | |
65 | LIST_FIELDS(DnsScope, scopes); | |
66 | }; | |
67 | ||
0dd25fb9 | 68 | int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, int family); |
74b2466e LP |
69 | DnsScope* dns_scope_free(DnsScope *s); |
70 | ||
9df3ba6c TG |
71 | void dns_scope_packet_received(DnsScope *s, usec_t rtt); |
72 | void dns_scope_packet_lost(DnsScope *s, usec_t usec); | |
73 | ||
471d40d9 | 74 | int dns_scope_emit(DnsScope *s, int fd, DnsPacket *p); |
8300ba21 | 75 | int dns_scope_tcp_socket(DnsScope *s, int family, const union in_addr_union *address, uint16_t port, DnsServer **server); |
0db64366 | 76 | int dns_scope_udp_dns_socket(DnsScope *s, DnsServer **server); |
ad867662 | 77 | |
51323288 | 78 | DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain); |
1716f6dc | 79 | int dns_scope_good_key(DnsScope *s, DnsResourceKey *key); |
74b2466e | 80 | |
2c27fbca | 81 | DnsServer *dns_scope_get_dns_server(DnsScope *s); |
74b2466e | 82 | void dns_scope_next_dns_server(DnsScope *s); |
1716f6dc LP |
83 | |
84 | int dns_scope_llmnr_membership(DnsScope *s, bool b); | |
623a4c97 LP |
85 | |
86 | void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p); | |
ec2c5e43 | 87 | |
f52e61da | 88 | DnsTransaction *dns_scope_find_transaction(DnsScope *scope, DnsResourceKey *key, bool cache_ok); |
a4076574 LP |
89 | |
90 | int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr); | |
91 | void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p); | |
4d506d6b LP |
92 | |
93 | void dns_scope_dump(DnsScope *s, FILE *f); |