res_hconf.h 2.2 KB

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