gai_strerror.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * Copyright (c) 2001, 02 Motoyuki Kasahara
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * 3. Neither the name of the project nor the names of its contributors
  13. * may be used to endorse or promote products derived from this software
  14. * without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  20. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. * SUCH DAMAGE.
  27. */
  28. #ifndef _D_GAI_STRERROR_H
  29. #define _D_GAI_STRERROR_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif /* __cplusplus */
  33. #ifdef HAVE_CONFIG_H
  34. # include "config.h"
  35. #endif // HAVE_CONFIG_H
  36. /********************************************************************/
  37. /*
  38. * Undefine all the macros.
  39. * <netdb.h> might defines some of them.
  40. */
  41. #ifdef EAI_ADDRFAMILY
  42. #undef EAI_ADDRFAMILY
  43. #endif
  44. #ifdef EAI_AGAIN
  45. #undef EAI_AGAIN
  46. #endif
  47. #ifdef EAI_BADFLAGS
  48. #undef EAI_BADFLAGS
  49. #endif
  50. #ifdef EAI_FAIL
  51. #undef EAI_FAIL
  52. #endif
  53. #ifdef EAI_FAMILY
  54. #undef EAI_FAMILY
  55. #endif
  56. #ifdef EAI_MEMORY
  57. #undef EAI_MEMORY
  58. #endif
  59. #ifdef EAI_NONAME
  60. #undef EAI_NONAME
  61. #endif
  62. #ifdef EAI_OVERFLOW
  63. #undef EAI_OVERFLOW
  64. #endif
  65. #ifdef EAI_SERVICE
  66. #undef EAI_SERVICE
  67. #endif
  68. #ifdef EAI_SOCKTYPE
  69. #undef EAI_SOCKTYPE
  70. #endif
  71. #ifdef EAI_SYSTEM
  72. #undef EAI_SYSTEM
  73. #endif
  74. #ifdef AI_PASSIVE
  75. #undef AI_PASSIVE
  76. #endif
  77. #ifdef AI_CANONNAME
  78. #undef AI_CANONNAME
  79. #endif
  80. #ifdef AI_NUMERICHOST
  81. #undef AI_NUMERICHOST
  82. #endif
  83. #ifdef AI_NUMERICSERV
  84. #undef AI_NUMERICSERV
  85. #endif
  86. #ifdef AI_V4MAPPED
  87. #undef AI_V4MAPPED
  88. #endif
  89. #ifdef AI_ALL
  90. #undef AI_ALL
  91. #endif
  92. #ifdef AI_ADDRCONFIG
  93. #undef AI_ADDRCONFIG
  94. #endif
  95. #ifdef AI_DEFAULT
  96. #undef AI_DEFAULT
  97. #endif
  98. #ifdef NI_NOFQDN
  99. #undef NI_NOFQDN
  100. #endif
  101. #ifdef NI_NUMERICHOST
  102. #undef NI_NUMERICHOST
  103. #endif
  104. #ifdef NI_NAMEREQD
  105. #undef NI_NAMEREQD
  106. #endif
  107. #ifdef NI_NUMERICSERV
  108. #undef NI_NUMERICSERV
  109. #endif
  110. #ifdef NI_NUMERICSCOPE
  111. #undef NI_NUMERICSCOPE
  112. #endif
  113. #ifdef NI_DGRAM
  114. #undef NI_DGRAM
  115. #endif
  116. #ifdef NI_MAXHOST
  117. #undef NI_MAXHOST
  118. #endif
  119. #ifdef NI_MAXSERV
  120. #undef NI_MAXSERV
  121. #endif
  122. /*
  123. * Fake struct and function names.
  124. * <netdb.h> might declares all or some of them.
  125. */
  126. #if defined(HAVE_GAI_STRERROR)
  127. #define gai_strerror my_gai_strerror
  128. #endif
  129. /********************************************************************/
  130. /*
  131. * Error codes.
  132. */
  133. #define EAI_ADDRFAMILY 1
  134. #define EAI_AGAIN 2
  135. #define EAI_BADFLAGS 3
  136. #define EAI_FAIL 4
  137. #define EAI_FAMILY 5
  138. #define EAI_MEMORY 6
  139. #define EAI_NONAME 7
  140. #define EAI_OVERFLOW 8
  141. #define EAI_SERVICE 9
  142. #define EAI_SOCKTYPE 10
  143. #define EAI_SYSTEM 11
  144. /*
  145. * Functions.
  146. */
  147. #ifdef __STDC__
  148. const char *gai_strerror(int);
  149. #else
  150. const char *gai_strerror();
  151. #endif
  152. #ifdef __cplusplus
  153. };
  154. #endif /* __cplusplus */
  155. #endif /* not _D_GAI_STRERROR_H */