netdb.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. #ifndef _NETDB_H
  2. #include <resolv/netdb.h>
  3. #ifndef _ISOMAC
  4. # include <stdint.h>
  5. /* Macros for accessing h_errno from inside libc. */
  6. # if IS_IN_LIB
  7. # undef h_errno
  8. # if IS_IN (libc)
  9. # define h_errno __libc_h_errno
  10. # else
  11. # define h_errno __h_errno
  12. # endif
  13. extern __thread int h_errno attribute_tls_model_ie;
  14. # endif /* IS_IN_LIB */
  15. # define __set_h_errno(x) (h_errno = (x))
  16. libc_hidden_proto (hstrerror)
  17. libc_hidden_proto (innetgr)
  18. libc_hidden_proto (rcmd_af)
  19. libc_hidden_proto (rexec_af)
  20. libc_hidden_proto (rresvport_af)
  21. libc_hidden_proto (ruserok_af)
  22. libc_hidden_proto (getaddrinfo)
  23. libc_hidden_proto (getnameinfo)
  24. libc_hidden_proto (freeaddrinfo)
  25. libc_hidden_proto (gai_strerror)
  26. libc_hidden_proto (__h_errno_location)
  27. /* Document internal interfaces. */
  28. extern int __gethostent_r (struct hostent *__restrict __result_buf,
  29. char *__restrict __buf, size_t __buflen,
  30. struct hostent **__restrict __result,
  31. int *__restrict __h_errnop) attribute_hidden;
  32. extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
  33. char *__restrict __buf, size_t __buflen,
  34. struct hostent **__restrict __result,
  35. int *__restrict __h_errnop);
  36. extern int __gethostbyaddr_r (const void *__restrict __addr,
  37. socklen_t __len, int __type,
  38. struct hostent *__restrict __result_buf,
  39. char *__restrict __buf, size_t __buflen,
  40. struct hostent **__restrict __result,
  41. int *__restrict __h_errnop)
  42. attribute_hidden;
  43. extern int __old_gethostbyaddr_r (const void *__restrict __addr,
  44. socklen_t __len, int __type,
  45. struct hostent *__restrict __result_buf,
  46. char *__restrict __buf, size_t __buflen,
  47. struct hostent **__restrict __result,
  48. int *__restrict __h_errnop);
  49. extern int __gethostbyaddr2_r (const void *__restrict __addr,
  50. socklen_t __len, int __type,
  51. struct hostent *__restrict __result_buf,
  52. char *__restrict __buf, size_t __buflen,
  53. struct hostent **__restrict __result,
  54. int *__restrict __h_errnop,
  55. int32_t *ttlp);
  56. extern int __gethostbyname_r (const char *__restrict __name,
  57. struct hostent *__restrict __result_buf,
  58. char *__restrict __buf, size_t __buflen,
  59. struct hostent **__restrict __result,
  60. int *__restrict __h_errnop)
  61. attribute_hidden;
  62. extern int __old_gethostbyname_r (const char *__restrict __name,
  63. struct hostent *__restrict __result_buf,
  64. char *__restrict __buf, size_t __buflen,
  65. struct hostent **__restrict __result,
  66. int *__restrict __h_errnop);
  67. extern int __gethostbyname2_r (const char *__restrict __name, int __af,
  68. struct hostent *__restrict __result_buf,
  69. char *__restrict __buf, size_t __buflen,
  70. struct hostent **__restrict __result,
  71. int *__restrict __h_errnop)
  72. attribute_hidden;
  73. extern int __old_gethostbyname2_r (const char *__restrict __name, int __af,
  74. struct hostent *__restrict __result_buf,
  75. char *__restrict __buf, size_t __buflen,
  76. struct hostent **__restrict __result,
  77. int *__restrict __h_errnop);
  78. extern int __gethostbyname3_r (const char *__restrict __name, int __af,
  79. struct hostent *__restrict __result_buf,
  80. char *__restrict __buf, size_t __buflen,
  81. struct hostent **__restrict __result,
  82. int *__restrict __h_errnop,
  83. int32_t *ttlp, char **canonp);
  84. extern int __getnetent_r (struct netent *__restrict __result_buf,
  85. char *__restrict __buf, size_t __buflen,
  86. struct netent **__restrict __result,
  87. int *__restrict __h_errnop) attribute_hidden;
  88. extern int __old_getnetent_r (struct netent *__restrict __result_buf,
  89. char *__restrict __buf, size_t __buflen,
  90. struct netent **__restrict __result,
  91. int *__restrict __h_errnop);
  92. extern int __getnetbyaddr_r (uint32_t __net, int __type,
  93. struct netent *__restrict __result_buf,
  94. char *__restrict __buf, size_t __buflen,
  95. struct netent **__restrict __result,
  96. int *__restrict __h_errnop)
  97. attribute_hidden;
  98. extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
  99. struct netent *__restrict __result_buf,
  100. char *__restrict __buf, size_t __buflen,
  101. struct netent **__restrict __result,
  102. int *__restrict __h_errnop);
  103. extern int __getnetbyname_r (const char *__restrict __name,
  104. struct netent *__restrict __result_buf,
  105. char *__restrict __buf, size_t __buflen,
  106. struct netent **__restrict __result,
  107. int *__restrict __h_errnop)
  108. attribute_hidden;
  109. extern int __old_getnetbyname_r (const char *__restrict __name,
  110. struct netent *__restrict __result_buf,
  111. char *__restrict __buf, size_t __buflen,
  112. struct netent **__restrict __result,
  113. int *__restrict __h_errnop);
  114. extern int __getservent_r (struct servent *__restrict __result_buf,
  115. char *__restrict __buf, size_t __buflen,
  116. struct servent **__restrict __result)
  117. attribute_hidden;
  118. extern int __old_getservent_r (struct servent *__restrict __result_buf,
  119. char *__restrict __buf, size_t __buflen,
  120. struct servent **__restrict __result);
  121. extern int __getservbyname_r (const char *__restrict __name,
  122. const char *__restrict __proto,
  123. struct servent *__restrict __result_buf,
  124. char *__restrict __buf, size_t __buflen,
  125. struct servent **__restrict __result)
  126. attribute_hidden;
  127. extern int __old_getservbyname_r (const char *__restrict __name,
  128. const char *__restrict __proto,
  129. struct servent *__restrict __result_buf,
  130. char *__restrict __buf, size_t __buflen,
  131. struct servent **__restrict __result);
  132. extern int __getservbyport_r (int __port,
  133. const char *__restrict __proto,
  134. struct servent *__restrict __result_buf,
  135. char *__restrict __buf, size_t __buflen,
  136. struct servent **__restrict __result)
  137. attribute_hidden;
  138. extern int __old_getservbyport_r (int __port,
  139. const char *__restrict __proto,
  140. struct servent *__restrict __result_buf,
  141. char *__restrict __buf, size_t __buflen,
  142. struct servent **__restrict __result);
  143. extern int __getprotoent_r (struct protoent *__restrict __result_buf,
  144. char *__restrict __buf, size_t __buflen,
  145. struct protoent **__restrict __result)
  146. attribute_hidden;
  147. extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
  148. char *__restrict __buf, size_t __buflen,
  149. struct protoent **__restrict __result);
  150. extern int __getprotobyname_r (const char *__restrict __name,
  151. struct protoent *__restrict __result_buf,
  152. char *__restrict __buf, size_t __buflen,
  153. struct protoent **__restrict __result)
  154. attribute_hidden;
  155. extern int __old_getprotobyname_r (const char *__restrict __name,
  156. struct protoent *__restrict __result_buf,
  157. char *__restrict __buf, size_t __buflen,
  158. struct protoent **__restrict __result);
  159. extern int __getprotobynumber_r (int __proto,
  160. struct protoent *__restrict __res_buf,
  161. char *__restrict __buf, size_t __buflen,
  162. struct protoent **__restrict __result)
  163. attribute_hidden;
  164. extern int __old_getprotobynumber_r (int __proto,
  165. struct protoent *__restrict __res_buf,
  166. char *__restrict __buf, size_t __buflen,
  167. struct protoent **__restrict __result);
  168. extern int __getnetgrent_r (char **__restrict __hostp,
  169. char **__restrict __userp,
  170. char **__restrict __domainp,
  171. char *__restrict __buffer, size_t __buflen)
  172. attribute_hidden;
  173. extern int ruserpass (const char *host, const char **aname,
  174. const char **apass);
  175. libc_hidden_proto (ruserpass)
  176. # if __TIMESIZE == 64
  177. # define __gai_suspend_time64 __gai_suspend
  178. # else
  179. extern int __gai_suspend_time64 (const struct gaicb *const list[], int ent,
  180. const struct __timespec64 *timeout);
  181. # if PTHREAD_IN_LIBC
  182. libc_hidden_proto (__gai_suspend_time64)
  183. # else
  184. libanl_hidden_proto (__gai_suspend_time64)
  185. # endif
  186. # endif
  187. /* The following definition has been removed from the public header
  188. since we don't want people to use them. */
  189. #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
  190. #include <nss/netgroup.h>
  191. extern enum nss_status _nss_netgroup_parseline (char **cursor,
  192. struct __netgrent *result,
  193. char *buffer, size_t buflen,
  194. int *errnop);
  195. libc_hidden_proto (_nss_netgroup_parseline)
  196. #define DECLARE_NSS_PROTOTYPES(service) \
  197. extern enum nss_status _nss_ ## service ## _setprotoent (int); \
  198. extern enum nss_status _nss_ ## service ## _endprotoent (void); \
  199. extern enum nss_status _nss_ ## service ## _getprotoent_r \
  200. (struct protoent *proto, char *buffer, size_t buflen, \
  201. int *errnop); \
  202. extern enum nss_status _nss_ ## service ## _getprotobyname_r \
  203. (const char *name, struct protoent *proto, \
  204. char *buffer, size_t buflen, int *errnop); \
  205. extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
  206. (int number, struct protoent *proto, \
  207. char *buffer, size_t buflen, int *errnop); \
  208. extern enum nss_status _nss_ ## service ## _sethostent (int); \
  209. extern enum nss_status _nss_ ## service ## _endhostent (void); \
  210. extern enum nss_status _nss_ ## service ## _gethostent_r \
  211. (struct hostent *host, char *buffer, size_t buflen, \
  212. int *errnop, int *h_errnop); \
  213. extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
  214. (const char *name, int af, struct hostent *host, \
  215. char *buffer, size_t buflen, int *errnop, \
  216. int *h_errnop); \
  217. extern enum nss_status _nss_ ## service ## _gethostbyname_r \
  218. (const char *name, struct hostent *host, char *buffer, \
  219. size_t buflen, int *errnop, int *h_errnop); \
  220. extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
  221. (const void *addr, socklen_t addrlen, int af, \
  222. struct hostent *host, char *buffer, size_t buflen, \
  223. int *errnop, int *h_errnop); \
  224. extern enum nss_status _nss_ ## service ## _setservent (int); \
  225. extern enum nss_status _nss_ ## service ## _endservent (void); \
  226. extern enum nss_status _nss_ ## service ## _getservent_r \
  227. (struct servent *serv, char *buffer, size_t buflen, \
  228. int *errnop); \
  229. extern enum nss_status _nss_ ## service ## _getservbyname_r \
  230. (const char *name, const char *protocol, \
  231. struct servent *serv, char *buffer, size_t buflen, \
  232. int *errnop); \
  233. extern enum nss_status _nss_ ## service ## _getservbyport_r \
  234. (int port, const char *protocol, struct servent *serv, \
  235. char *buffer, size_t buflen, int *errnop); \
  236. extern enum nss_status _nss_ ## service ## _setnetgrent \
  237. (const char *group, struct __netgrent *result); \
  238. extern enum nss_status _nss_ ## service ## _endnetgrent \
  239. (struct __netgrent *result); \
  240. extern enum nss_status _nss_ ## service ## _getnetgrent_r \
  241. (struct __netgrent *result, char *buffer, \
  242. size_t buflen, int *errnop); \
  243. extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
  244. extern enum nss_status _nss_ ## service ## _endnetent (void); \
  245. extern enum nss_status _nss_ ## service ## _getnetent_r \
  246. (struct netent *net, char *buffer, size_t buflen, \
  247. int *errnop, int *herrnop); \
  248. extern enum nss_status _nss_ ## service ## _getnetbyname_r \
  249. (const char *name, struct netent *net, char *buffer, \
  250. size_t buflen, int *errnop, int *herrnop); \
  251. extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
  252. (uint32_t addr, int type, struct netent *net, \
  253. char *buffer, size_t buflen, int *errnop, \
  254. int *herrnop); \
  255. extern enum nss_status _nss_ ## service ## _endspent (void);
  256. DECLARE_NSS_PROTOTYPES (compat)
  257. DECLARE_NSS_PROTOTYPES (dns)
  258. DECLARE_NSS_PROTOTYPES (files)
  259. DECLARE_NSS_PROTOTYPES (hesiod)
  260. #undef DECLARE_NSS_PROTOTYPES
  261. #endif
  262. #endif /* !_NETDB_H */