sl@0: /* NETDB.H sl@0: * sl@0: * Portions Copyright (c) 1993-1999 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: /*- sl@0: * Copyright (c) 1980, 1983, 1988, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * This product includes software developed by the University of sl@0: * California, Berkeley and its contributors. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * Portions Copyright (c) 1993 by Digital Equipment Corporation. sl@0: * sl@0: * Permission to use, copy, modify, and distribute this software for any sl@0: * purpose with or without fee is hereby granted, provided that the above sl@0: * copyright notice and this permission notice appear in all copies, and that sl@0: * the name of Digital Equipment Corporation not be used in advertising or sl@0: * publicity pertaining to distribution of the document or software without sl@0: * specific, written prior permission. sl@0: * sl@0: * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL sl@0: * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES sl@0: * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT sl@0: * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL sl@0: * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR sl@0: * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS sl@0: * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS sl@0: * SOFTWARE. sl@0: * - sl@0: * --Copyright-- sl@0: */ sl@0: sl@0: /** @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #ifndef _NETDB_H_ sl@0: #define _NETDB_H_ sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: #include <_ansi.h> sl@0: #include sl@0: sl@0: #define _PATH_HEQUIV "/etc/hosts.equiv" sl@0: #define _PATH_HOSTS "/etc/hosts" sl@0: #define _PATH_NETWORKS "/etc/networks" sl@0: #define _PATH_PROTOCOLS "/etc/protocols" sl@0: #define _PATH_SERVICES "/etc/services" sl@0: sl@0: #define h_errno errno sl@0: sl@0: /** sl@0: Structures returned by network data base library. All addresses are sl@0: supplied in host order, and returned in network order (suitable for sl@0: use in system calls). sl@0: */ sl@0: struct hostent { sl@0: char *h_name; /* official name of host */ sl@0: char **h_aliases; /* alias list */ sl@0: int h_addrtype; /* host address type */ sl@0: int h_length; /* length of address */ sl@0: char **h_addr_list; /* list of addresses from name server */ sl@0: #define h_addr h_addr_list[0] /* address, for backward compatibility */ sl@0: }; sl@0: sl@0: /** sl@0: Assumption here is that a network number sl@0: fits in an unsigned long -- probably a poor one. sl@0: */ sl@0: struct netent { sl@0: char *n_name; /* official name of net */ sl@0: char **n_aliases; /* alias list */ sl@0: int n_addrtype; /* net address type */ sl@0: unsigned long n_net; /* network # */ sl@0: }; sl@0: sl@0: struct servent { sl@0: char *s_name; /* official service name */ sl@0: char **s_aliases; /* alias list */ sl@0: int s_port; /* port # */ sl@0: char *s_proto; /* protocol to use */ sl@0: }; sl@0: sl@0: struct protoent { sl@0: char *p_name; /* official protocol name */ sl@0: char **p_aliases; /* alias list */ sl@0: int p_proto; /* protocol # */ sl@0: }; sl@0: sl@0: /** sl@0: Error return codes from gethostbyname() and gethostbyaddr() sl@0: */ sl@0: #define NETDB_INTERNAL -1 /* see errno */ sl@0: #define NETDB_SUCCESS 0 /* no problem */ sl@0: #define HOST_NOT_FOUND ENOENT /* Authoritative Answer Host not found */ sl@0: #define TRY_AGAIN ETIMEDOUT /* Non-Authoritative Host not found, or SERVERFAIL */ sl@0: #define NO_RECOVERY ECOMM /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ sl@0: #define NO_DATA 4 /* Valid name, no data record of requested type */ sl@0: #define NO_ADDRESS NO_DATA /* no address, look for MX record */ sl@0: sl@0: IMPORT_C struct hostent *gethostbyaddr (const char *, int, int); sl@0: IMPORT_C struct hostent *gethostbyname (const char *); sl@0: struct servent *getservbyname (const char *, const char *); sl@0: struct servent *getservbyport (int, const char *); sl@0: struct netent *getnetbyaddr (unsigned long, int); sl@0: struct netent *getnetbyname (const char *); sl@0: struct protoent *getprotobyname (const char *); sl@0: struct protoent *getprotobynumber (int); sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: sl@0: #endif /* !_NETDB_H_ */