Back to index

lightning-sunbird  0.9+nobinonly
netdb.h
Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1980, 1983, 1988, 1993
00003  *     The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * [3 Deleted as of 22Jul99, see
00014  *     ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
00015  *        for details]
00016  * 4. Neither the name of the University nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  *      @(#)netdb.h  8.1 (Berkeley) 6/2/93
00033  *     $Id: netdb.h,v 1.1 2001/03/11 22:39:01 sgehani%netscape.com Exp $
00034  * -
00035  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
00036  *
00037  * Permission to use, copy, modify, and distribute this software for any
00038  * purpose with or without fee is hereby granted, provided that the above
00039  * copyright notice and this permission notice appear in all copies, and that
00040  * the name of Digital Equipment Corporation not be used in advertising or
00041  * publicity pertaining to distribution of the document or software without
00042  * specific, written prior permission.
00043  *
00044  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
00045  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
00046  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
00047  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
00048  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00049  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00050  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00051  * SOFTWARE.
00052  * -
00053  * --Copyright--
00054  */
00055 
00056 /* Adapted for GUSI by Matthias Neeracher <neeri@iis.ee.ethz.ch> */
00057 
00058 #ifndef _NETDB_H_
00059 #define _NETDB_H_
00060 
00061 #define       _PATH_HEQUIV  "/etc/hosts.equiv"
00062 #define       _PATH_HOSTS   "/etc/hosts"
00063 #define       _PATH_NETWORKS       "/etc/networks"
00064 #define       _PATH_PROTOCOLS      "/etc/protocols"
00065 #define       _PATH_SERVICES       "/etc/services"
00066 
00067 /*
00068  * Structures returned by network data base library.  All addresses are
00069  * supplied in host order, and returned in network order (suitable for
00070  * use in system calls).
00071  */
00072 struct hostent {
00073        char   *h_name;      /* official name of host */
00074        char   **h_aliases;  /* alias list */
00075        int    h_addrtype;   /* host address type */
00076        int    h_length;     /* length of address */
00077        char   **h_addr_list;       /* list of addresses from name server */
00078 #define       h_addr h_addr_list[0]       /* address, for backward compatiblity */
00079 };
00080 
00081 struct servent {
00082        char   *s_name;      /* official service name */
00083        char   **s_aliases;  /* alias list */
00084        int    s_port;              /* port # */
00085        char   *s_proto;     /* protocol to use */
00086 };
00087 
00088 struct protoent {
00089        char   *p_name;      /* official protocol name */
00090        char   **p_aliases;  /* alias list */
00091        int    p_proto;      /* protocol # */
00092 };
00093 
00094 /*
00095  * Error return codes from gethostbyname() and gethostbyaddr()
00096  * (left in h_errno).
00097  */
00098 
00099 extern int h_errno;
00100 
00101 #define       HOST_NOT_FOUND       1 /* Authoritative Answer Host not found */
00102 #define       TRY_AGAIN     2 /* Non-Authoritive Host not found, or SERVERFAIL */
00103 #define       NO_RECOVERY   3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
00104 #define       NO_DATA              4 /* Valid name, no data record of requested type */
00105 #define       NO_ADDRESS    NO_DATA              /* no address, look for MX record */
00106 
00107 #include <sys/cdefs.h>
00108 
00109 __BEGIN_DECLS
00110 void          endhostent __P((void));
00111 void          endprotoent __P((void));
00112 void          endservent __P((void));
00113 struct hostent       *gethostbyaddr __P((const void *, size_t, int));
00114 struct hostent       *gethostbyname __P((const char *));
00115 struct hostent       *gethostent __P((void));
00116 struct protoent      *getprotobyname __P((const char *));
00117 struct protoent      *getprotobynumber __P((int));
00118 struct protoent      *getprotoent __P((void));
00119 struct servent       *getservbyname __P((const char *, const char *));
00120 struct servent       *getservbyport __P((int, const char *));
00121 struct servent       *getservent __P((void));
00122 void          herror __P((const char *));
00123 char          *hstrerror __P((int));
00124 void          setprotoent __P((int));
00125 void          setservent __P((int));
00126 __END_DECLS
00127 
00128 #endif /* !_NETDB_H_ */