1 /* 2 * aprsc 3 * 4 * (c) Matti Aarnio, OH2MQK, <oh2mqk@sral.fi> 5 * 6 * This program is licensed under the BSD license, which can be found 7 * in the file LICENSE. 8 * 9 */ 10 /* 11 IPv6 API additions for the ZMailer at those machines 12 without proper libraries and includes. 13 By Matti Aarnio <mea@nic.funet.fi> 1997,2004 14 */ 15 16 #ifndef __ 17 # ifdef __STDC__ 18 # define __(x) x 19 # else 20 # define __(x) () 21 # endif 22 #endif 23 24 #ifndef HAVE_GETADDRINFO 25 #ifndef AI_PASSIVE 26 27 struct addrinfo { 28 int ai_flags; /* AI_PASSIVE | AI_CANONNAME */ 29 int ai_family; /* PF_xxx */ 30 int ai_socktype; /* SOCK_xxx */ 31 int ai_protocol; /* 0, or IPPROTO_xxx for IPv4 and IPv6 */ 32 size_t ai_addrlen; /* Length of ai_addr */ 33 char *ai_canonname; /* canonical name for hostname */ 34 struct sockaddr *ai_addr; /* binary address */ 35 struct addrinfo *ai_next; /* next structure in linked list */ 36 }; 37 38 39 extern int getaddrinfo __(( const char *node, const char *service, 40 const struct addrinfo *hints, 41 struct addrinfo **res )); 42 extern void freeaddrinfo __(( struct addrinfo *res )); 43 extern const char *gai_strerror __((int errcode)); 44 45 #define AI_PASSIVE 1 /* Socket address is intended for `bind'. */ 46 #endif 47 #ifndef AI_CANONNAME 48 #define AI_CANONNAME 2 /* Request for canonical name. */ 49 #endif 50 #ifndef AI_NUMERICHOST 51 #define AI_NUMERICHOST 4 /* Don't use name resolution. */ 52 #endif 53 54 #ifndef EAI_ADDRFAMILY 55 /* Error values for `getaddrinfo' function. */ 56 #define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ 57 #define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ 58 #define EAI_AGAIN -3 /* Temporary failure in name resolution. */ 59 #define EAI_FAIL -4 /* Non-recoverable failure in name res. */ 60 #define EAI_NODATA -5 /* No address associated with NAME. */ 61 #define EAI_FAMILY -6 /* `ai_family' not supported. */ 62 #define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ 63 #define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ 64 #define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ 65 #define EAI_MEMORY -10 /* Memory allocation failure. */ 66 #define EAI_SYSTEM -11 /* System error returned in `errno'. */ 67 #endif 68 69 #ifndef NI_MAXHOST 70 #define NI_MAXHOST 1025 71 #define NI_MAXSERV 32 72 73 #define NI_NUMERICHOST 0x01 74 #define NI_NUMERICSERV 0x02 75 #define NI_NAMEREQD 0x04 76 #define NI_NOFQDN 0x08 77 #define NI_DGRAM 0x10 78 #endif 79 #endif /* ndef HAVE_GETADDRINFO */ 80