]>
Commit | Line | Data |
---|---|---|
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 | ||
25 | typedef struct DnsSearchDomain DnsSearchDomain; | |
26 | ||
27 | typedef 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 | ||
35 | struct 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 | ||
52 | int dns_search_domain_new( | |
53 | Manager *m, | |
54 | DnsSearchDomain **ret, | |
55 | DnsSearchDomainType type, | |
56 | Link *link, | |
57 | const char *name); | |
58 | ||
59 | DnsSearchDomain* dns_search_domain_ref(DnsSearchDomain *d); | |
60 | DnsSearchDomain* dns_search_domain_unref(DnsSearchDomain *d); | |
61 | ||
62 | void dns_search_domain_unlink(DnsSearchDomain *d); | |
63 | void dns_search_domain_move_back_and_unmark(DnsSearchDomain *d); | |
64 | ||
65 | void dns_search_domain_unlink_all(DnsSearchDomain *first); | |
66 | void dns_search_domain_unlink_marked(DnsSearchDomain *first); | |
67 | void dns_search_domain_mark_all(DnsSearchDomain *first); | |
68 | ||
69 | int dns_search_domain_find(DnsSearchDomain *first, const char *name, DnsSearchDomain **ret); | |
70 | ||
801ad6a6 LP |
71 | static inline const char* DNS_SEARCH_DOMAIN_NAME(DnsSearchDomain *d) { |
72 | return d ? d->name : NULL; | |
73 | } | |
74 | ||
a51c1048 | 75 | DEFINE_TRIVIAL_CLEANUP_FUNC(DnsSearchDomain*, dns_search_domain_unref); |