netdb.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
00003  * 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. All advertising materials mentioning features or use of this software
00014  *    must display the following acknowledgement:
00015  *      This product includes software developed by the University of
00016  *      California, Berkeley and its contributors.
00017  * 4. Neither the name of the University nor the names of its contributors
00018  *    may be used to endorse or promote products derived from this software
00019  *    without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  *      @(#)netdb.h     5.15 (Berkeley) 4/3/91
00034  */
00035 
00036 #ifndef _NETDB_H_
00037 #define _NETDB_H_
00038 
00039 #define _PATH_HEQUIV    "/etc/hosts.equiv"
00040 #define _PATH_HOSTS     "/etc/hosts"
00041 #define _PATH_NETWORKS  "/etc/networks"
00042 #define _PATH_PROTOCOLS "/etc/protocols"
00043 #define _PATH_SERVICES  "/etc/services"
00044 #define _PATH_SERVACCES "/etc/serv.access"
00045 
00046 /*
00047  * Structures returned by network data base library.  All addresses are
00048  * supplied in host order, and returned in network order (suitable for
00049  * use in system calls).
00050  */
00051 struct  hostent {
00052         char    *h_name;        /* official name of host */
00053         char    **h_aliases;    /* alias list */
00054         int     h_addrtype;     /* host address type */
00055         int     h_length;       /* length of address */
00056         char    **h_addr_list;  /* list of addresses from name server */
00057 #define h_addr  h_addr_list[0]  /* address, for backward compatiblity */
00058 };
00059 
00060 /*
00061  * Assumption here is that a network number
00062  * fits in 32 bits -- probably a poor one.
00063  */
00064 struct  netent {
00065         char            *n_name;        /* official name of net */
00066         char            **n_aliases;    /* alias list */
00067         int             n_addrtype;     /* net address type */
00068         unsigned long   n_net;          /* network # */
00069 };
00070 
00071 struct  servent {
00072         char    *s_name;        /* official service name */
00073         char    **s_aliases;    /* alias list */
00074         int     s_port;         /* port # */
00075         char    *s_proto;       /* protocol to use */
00076 };
00077 
00078 struct  protoent {
00079         char    *p_name;        /* official protocol name */
00080         char    **p_aliases;    /* alias list */
00081         int     p_proto;        /* protocol # */
00082 };
00083 
00084 /*
00085  * Error return codes from gethostbyname() and gethostbyaddr()
00086  * (left in extern int h_errno).
00087  */
00088 extern int h_errno;
00089 
00090 #define HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
00091 #define TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
00092 #define NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
00093 #define NO_DATA         4 /* Valid name, no data record of requested type */
00094 #define NO_ADDRESS      NO_DATA         /* no address, look for MX record */
00095 
00096 #ifndef _ANSI_H
00097 #include <ansi.h>
00098 #endif
00099 
00100 void            endhostent _ARGS((void));
00101 void            endnetent _ARGS((void));
00102 void            endprotoent _ARGS((void));
00103 void            endservent _ARGS((void));
00104 struct hostent  *gethostbyaddr _ARGS((const char *, int, int));
00105 struct hostent  *gethostbyname _ARGS((const char *));
00106 struct hostent  *gethostent _ARGS((void));
00107 struct netent   *getnetbyaddr _ARGS((long, int)); /* u_long? */
00108 struct netent   *getnetbyname _ARGS((const char *));
00109 struct netent   *getnetent _ARGS((void));
00110 struct protoent *getprotobyname _ARGS((const char *));
00111 struct protoent *getprotobynumber _ARGS((int));
00112 struct protoent *getprotoent _ARGS((void));
00113 struct servent  *getservbyname _ARGS((const char *, const char *));
00114 struct servent  *getservbyport _ARGS((int, const char *));
00115 struct servent  *getservent _ARGS((void));
00116 void            herror _ARGS((const char *));
00117 void            sethostent _ARGS((int));
00118 /* void         sethostfile _ARGS((const char *)); */
00119 void            setnetent _ARGS((int));
00120 void            setprotoent _ARGS((int));
00121 void            setservent _ARGS((int));
00122 #ifdef _MINIX
00123 int             servxcheck _ARGS((unsigned long _peer, const char *_service,
00124                         void (*_logf) _ARGS((int _pass, const char *_name))));
00125 char            *servxfile _ARGS((const char *_file));
00126 #endif
00127 
00128 #endif /* !_NETDB_H_ */

Generated on Fri Apr 14 22:57:21 2006 for minix by  doxygen 1.4.6