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