1/*- 2 * Copyright (c) 1980, 1983, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)netdb.h 8.1 (Berkeley) 6/2/93 34 * netdb.h,v 1.4 1995/08/14 04:05:04 hjl Exp 35 * - 36 * Portions Copyright (c) 1993 by Digital Equipment Corporation. 37 * 38 * Permission to use, copy, modify and distribute this software for any 39 * purpose with or without fee is hereby granted, provided that the above 40 * copyright notice and this permission notice appear in all copies, and that 41 * the name of Digital Equipment Corporation not be used in advertising or 42 * publicity pertaining to distribution of the document or software without 43 * specific, written prior permission. 44 * 45 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 46 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 47 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 48 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 49 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 50 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 51 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 52 * SOFTWARE. 53 * - 54 * --Copyright-- 55 */ 56 57#ifndef _NETDB_H_ 58#define _NETDB_H_ 59 60/* MingW64 defines _POSIX_THREAD_SAFE_FUNCTIONS. 61 */ 62#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) && !defined(__MINGW64_VERSION_MAJOR) 63#include <stdio.h> 64#include <netinet/in.h> 65#endif 66 67#include <winsock2.h> 68#include <net/paths.h> 69 70#define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv" 71#define _PATH_HOSTS __PATH_ETC_INET"/hosts" 72#define _PATH_NETWORKS __PATH_ETC_INET"/networks" 73#define _PATH_PROTOCOLS __PATH_ETC_INET"/protocols" 74#define _PATH_SERVICES __PATH_ETC_INET"/services" 75#define _PATH_RESCONF __PATH_ETC_INET"/resolv.conf" 76#define _PATH_RPC __PATH_ETC_INET"/rpc" 77 78struct rpcent { 79 char *r_name; /* name of server for this rpc program */ 80 char **r_aliases; /* alias list */ 81 int r_number; /* rpc program number */ 82}; 83 84#ifndef WIN32 85#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) 86 87#define __NETDB_MAXALIASES 35 88#define __NETDB_MAXADDRS 35 89 90/* 91 * Error return codes from gethostbyname() and gethostbyaddr() 92 * (left in extern int h_errno). 93 */ 94#define h_errno (*__h_errno_location ()) 95#else 96extern int h_errno; 97#endif 98#endif 99 100#define NETDB_INTERNAL -1 /* see errno */ 101#define NETDB_SUCCESS 0 /* no problem */ 102 103//#include <features.h> 104 105void endhostent (void); 106void endnetent (void); 107void endprotoent (void); 108void endservent (void); 109void endrpcent (void); 110struct hostent *gethostent (void); 111struct netent *getnetbyaddr (long, int); /* u_long? */ 112struct netent *getnetbyname (const char *); 113struct netent *getnetent (void); 114struct protoent *getprotoent (void); 115struct servent *getservent (void); 116struct rpcent *getrpcent (void); 117struct rpcent *getrpcbyname (const char *); 118struct rpcent *getrpcbynumber (int); 119void herror (const char *); 120void sethostent (int); 121/* void sethostfile (const char *); */ 122void setnetent (int); 123void setprotoent (int); 124void setservent (int); 125void setrpcent (int); 126 127#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) 128struct hostent *gethostbyaddr_r (const char *__addr, 129 int __length, int __type, 130 struct hostent *__result, 131 char *__buffer, int __buflen, int *__h_errnop); 132struct hostent *gethostbyname_r (const char * __name, 133 struct hostent *__result, char *__buffer, 134 int __buflen, int *__h_errnop); 135struct hostent *gethostent_r (struct hostent *__result, 136 char *__buffer, int __buflen, int *__h_errnop); 137struct netent *getnetbyaddr_r (long __net, int __type, 138 struct netent *__result, char *__buffer, 139 int __buflen); 140struct netent *getnetbyname_r (const char * __name, 141 struct netent *__result, char *__buffer, 142 int __buflen); 143struct netent *getnetent_r (struct netent *__result, 144 char *__buffer, int __buflen); 145struct protoent *getprotobyname_r (const char * __name, 146 struct protoent *__result, char *__buffer, 147 int __buflen); 148struct protoent *getprotobynumber_r (int __proto, 149 struct protoent *__result, char *__buffer, 150 int __buflen); 151struct protoent *getprotoent_r (struct protoent *__result, 152 char *__buffer, int __buflen); 153struct servent *getservbyname_r (const char * __name, 154 const char *__proto, struct servent *__result, 155 char *__buffer, int __buflen); 156struct servent *getservbyport_r (int __port, 157 const char *__proto, struct servent *__result, 158 char *__buffer, int __buflen); 159struct servent *getservent_r (struct servent *__result, 160 char *__buffer, int __buflen); 161 162int *__h_errno_location (void); 163 164#endif 165 166#endif /* !_NETDB_H_ */ 167