]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/resolve-util.h
975156ca96b16a896427f57f57fa97993bb08671
[thirdparty/systemd.git] / src / shared / resolve-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2016 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 enum ResolveSupport ResolveSupport;
26 typedef enum DnssecMode DnssecMode;
27
28 enum ResolveSupport {
29 RESOLVE_SUPPORT_NO,
30 RESOLVE_SUPPORT_YES,
31 RESOLVE_SUPPORT_RESOLVE,
32 _RESOLVE_SUPPORT_MAX,
33 _RESOLVE_SUPPORT_INVALID = -1
34 };
35
36 enum DnssecMode {
37 /* No DNSSEC validation is done */
38 DNSSEC_NO,
39
40 /* Validate locally, if the server knows DO, but if not,
41 * don't. Don't trust the AD bit. If the server doesn't do
42 * DNSSEC properly, downgrade to non-DNSSEC operation. Of
43 * course, we then are vulnerable to a downgrade attack, but
44 * that's life and what is configured. */
45 DNSSEC_ALLOW_DOWNGRADE,
46
47 /* Insist on DNSSEC server support, and rather fail than downgrading. */
48 DNSSEC_YES,
49
50 _DNSSEC_MODE_MAX,
51 _DNSSEC_MODE_INVALID = -1
52 };
53
54 int config_parse_resolve_support(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
55 int config_parse_dnssec_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
56
57 const char* resolve_support_to_string(ResolveSupport p) _const_;
58 ResolveSupport resolve_support_from_string(const char *s) _pure_;
59
60 const char* dnssec_mode_to_string(DnssecMode p) _const_;
61 DnssecMode dnssec_mode_from_string(const char *s) _pure_;