]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-search-domain.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / resolve / resolved-dns-search-domain.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
a51c1048
LP
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2015 Lennart Poettering
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include "macro.h"
24
25typedef struct DnsSearchDomain DnsSearchDomain;
26
27typedef enum DnsSearchDomainType {
28 DNS_SEARCH_DOMAIN_SYSTEM,
29 DNS_SEARCH_DOMAIN_LINK,
30} DnsSearchDomainType;
31
32#include "resolved-link.h"
33#include "resolved-manager.h"
34
35struct DnsSearchDomain {
36 Manager *manager;
37
38 unsigned n_ref;
39
40 DnsSearchDomainType type;
41 Link *link;
42
43 char *name;
44
45 bool marked:1;
ad44b56b 46 bool route_only:1;
a51c1048
LP
47
48 bool linked:1;
49 LIST_FIELDS(DnsSearchDomain, domains);
50};
51
52int dns_search_domain_new(
53 Manager *m,
54 DnsSearchDomain **ret,
55 DnsSearchDomainType type,
56 Link *link,
57 const char *name);
58
59DnsSearchDomain* dns_search_domain_ref(DnsSearchDomain *d);
60DnsSearchDomain* dns_search_domain_unref(DnsSearchDomain *d);
61
62void dns_search_domain_unlink(DnsSearchDomain *d);
63void dns_search_domain_move_back_and_unmark(DnsSearchDomain *d);
64
65void dns_search_domain_unlink_all(DnsSearchDomain *first);
66void dns_search_domain_unlink_marked(DnsSearchDomain *first);
67void dns_search_domain_mark_all(DnsSearchDomain *first);
68
69int dns_search_domain_find(DnsSearchDomain *first, const char *name, DnsSearchDomain **ret);
70
801ad6a6
LP
71static inline const char* DNS_SEARCH_DOMAIN_NAME(DnsSearchDomain *d) {
72 return d ? d->name : NULL;
73}
74
a51c1048 75DEFINE_TRIVIAL_CLEANUP_FUNC(DnsSearchDomain*, dns_search_domain_unref);