1 /* Copyright (C) 1993-2022 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <https://www.gnu.org/licenses/>. */ 17 18 #ifndef _RES_HCONF_H_ 19 #define _RES_HCONF_H_ 20 21 #include <netdb.h> 22 23 #define TRIMDOMAINS_MAX 4 24 25 struct hconf 26 { 27 /* We keep the INITIALIZED member only for backwards compatibility. New 28 code should just call _res_hconf_init unconditionally. For this field 29 to be used safely, users must ensure that either (1) a call to 30 _res_hconf_init happens-before any load from INITIALIZED, or (2) an 31 assignment of zero to INITIALIZED happens-before any load from it, and 32 these loads use acquire MO if the intent is to skip calling 33 _res_hconf_init if the load returns a nonzero value. Such acquire MO 34 loads will then synchronize with the release MO store to INITIALIZED 35 in do_init in res_hconf.c; see pthread_once for more detail. */ 36 int initialized; 37 int unused1; 38 int unused2[4]; 39 int num_trimdomains; 40 const char *trimdomain[TRIMDOMAINS_MAX]; 41 unsigned int flags; 42 # define HCONF_FLAG_INITED (1 << 0) /* initialized? */ 43 # define HCONF_FLAG_REORDER (1 << 3) /* list best address first */ 44 # define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */ 45 }; 46 extern struct hconf _res_hconf; 47 48 extern void _res_hconf_init (void) attribute_hidden; 49 extern void _res_hconf_trim_domain (char *domain); 50 extern void _res_hconf_trim_domains (struct hostent *hp); 51 extern void _res_hconf_reorder_addrs (struct hostent *hp); 52 53 #endif /* _RES_HCONF_H_ */ 54