]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-search-domain.h
resolved: automatically forget all learnt DNS server information when the network...
[thirdparty/systemd.git] / src / resolve / resolved-dns-search-domain.h
CommitLineData
a51c1048
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2015 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 "macro.h"
23
24typedef struct DnsSearchDomain DnsSearchDomain;
25
26typedef enum DnsSearchDomainType {
27 DNS_SEARCH_DOMAIN_SYSTEM,
28 DNS_SEARCH_DOMAIN_LINK,
29} DnsSearchDomainType;
30
31#include "resolved-link.h"
32#include "resolved-manager.h"
33
34struct DnsSearchDomain {
35 Manager *manager;
36
37 unsigned n_ref;
38
39 DnsSearchDomainType type;
40 Link *link;
41
42 char *name;
43
44 bool marked:1;
ad44b56b 45 bool route_only:1;
a51c1048
LP
46
47 bool linked:1;
48 LIST_FIELDS(DnsSearchDomain, domains);
49};
50
51int dns_search_domain_new(
52 Manager *m,
53 DnsSearchDomain **ret,
54 DnsSearchDomainType type,
55 Link *link,
56 const char *name);
57
58DnsSearchDomain* dns_search_domain_ref(DnsSearchDomain *d);
59DnsSearchDomain* dns_search_domain_unref(DnsSearchDomain *d);
60
61void dns_search_domain_unlink(DnsSearchDomain *d);
62void dns_search_domain_move_back_and_unmark(DnsSearchDomain *d);
63
64void dns_search_domain_unlink_all(DnsSearchDomain *first);
65void dns_search_domain_unlink_marked(DnsSearchDomain *first);
66void dns_search_domain_mark_all(DnsSearchDomain *first);
67
68int dns_search_domain_find(DnsSearchDomain *first, const char *name, DnsSearchDomain **ret);
69
801ad6a6
LP
70static inline const char* DNS_SEARCH_DOMAIN_NAME(DnsSearchDomain *d) {
71 return d ? d->name : NULL;
72}
73
a51c1048 74DEFINE_TRIVIAL_CLEANUP_FUNC(DnsSearchDomain*, dns_search_domain_unref);