PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/netdb.in.h

https://github.com/hpc/Parallel-coreutils
C Header | 185 lines | 100 code | 25 blank | 60 comment | 10 complexity | 55cf7219b4f4cda32d09588ff8e720f0 MD5 | raw file
  1. /* -*- buffer-read-only: t -*- vi: set ro: */
  2. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  3. #line 1
  4. /* Provide a netdb.h header file for systems lacking it (read: MinGW).
  5. Copyright (C) 2008 Free Software Foundation, Inc.
  6. Written by Simon Josefsson.
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 3, or (at your option)
  10. any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software Foundation,
  17. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  18. /* This file is supposed to be used on platforms that lack <netdb.h>.
  19. It is intended to provide definitions and prototypes needed by an
  20. application. */
  21. #ifndef _GL_NETDB_H
  22. #if @HAVE_NETDB_H@
  23. # if __GNUC__ >= 3
  24. @PRAGMA_SYSTEM_HEADER@
  25. # endif
  26. /* The include_next requires a split double-inclusion guard. */
  27. # @INCLUDE_NEXT@ @NEXT_NETDB_H@
  28. #endif
  29. #ifndef _GL_NETDB_H
  30. #define _GL_NETDB_H
  31. /* Get netdb.h definitions such as struct hostent for MinGW. */
  32. #include <sys/socket.h>
  33. /* Declarations for a platform that lacks <netdb.h>, or where it is
  34. incomplete. */
  35. #if @GNULIB_GETADDRINFO@
  36. # if !@HAVE_STRUCT_ADDRINFO@
  37. /* Structure to contain information about address of a service provider. */
  38. struct addrinfo
  39. {
  40. int ai_flags; /* Input flags. */
  41. int ai_family; /* Protocol family for socket. */
  42. int ai_socktype; /* Socket type. */
  43. int ai_protocol; /* Protocol for socket. */
  44. socklen_t ai_addrlen; /* Length of socket address. */
  45. struct sockaddr *ai_addr; /* Socket address for socket. */
  46. char *ai_canonname; /* Canonical name for service location. */
  47. struct addrinfo *ai_next; /* Pointer to next in list. */
  48. };
  49. # endif
  50. /* Possible values for `ai_flags' field in `addrinfo' structure. */
  51. # ifndef AI_PASSIVE
  52. # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
  53. # endif
  54. # ifndef AI_CANONNAME
  55. # define AI_CANONNAME 0x0002 /* Request for canonical name. */
  56. # endif
  57. # ifndef AI_NUMERICSERV
  58. # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
  59. # endif
  60. # if 0
  61. /* The commented out definitions below are not yet implemented in the
  62. GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
  63. cause conflicts on systems with a getaddrinfo() function which does not
  64. define them.
  65. If they are restored, be sure to protect the definitions with #ifndef. */
  66. # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
  67. # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
  68. # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
  69. # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
  70. returned address type.. */
  71. # endif /* 0 */
  72. /* Error values for `getaddrinfo' function. */
  73. # ifndef EAI_BADFLAGS
  74. # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
  75. # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
  76. # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
  77. # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
  78. # define EAI_NODATA -5 /* No address associated with NAME. */
  79. # define EAI_FAMILY -6 /* `ai_family' not supported. */
  80. # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
  81. # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
  82. # define EAI_MEMORY -10 /* Memory allocation failure. */
  83. # endif
  84. /* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
  85. FreeBSD, which does define EAI_BADFLAGS) have removed the definition
  86. in favor of EAI_NONAME. */
  87. # if !defined EAI_NODATA && defined EAI_NONAME
  88. # define EAI_NODATA EAI_NONAME
  89. # endif
  90. # ifndef EAI_OVERFLOW
  91. /* Not defined on mingw32 and Haiku. */
  92. # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
  93. # endif
  94. # ifndef EAI_ADDRFAMILY
  95. /* Not defined on mingw32. */
  96. # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
  97. # endif
  98. # ifndef EAI_SYSTEM
  99. /* Not defined on mingw32. */
  100. # define EAI_SYSTEM -11 /* System error returned in `errno'. */
  101. # endif
  102. # if 0
  103. /* The commented out definitions below are not yet implemented in the
  104. GNULIB getaddrinfo() replacement, so are not yet needed.
  105. If they are restored, be sure to protect the definitions with #ifndef. */
  106. # ifndef EAI_INPROGRESS
  107. # define EAI_INPROGRESS -100 /* Processing request in progress. */
  108. # define EAI_CANCELED -101 /* Request canceled. */
  109. # define EAI_NOTCANCELED -102 /* Request not canceled. */
  110. # define EAI_ALLDONE -103 /* All requests done. */
  111. # define EAI_INTR -104 /* Interrupted by a signal. */
  112. # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
  113. # endif
  114. # endif
  115. # if !@HAVE_DECL_GETADDRINFO@
  116. /* Translate name of a service location and/or a service name to set of
  117. socket addresses.
  118. For more details, see the POSIX:2001 specification
  119. <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
  120. extern int getaddrinfo (const char *restrict nodename,
  121. const char *restrict servname,
  122. const struct addrinfo *restrict hints,
  123. struct addrinfo **restrict res);
  124. # endif
  125. # if !@HAVE_DECL_FREEADDRINFO@
  126. /* Free `addrinfo' structure AI including associated storage.
  127. For more details, see the POSIX:2001 specification
  128. <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
  129. extern void freeaddrinfo (struct addrinfo *ai);
  130. # endif
  131. # if !@HAVE_DECL_GAI_STRERROR@
  132. /* Convert error return from getaddrinfo() to a string.
  133. For more details, see the POSIX:2001 specification
  134. <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
  135. extern const char *gai_strerror (int ecode);
  136. # endif
  137. # if !@HAVE_DECL_GETNAMEINFO@
  138. /* Convert socket address to printable node and service names.
  139. For more details, see the POSIX:2001 specification
  140. <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
  141. extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
  142. char *restrict node, socklen_t nodelen,
  143. char *restrict service, socklen_t servicelen,
  144. int flags);
  145. # endif
  146. /* Possible flags for getnameinfo. */
  147. # ifndef NI_NUMERICHOST
  148. # define NI_NUMERICHOST 1
  149. # endif
  150. # ifndef NI_NUMERICSERV
  151. # define NI_NUMERICSERV 2
  152. # endif
  153. #endif /* @GNULIB_GETADDRINFO@ */
  154. #endif /* _GL_NETDB_H */
  155. #endif /* _GL_NETDB_H */