/contrib/bind9/lib/irs/include/irs/netdb.h.in

https://bitbucket.org/freebsd/freebsd-head/ · Autoconf · 167 lines · 62 code · 23 blank · 82 comment · 8 complexity · 1368ed64558ff0c0f783cb696fbcb6e6 MD5 · raw file

  1. /*
  2. * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  9. * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  10. * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  13. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14. * PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /* $Id: netdb.h.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
  17. /*! \file */
  18. #ifndef IRS_NETDB_H
  19. #define IRS_NETDB_H 1
  20. #include <stddef.h> /* Required on FreeBSD (and others?) for size_t. */
  21. #include <netdb.h> /* Contractual provision. */
  22. /*
  23. * Define if <netdb.h> does not declare struct addrinfo.
  24. */
  25. @ISC_IRS_NEEDADDRINFO@
  26. #ifdef ISC_IRS_NEEDADDRINFO
  27. struct addrinfo {
  28. int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
  29. int ai_family; /* PF_xxx */
  30. int ai_socktype; /* SOCK_xxx */
  31. int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
  32. size_t ai_addrlen; /* Length of ai_addr */
  33. char *ai_canonname; /* Canonical name for hostname */
  34. struct sockaddr *ai_addr; /* Binary address */
  35. struct addrinfo *ai_next; /* Next structure in linked list */
  36. };
  37. #endif
  38. /*
  39. * Undefine all #defines we are interested in as <netdb.h> may or may not have
  40. * defined them.
  41. */
  42. /*
  43. * Error return codes from gethostbyname() and gethostbyaddr()
  44. * (left in extern int h_errno).
  45. */
  46. #undef NETDB_INTERNAL
  47. #undef NETDB_SUCCESS
  48. #undef HOST_NOT_FOUND
  49. #undef TRY_AGAIN
  50. #undef NO_RECOVERY
  51. #undef NO_DATA
  52. #undef NO_ADDRESS
  53. #define NETDB_INTERNAL -1 /* see errno */
  54. #define NETDB_SUCCESS 0 /* no problem */
  55. #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
  56. #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
  57. #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  58. #define NO_DATA 4 /* Valid name, no data record of requested type */
  59. #define NO_ADDRESS NO_DATA /* no address, look for MX record */
  60. /*
  61. * Error return codes from getaddrinfo(). EAI_INSECUREDATA is our own extension
  62. * and it's very unlikely to be already defined, but undef it just in case; it
  63. * at least doesn't do any harm.
  64. */
  65. #undef EAI_ADDRFAMILY
  66. #undef EAI_AGAIN
  67. #undef EAI_BADFLAGS
  68. #undef EAI_FAIL
  69. #undef EAI_FAMILY
  70. #undef EAI_MEMORY
  71. #undef EAI_NODATA
  72. #undef EAI_NONAME
  73. #undef EAI_SERVICE
  74. #undef EAI_SOCKTYPE
  75. #undef EAI_SYSTEM
  76. #undef EAI_BADHINTS
  77. #undef EAI_PROTOCOL
  78. #undef EAI_OVERFLOW
  79. #undef EAI_INSECUREDATA
  80. #undef EAI_MAX
  81. #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
  82. #define EAI_AGAIN 2 /* temporary failure in name resolution */
  83. #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
  84. #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
  85. #define EAI_FAMILY 5 /* ai_family not supported */
  86. #define EAI_MEMORY 6 /* memory allocation failure */
  87. #define EAI_NODATA 7 /* no address associated with hostname */
  88. #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
  89. #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
  90. #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
  91. #define EAI_SYSTEM 11 /* system error returned in errno */
  92. #define EAI_BADHINTS 12
  93. #define EAI_PROTOCOL 13
  94. #define EAI_OVERFLOW 14
  95. #define EAI_INSECUREDATA 15
  96. #define EAI_MAX 16
  97. /*
  98. * Flag values for getaddrinfo()
  99. */
  100. #undef AI_PASSIVE
  101. #undef AI_CANONNAME
  102. #undef AI_NUMERICHOST
  103. #define AI_PASSIVE 0x00000001
  104. #define AI_CANONNAME 0x00000002
  105. #define AI_NUMERICHOST 0x00000004
  106. /*
  107. * Flag values for getipnodebyname()
  108. */
  109. #undef AI_V4MAPPED
  110. #undef AI_ALL
  111. #undef AI_ADDRCONFIG
  112. #undef AI_DEFAULT
  113. #define AI_V4MAPPED 0x00000008
  114. #define AI_ALL 0x00000010
  115. #define AI_ADDRCONFIG 0x00000020
  116. #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
  117. /*
  118. * Constants for lwres_getnameinfo()
  119. */
  120. #undef NI_MAXHOST
  121. #undef NI_MAXSERV
  122. #define NI_MAXHOST 1025
  123. #define NI_MAXSERV 32
  124. /*
  125. * Flag values for lwres_getnameinfo()
  126. */
  127. #undef NI_NOFQDN
  128. #undef NI_NUMERICHOST
  129. #undef NI_NAMEREQD
  130. #undef NI_NUMERICSERV
  131. #undef NI_DGRAM
  132. #undef NI_NUMERICSCOPE
  133. #define NI_NOFQDN 0x00000001
  134. #define NI_NUMERICHOST 0x00000002
  135. #define NI_NAMEREQD 0x00000004
  136. #define NI_NUMERICSERV 0x00000008
  137. #define NI_DGRAM 0x00000010
  138. /*
  139. * Tell Emacs to use C mode on this file.
  140. * Local variables:
  141. * mode: c
  142. * End:
  143. */
  144. #endif /* IRS_NETDB_H */