16b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai/* 26b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * Copyright (C) 2016 The Android Open Source Project 36b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * 46b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * Licensed under the Apache License, Version 2.0 (the "License"); 56b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * you may not use this file except in compliance with the License. 66b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * You may obtain a copy of the License at 76b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * 86b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * http://www.apache.org/licenses/LICENSE-2.0 96b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * 106b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * Unless required by applicable law or agreed to in writing, software 116b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * distributed under the License is distributed on an "AS IS" BASIS, 126b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * See the License for the specific language governing permissions and 146b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * limitations under the License. 156b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai */ 166b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 176b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai#ifndef _RESOLV_PARAMS_H 186b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai#define _RESOLV_PARAMS_H 196b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 206b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai#include <stdint.h> 216b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 226b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai/* Hard-coded defines */ 2397c9d73a8787e3d8e0a4a4b3445fc5d71f0eb222Pierre Imai#define MAXNS 4 /* max # name servers we'll track */ 2497c9d73a8787e3d8e0a4a4b3445fc5d71f0eb222Pierre Imai#define MAXDNSRCH 6 /* max # domains in search path */ 2597c9d73a8787e3d8e0a4a4b3445fc5d71f0eb222Pierre Imai#define MAXDNSRCHPATH 256 /* max length of domain search paths */ 2697c9d73a8787e3d8e0a4a4b3445fc5d71f0eb222Pierre Imai#define MAXNSSAMPLES 64 /* max # samples to store per server */ 276b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 286b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai/* Defaults used for initializing __res_params */ 29fff356786f8a3a98c5c29f12bb7e59e6d98076a9Pierre Imai#define SUCCESS_THRESHOLD 75 /* if successes * 100 / total_samples is less than 306b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * this value, the server is considered failing 316b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai */ 326b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai#define NSSAMPLE_VALIDITY 1800 /* Sample validity in seconds. 336b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * Set to -1 to disable skipping failing 346b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai * servers. 356b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai */ 366b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 376b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai/* per-netid configuration parameters passed from netd to the resolver */ 386b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imaistruct __res_params { 396b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai uint16_t sample_validity; // sample lifetime in s 406b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai // threshold of success / total samples below which a server is considered broken 416b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai uint8_t success_threshold; // 0: disable, value / 100 otherwise 426b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai uint8_t min_samples; // min # samples needed for statistics to be considered meaningful 436b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai uint8_t max_samples; // max # samples taken into account for statistics 449935e0fceeceaa344a9b8ec404ba24c173a13509Stephen Hines}; 456b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai 466b3f0d65f2c706625e5efb495df0f2c6178b965aPierre Imai#endif // _RESOLV_PARAMS_H 47