00001 /* inet_misc.h - Supplemental structs, functions, * 00002 * and definitions required to build ircd on some * 00003 * exotic platforms. * 00004 * * 00005 * $Id: inet_misc.h 33 2005-10-02 20:50:00Z knight $ * 00006 * 00007 * Copyright (c) 1980, 1983, 1988, 1993 00008 * The Regents of the University of California. All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 3. All advertising materials mentioning features or use of this software 00019 * must display the following acknowledgement: 00020 * This product includes software developed by the University of 00021 * California, Berkeley and its contributors. 00022 * 4. Neither the name of the University nor the names of its contributors 00023 * may be used to endorse or promote products derived from this software 00024 * without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00027 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00030 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00032 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00034 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00035 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00036 * SUCH DAMAGE. 00037 * 00038 * - 00039 * Portions Copyright (c) 1993 by Digital Equipment Corporation. 00040 * 00041 * Permission to use, copy, modify, and distribute this software for any 00042 * purpose with or without fee is hereby granted, provided that the above 00043 * copyright notice and this permission notice appear in all copies, and that 00044 * the name of Digital Equipment Corporation not be used in advertising or 00045 * publicity pertaining to distribution of the document or software without 00046 * specific, written prior permission. 00047 * 00048 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 00049 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 00050 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 00051 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 00052 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 00053 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 00054 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00055 * SOFTWARE. 00056 * - 00057 * --Copyright-- 00058 */ 00059 00060 #ifndef INCLUDED_inet_misc_h 00061 #define INCLUDED_inet_misc_h 00062 00063 #include "stdinc.h" 00064 00065 #ifndef AI_PASSIVE 00066 #define AI_PASSIVE 0x00000001 /* get address to use bind() */ 00067 #endif /* AI_PASSIVE */ 00068 00069 #ifndef AI_NUMERICHOST 00070 #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ 00071 #endif /* AI_NUMERICHOST */ 00072 00073 #ifndef EAI_FAIL 00074 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ 00075 #endif /* EAI_FAIL */ 00076 00077 #ifndef EAI_FAMILY 00078 #define EAI_FAMILY 5 /* ai_family not supported */ 00079 #endif /* EAI_FAMILY */ 00080 00081 #ifndef EAI_MEMORY 00082 #define EAI_MEMORY 6 /* memory allocation failure */ 00083 #endif /* EAI_MEMORY */ 00084 00085 #ifndef EAI_NONAME 00086 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ 00087 #endif /* EAI_NONAME */ 00088 00089 #ifndef EAI_SYSTEM 00090 #define EAI_SYSTEM 11 /* system error returned in errno */ 00091 #endif /* EAI_SYSTEM */ 00092 00093 #ifndef NI_NUMERICHOST 00094 #define NI_NUMERICHOST 0x00000002 00095 #endif /* NI_NUMERICHOST */ 00096 00097 #ifndef NI_NAMEREQD 00098 #define NI_NAMEREQD 0x00000004 00099 #endif /* NI_NAMEREQD */ 00100 00101 #ifndef NI_NUMERICSERV 00102 #define NI_NUMERICSERV 0x00000008 00103 #endif /* NI_NUMERICSERV */ 00104 00105 #ifndef NI_DGRAM 00106 #define NI_DGRAM 0x00000010 00107 #endif /* NI_DGRAM */ 00108 00109 #ifndef INADDR_NONE 00110 #define INADDR_NONE ((unsigned int) 0xffffffff) 00111 #endif /* INADDR_NONE */ 00112 00113 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE 00114 #ifdef SOCKADDR_IN_HAS_LEN /* BSD style sockaddr_storage for BSD style 00115 sockaddr_in */ 00116 struct sockaddr_storage { 00117 unsigned char ss_len; 00118 sa_family_t ss_family; 00119 char __ss_pad1[((sizeof(int64_t)) - sizeof(unsigned char) - 00120 sizeof(sa_family_t) )]; 00121 int64_t __ss_align; 00122 char __ss_pad2[(128 - sizeof(unsigned char) - sizeof(sa_family_t) - 00123 ((sizeof(int64_t)) - sizeof(unsigned char) - 00124 sizeof(sa_family_t)) - (sizeof(int64_t)))]; 00125 }; 00126 #else /* Linux style for everything else (for now) */ 00127 struct sockaddr_storage 00128 { 00129 sa_family_t ss_family; 00130 u_int32_t __ss_align; 00131 char __ss_padding[(128 - (2 * sizeof (u_int32_t)))]; 00132 }; 00133 #endif /* SOCKADDR_IN_HAS_LEN */ 00134 #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ 00135 00136 #ifndef HAVE_STRUCT_ADDRINFO 00137 struct addrinfo { 00138 int ai_flags; 00139 int ai_family; 00140 int ai_socktype; 00141 int ai_protocol; 00142 size_t ai_addrlen; 00143 char *ai_canonname; 00144 struct sockaddr *ai_addr; 00145 struct addrinfo *ai_next; 00146 }; 00147 #endif /* HAVE_STRUCT_ADDRINFO */ 00148 00149 #ifdef NO_IN6ADDR_ANY 00150 extern const struct in6_addr in6addr_any; 00151 #endif 00152 00153 #ifdef NO_INET_NTOP 00154 const char * inet_ntop(int af, const void *src, char *dst, size_t size); 00155 #endif /* NO_INET_NTOP */ 00156 00157 #ifdef NO_INET_PTON 00158 int inet_pton(int af, const char *src, void *dst); 00159 #endif /* NO_INET_PTON */ 00160 00161 #ifdef NO_INET_ATON 00162 int inet_aton(const char *cp, struct in_addr * addr); 00163 #endif /* NO_INET_ATON */ 00164 00165 #endif /* INCLUDED_inet_misc_h */