blob: ec61445aa8eb92ae9acd898eeed7844cbaa191a0 [file] [log] [blame]
Bernie Innocenti55864192018-08-30 04:05:20 +09001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Bernie Innocenti189eb502018-10-01 23:10:18 +090017#ifndef NETD_RESOLV_PARAMS_H
18#define NETD_RESOLV_PARAMS_H
Bernie Innocenti55864192018-08-30 04:05:20 +090019
20#include <stdint.h>
21
Bernie Innocenti34de3ba2019-02-19 18:08:36 +090022#define MAXNS 4 // max # name servers we'll track
23#define MAXDNSRCH 6 // max # domains in search path
24#define MAXDNSRCHPATH 256 // max length of domain search paths
25#define MAXNSSAMPLES 64 // max # samples to store per server
Bernie Innocenti55864192018-08-30 04:05:20 +090026
Bernie Innocenti189eb502018-10-01 23:10:18 +090027// Per-netid configuration parameters passed from netd to the resolver
Bernie Innocenti34de3ba2019-02-19 18:08:36 +090028struct res_params {
Bernie Innocentif12d5bb2018-08-31 14:09:46 +090029 uint16_t sample_validity; // sample lifetime in s
Bernie Innocenti55864192018-08-30 04:05:20 +090030 // threshold of success / total samples below which a server is considered broken
Bernie Innocentif12d5bb2018-08-31 14:09:46 +090031 uint8_t success_threshold; // 0: disable, value / 100 otherwise
32 uint8_t min_samples; // min # samples needed for statistics to be considered meaningful
33 uint8_t max_samples; // max # samples taken into account for statistics
34 int base_timeout_msec; // base query retry timeout (if 0, use RES_TIMEOUT)
waynemad193e4d2019-02-18 17:47:59 +080035 int retry_count; // number of retries
Bernie Innocenti55864192018-08-30 04:05:20 +090036};
37
Mike Yua46fae72018-11-01 20:07:00 +080038// The DNS over TLS mode on a specific netId.
39enum class PrivateDnsMode : uint8_t { OFF, OPPORTUNISTIC, STRICT };
Bernie Innocenti55864192018-08-30 04:05:20 +090040
Mike Yua46fae72018-11-01 20:07:00 +080041// Validation status of a DNS over TLS server (on a specific netId).
42enum class Validation : uint8_t { in_process, success, fail, unknown_server, unknown_netid };
Bernie Innocenti55864192018-08-30 04:05:20 +090043
Bernie Innocentiee1b85b2018-09-25 14:23:19 +090044#define LIBNETD_RESOLV_PUBLIC extern "C" [[gnu::visibility("default")]]
45
Bernie Innocenti189eb502018-10-01 23:10:18 +090046#endif // NETD_RESOLV_PARAMS_H