]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - src/resolve/resolved-dns-scope.h
resolved: expose some properties on the bus
[thirdparty/systemd.git] / src / resolve / resolved-dns-scope.h
... / ...
CommitLineData
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
26typedef struct DnsScope DnsScope;
27
28#include "resolved-dns-cache.h"
29#include "resolved-dns-packet.h"
30#include "resolved-dns-server.h"
31#include "resolved-dns-zone.h"
32#include "resolved-link.h"
33
34typedef 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
42struct DnsScope {
43 Manager *manager;
44
45 DnsProtocol protocol;
46 int family;
47
48 Link *link;
49
50 DnsCache cache;
51 DnsZone zone;
52
53 OrderedHashmap *conflict_queue;
54 sd_event_source *conflict_event_source;
55
56 RateLimit ratelimit;
57
58 usec_t resend_timeout;
59 usec_t max_rtt;
60
61 Hashmap *transactions;
62
63 LIST_FIELDS(DnsScope, scopes);
64};
65
66int dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, int family);
67DnsScope* dns_scope_free(DnsScope *s);
68
69void dns_scope_packet_received(DnsScope *s, usec_t rtt);
70void dns_scope_packet_lost(DnsScope *s, usec_t usec);
71
72int dns_scope_emit(DnsScope *s, int fd, DnsPacket *p);
73int dns_scope_tcp_socket(DnsScope *s, int family, const union in_addr_union *address, uint16_t port, DnsServer **server);
74int dns_scope_udp_dns_socket(DnsScope *s, DnsServer **server);
75
76DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain);
77int dns_scope_good_key(DnsScope *s, DnsResourceKey *key);
78
79DnsServer *dns_scope_get_dns_server(DnsScope *s);
80void dns_scope_next_dns_server(DnsScope *s);
81
82int dns_scope_llmnr_membership(DnsScope *s, bool b);
83
84void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p);
85
86DnsTransaction *dns_scope_find_transaction(DnsScope *scope, DnsResourceKey *key, bool cache_ok);
87
88int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr);
89void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p);
90
91void dns_scope_dump(DnsScope *s, FILE *f);
92
93DnsSearchDomain *dns_scope_get_search_domains(DnsScope *s);