2N/A * Copyright (C) 2001,2002,2003,2004 by the Massachusetts Institute of Technology, 2N/A * Cambridge, MA, USA. All Rights Reserved. 2N/A * This software is being provided to you, the LICENSEE, by the 2N/A * Massachusetts Institute of Technology (M.I.T.) under the following 2N/A * license. By obtaining, using and/or copying this software, you agree 2N/A * that you have read, understood, and will comply with these terms and 2N/A * Export of this software from the United States of America may 2N/A * require a specific license from the United States Government. 2N/A * It is the responsibility of any person or organization contemplating 2N/A * export to obtain such a license before exporting. 2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute 2N/A * this software and its documentation for any purpose and without fee or 2N/A * royalty is hereby granted, provided that you agree to comply with the 2N/A * following copyright notice and statements, including the disclaimer, and 2N/A * that the same appear on ALL copies of the software and documentation, 2N/A * including modifications that you make for internal use or for 2N/A * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS 2N/A * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not 2N/A * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF 2N/A * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF 2N/A * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY 2N/A * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 2N/A * The name of the Massachusetts Institute of Technology or M.I.T. may NOT 2N/A * be used in advertising or publicity pertaining to distribution of the 2N/A * software. Title to copyright in this software and any associated 2N/A * documentation shall at all times remain with M.I.T., and USER agrees to 2N/A * Furthermore if you modify this software you must label 2N/A * your software as modified software and not distribute it in such a 2N/A * fashion that it might be confused with the original M.I.T. software. 2N/A/* Approach overview: 2N/A If a system version is available but buggy, save handles to it (via 2N/A inline functions in a support library), redefine the names to refer 2N/A to library functions, and in those functions, call the system 2N/A versions and fix up the returned data. Use the native data 2N/A structures and flag values. 2N/A If no system version exists, use gethostby* and fake it. Define 2N/A the data structures and flag values locally. 2N/A On Mac OS X, getaddrinfo results aren't cached (though 2N/A gethostbyname results are), so we need to build a cache here. Now 2N/A things are getting really messy. Because the cache is in use, we 2N/A use getservbyname, and throw away thread safety. (Not that the 2N/A cache is thread safe, but when we get locking support, that'll be 2N/A dealt with.) This code needs tearing down and rebuilding, soon. 2N/A Note that recent Windows developers' code has an interesting hack: 2N/A When you include the right header files, with the right set of 2N/A macros indicating system versions, you'll get an inline function 2N/A that looks for getaddrinfo (or whatever) in the system library, and 2N/A calls it if it's there. If it's not there, it fakes it with 2N/A We're taking a simpler approach: A system provides these routines or 2N/A Someday, we may want to take into account different versions (say, 2N/A different revs of GNU libc) where some are broken in one way, and 2N/A some work or are broken in another way. Cross that bridge when we 2N/A + For AIX 4.3.3, using the RFC 2133 definition: Implement 2N/A AI_NUMERICHOST. It's not defined in the header file. 2N/A For certain (old?) versions of GNU libc, AI_NUMERICHOST is 2N/A defined but not implemented. 2N/A + Use gethostbyname2, inet_aton and other IPv6 or thread-safe 2N/A functions if available. But, see 2N/A gethostbyname2 problem on Linux. And besides, if a platform is 2N/A supporting IPv6 at all, they really should be doing getaddrinfo 2N/A + inet_ntop, inet_pton 2N/A library can have a single copy instead of multiple. 2N/A + Upgrade host requirements to include working implementations of 2N/A these functions, and throw all this away. Pleeease? :-) */ 2N/A/* RFC 2553 says these are part of the interface for getipnodebyname, 2N/A not for getaddrinfo. RFC 3493 says they're part of the interface 2N/A for getaddrinfo, and getipnodeby* are deprecated. Our fake 2N/A getaddrinfo implementation here does IPv4 only anyways. */ 2N/A#
endif /* ! HAVE_GETADDRINFO */ 2N/A/* Fudge things on older gai implementations. */ 2N/A/* AIX 4.3.3 is based on RFC 2133; no AI_NUMERICHOST. */ 2N/A/* Partial RFC 2553 implementations may not have AI_ADDRCONFIG and 2N/A friends, which RFC 3493 says are now part of the getaddrinfo 2N/A interface, and we'll want to use. */ 2N/A/* If compiling with IPv6 support and C library does not define in6addr_any */ 2N/A/* Call out to stuff defined in libkrb5support. */ 2N/A#
endif /* FAI_DEFINED */