addrinfo.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __addrinfo_h
  2. #define __addrinfo_h
  3. /*
  4. * Everything here really belongs in <netdb.h>.
  5. * These defines are separate for now, to avoid having to modify the
  6. * system's header.
  7. */
  8. struct addrinfo {
  9. int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
  10. int ai_family; /* PF_xxx */
  11. int ai_socktype; /* SOCK_xxx */
  12. int ai_protocol; /* IPPROTO_xxx for IPv4 and IPv6 */
  13. size_t ai_addrlen; /* length of ai_addr */
  14. char *ai_canonname; /* canonical name for host */
  15. struct sockaddr *ai_addr; /* binary address */
  16. struct addrinfo *ai_next; /* next structure in linked list */
  17. };
  18. /* following for getaddrinfo() */
  19. #define AI_PASSIVE 1 /* socket is intended for bind() + listen() */
  20. #define AI_CANONNAME 2 /* return canonical name */
  21. /* following for getnameinfo() */
  22. #define NI_MAXHOST 1025 /* max hostname returned */
  23. #define NI_MAXSERV 32 /* max service name returned */
  24. #define NI_NOFQDN 1 /* do not return FQDN */
  25. #define NI_NUMERICHOST 2 /* return numeric form of hostname */
  26. #define NI_NAMEREQD 4 /* return error if hostname not found */
  27. #define NI_NUMERICSERV 8 /* return numeric form of service name */
  28. #define NI_DGRAM 16 /* datagram service for getservbyname() */
  29. /* error returns */
  30. #define EAI_ADDRFAMILY 1 /* address family for host not supported */
  31. #define EAI_AGAIN 2 /* temporary failure in name resolution */
  32. #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
  33. #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
  34. #define EAI_FAMILY 5 /* ai_family not supported */
  35. #define EAI_MEMORY 6 /* memory allocation failure */
  36. #define EAI_NODATA 7 /* no address associated with host */
  37. #define EAI_NONAME 8 /* host nor service provided, or not known */
  38. #define EAI_SERVICE 9 /* service not supported for ai_socktype */
  39. #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
  40. #define EAI_SYSTEM 11 /* system error returned in errno */
  41. #endif /* __addrinfo_h */