]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/resolved-dns-search-domain.h
resolved: add a generic DnsSearchDomain concept
[thirdparty/systemd.git] / src / resolve / resolved-dns-search-domain.h
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 2015 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 "macro.h"
25
26 typedef struct DnsSearchDomain DnsSearchDomain;
27
28 typedef enum DnsSearchDomainType {
29 DNS_SEARCH_DOMAIN_SYSTEM,
30 DNS_SEARCH_DOMAIN_LINK,
31 } DnsSearchDomainType;
32
33 #include "resolved-link.h"
34 #include "resolved-manager.h"
35
36 struct DnsSearchDomain {
37 Manager *manager;
38
39 unsigned n_ref;
40
41 DnsSearchDomainType type;
42 Link *link;
43
44 char *name;
45
46 bool marked:1;
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
71 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsSearchDomain*, dns_search_domain_unref);