gai_strerror.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 __MINGW32__
  34. # undef SIZE_MAX
  35. #endif // __MINGW32__
  36. #ifdef HAVE_CONFIG_H
  37. # include "config.h"
  38. #endif // HAVE_CONFIG_H
  39. /********************************************************************/
  40. /*
  41. * Undefine all the macros.
  42. * <netdb.h> might defines some of them.
  43. */
  44. #ifdef EAI_ADDRFAMILY
  45. #undef EAI_ADDRFAMILY
  46. #endif
  47. #ifdef EAI_AGAIN
  48. #undef EAI_AGAIN
  49. #endif
  50. #ifdef EAI_BADFLAGS
  51. #undef EAI_BADFLAGS
  52. #endif
  53. #ifdef EAI_FAIL
  54. #undef EAI_FAIL
  55. #endif
  56. #ifdef EAI_FAMILY
  57. #undef EAI_FAMILY
  58. #endif
  59. #ifdef EAI_MEMORY
  60. #undef EAI_MEMORY
  61. #endif
  62. #ifdef EAI_NONAME
  63. #undef EAI_NONAME
  64. #endif
  65. #ifdef EAI_OVERFLOW
  66. #undef EAI_OVERFLOW
  67. #endif
  68. #ifdef EAI_SERVICE
  69. #undef EAI_SERVICE
  70. #endif
  71. #ifdef EAI_SOCKTYPE
  72. #undef EAI_SOCKTYPE
  73. #endif
  74. #ifdef EAI_SYSTEM
  75. #undef EAI_SYSTEM
  76. #endif
  77. #ifdef AI_PASSIVE
  78. #undef AI_PASSIVE
  79. #endif
  80. #ifdef AI_CANONNAME
  81. #undef AI_CANONNAME
  82. #endif
  83. #ifdef AI_NUMERICHOST
  84. #undef AI_NUMERICHOST
  85. #endif
  86. #ifdef AI_NUMERICSERV
  87. #undef AI_NUMERICSERV
  88. #endif
  89. #ifdef AI_V4MAPPED
  90. #undef AI_V4MAPPED
  91. #endif
  92. #ifdef AI_ALL
  93. #undef AI_ALL
  94. #endif
  95. #ifdef AI_ADDRCONFIG
  96. #undef AI_ADDRCONFIG
  97. #endif
  98. #ifdef AI_DEFAULT
  99. #undef AI_DEFAULT
  100. #endif
  101. #ifdef NI_NOFQDN
  102. #undef NI_NOFQDN
  103. #endif
  104. #ifdef NI_NUMERICHOST
  105. #undef NI_NUMERICHOST
  106. #endif
  107. #ifdef NI_NAMEREQD
  108. #undef NI_NAMEREQD
  109. #endif
  110. #ifdef NI_NUMERICSERV
  111. #undef NI_NUMERICSERV
  112. #endif
  113. #ifdef NI_NUMERICSCOPE
  114. #undef NI_NUMERICSCOPE
  115. #endif
  116. #ifdef NI_DGRAM
  117. #undef NI_DGRAM
  118. #endif
  119. #ifdef NI_MAXHOST
  120. #undef NI_MAXHOST
  121. #endif
  122. #ifdef NI_MAXSERV
  123. #undef NI_MAXSERV
  124. #endif
  125. /*
  126. * Fake struct and function names.
  127. * <netdb.h> might declares all or some of them.
  128. */
  129. #if defined(HAVE_GAI_STRERROR)
  130. #define gai_strerror my_gai_strerror
  131. #endif
  132. /********************************************************************/
  133. /*
  134. * Error codes.
  135. */
  136. #define EAI_ADDRFAMILY 1
  137. #define EAI_AGAIN 2
  138. #define EAI_BADFLAGS 3
  139. #define EAI_FAIL 4
  140. #define EAI_FAMILY 5
  141. #define EAI_MEMORY 6
  142. #define EAI_NONAME 7
  143. #define EAI_OVERFLOW 8
  144. #define EAI_SERVICE 9
  145. #define EAI_SOCKTYPE 10
  146. #define EAI_SYSTEM 11
  147. /*
  148. * Functions.
  149. */
  150. #ifdef __STDC__
  151. const char *gai_strerror(int);
  152. #else
  153. const char *gai_strerror();
  154. #endif
  155. #ifdef __cplusplus
  156. };
  157. #endif /* __cplusplus */
  158. #endif /* not _D_GAI_STRERROR_H */