1 2 /* Copyright (C) 2005 by Dominick Meglio 3 * 4 * Permission to use, copy, modify, and distribute this 5 * software and its documentation for any purpose and without 6 * fee is hereby granted, provided that the above copyright 7 * notice appear in all copies and that both that copyright 8 * notice and this permission notice appear in supporting 9 * documentation, and that the name of M.I.T. not be used in 10 * advertising or publicity pertaining to distribution of the 11 * software without specific, written prior permission. 12 * M.I.T. makes no representations about the suitability of 13 * this software for any purpose. It is provided "as is" 14 * without express or implied warranty. 15 */ 16 17 #ifndef ARES_IPV6_H 18 #define ARES_IPV6_H 19 20 #ifndef HAVE_PF_INET6 21 #define PF_INET6 AF_INET6 22 #endif 23 24 #ifndef HAVE_STRUCT_SOCKADDR_IN6 25 struct sockaddr_in6 26 { 27 unsigned short sin6_family; 28 unsigned short sin6_port; 29 unsigned long sin6_flowinfo; 30 struct ares_in6_addr sin6_addr; 31 unsigned int sin6_scope_id; 32 }; 33 #endif 34 35 typedef union 36 { 37 struct sockaddr sa; 38 struct sockaddr_in sa4; 39 struct sockaddr_in6 sa6; 40 } ares_sockaddr; 41 42 #ifndef HAVE_STRUCT_ADDRINFO 43 struct addrinfo 44 { 45 int ai_flags; 46 int ai_family; 47 int ai_socktype; 48 int ai_protocol; 49 ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ 50 char *ai_canonname; 51 struct sockaddr *ai_addr; 52 struct addrinfo *ai_next; 53 }; 54 #endif 55 56 #ifndef NS_IN6ADDRSZ 57 #ifndef HAVE_STRUCT_IN6_ADDR 58 /* We cannot have it set to zero, so we pick a fixed value here */ 59 #define NS_IN6ADDRSZ 16 60 #else 61 #define NS_IN6ADDRSZ sizeof(struct in6_addr) 62 #endif 63 #endif 64 65 #ifndef NS_INADDRSZ 66 #define NS_INADDRSZ sizeof(struct in_addr) 67 #endif 68 69 #ifndef NS_INT16SZ 70 #define NS_INT16SZ 2 71 #endif 72 73 #ifndef IF_NAMESIZE 74 #ifdef IFNAMSIZ 75 #define IF_NAMESIZE IFNAMSIZ 76 #else 77 #define IF_NAMESIZE 256 78 #endif 79 #endif 80 81 /* Defined in inet_net_pton.c for no particular reason. */ 82 extern const struct ares_in6_addr ares_in6addr_any; /* :: */ 83 84 85 #endif /* ARES_IPV6_H */ 86