Annotation of XNU/bsd/include/netdb.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:  * ++Copyright++ 1980, 1983, 1988, 1993
                     24:  * -
                     25:  * Copyright (c) 1980, 1983, 1988, 1993
                     26:  *    The Regents of the University of California.  All rights reserved.
                     27:  * 
                     28:  * Redistribution and use in source and binary forms, with or without
                     29:  * modification, are permitted provided that the following conditions
                     30:  * are met:
                     31:  * 1. Redistributions of source code must retain the above copyright
                     32:  *    notice, this list of conditions and the following disclaimer.
                     33:  * 2. Redistributions in binary form must reproduce the above copyright
                     34:  *    notice, this list of conditions and the following disclaimer in the
                     35:  *    documentation and/or other materials provided with the distribution.
                     36:  * 3. All advertising materials mentioning features or use of this software
                     37:  *    must display the following acknowledgement:
                     38:  *     This product includes software developed by the University of
                     39:  *     California, Berkeley and its contributors.
                     40:  * 4. Neither the name of the University nor the names of its contributors
                     41:  *    may be used to endorse or promote products derived from this software
                     42:  *    without specific prior written permission.
                     43:  * 
                     44:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     45:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     46:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     47:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     48:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     49:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     50:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     51:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     52:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     53:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     54:  * SUCH DAMAGE.
                     55:  * -
                     56:  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
                     57:  * 
                     58:  * Permission to use, copy, modify, and distribute this software for any
                     59:  * purpose with or without fee is hereby granted, provided that the above
                     60:  * copyright notice and this permission notice appear in all copies, and that
                     61:  * the name of Digital Equipment Corporation not be used in advertising or
                     62:  * publicity pertaining to distribution of the document or software without
                     63:  * specific, written prior permission.
                     64:  * 
                     65:  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
                     66:  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
                     67:  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
                     68:  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
                     69:  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
                     70:  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
                     71:  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     72:  * SOFTWARE.
                     73:  * -
                     74:  * --Copyright--
                     75:  */
                     76: 
                     77: /*
                     78:  *      @(#)netdb.h    8.1 (Berkeley) 6/2/93
                     79:  */
                     80: 
                     81: #ifndef _NETDB_H_
                     82: #define _NETDB_H_
                     83: 
                     84: #include <sys/param.h>
                     85: #include <sys/cdefs.h>
                     86: 
                     87: #define        _PATH_HEQUIV    "/etc/hosts.equiv"
                     88: #define        _PATH_HOSTS     "/etc/hosts"
                     89: #define        _PATH_NETWORKS  "/etc/networks"
                     90: #define        _PATH_PROTOCOLS "/etc/protocols"
                     91: #define        _PATH_SERVICES  "/etc/services"
                     92: 
                     93: extern int h_errno;
                     94: 
                     95: /*
                     96:  * Structures returned by network data base library.  All addresses are
                     97:  * supplied in host order, and returned in network order (suitable for
                     98:  * use in system calls).
                     99:  */
                    100: struct hostent {
                    101:        char    *h_name;        /* official name of host */
                    102:        char    **h_aliases;    /* alias list */
                    103:        int     h_addrtype;     /* host address type */
                    104:        int     h_length;       /* length of address */
                    105:        char    **h_addr_list;  /* list of addresses from name server */
                    106: #define        h_addr  h_addr_list[0]  /* address, for backward compatiblity */
                    107: };
                    108: 
                    109: /*
                    110:  * Assumption here is that a network number
                    111:  * fits in an unsigned long -- probably a poor one.
                    112:  */
                    113: struct netent {
                    114:        char            *n_name;        /* official name of net */
                    115:        char            **n_aliases;    /* alias list */
                    116:        int             n_addrtype;     /* net address type */
                    117:        unsigned long   n_net;          /* network # */
                    118: };
                    119: 
                    120: struct servent {
                    121:        char    *s_name;        /* official service name */
                    122:        char    **s_aliases;    /* alias list */
                    123:        int     s_port;         /* port # */
                    124:        char    *s_proto;       /* protocol to use */
                    125: };
                    126: 
                    127: struct protoent {
                    128:        char    *p_name;        /* official protocol name */
                    129:        char    **p_aliases;    /* alias list */
                    130:        int     p_proto;        /* protocol # */
                    131: };
                    132: 
                    133: struct rpcent {
                    134:         char    *r_name;        /* name of server for this rpc program */
                    135:         char    **r_aliases;    /* alias list */
                    136:         int     r_number;       /* rpc program number */
                    137: };
                    138: 
                    139: /*
                    140:  * Error return codes from gethostbyname() and gethostbyaddr()
                    141:  * (left in extern int h_errno).
                    142:  */
                    143: 
                    144: #define        NETDB_INTERNAL  -1      /* see errno */
                    145: #define        NETDB_SUCCESS   0       /* no problem */
                    146: #define        HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
                    147: #define        TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
                    148: #define        NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
                    149: #define        NO_DATA         4 /* Valid name, no data record of requested type */
                    150: #define        NO_ADDRESS      NO_DATA         /* no address, look for MX record */
                    151: 
                    152: __BEGIN_DECLS
                    153: void           endhostent __P((void));
                    154: void           endnetent __P((void));
                    155: void           endprotoent __P((void));
                    156: void           endservent __P((void));
                    157: struct hostent *gethostbyaddr __P((const char *, int, int));
                    158: struct hostent *gethostbyname __P((const char *));
                    159: struct hostent *gethostent __P((void));
                    160: struct netent  *getnetbyaddr __P((long, int)); /* u_long? */
                    161: #ifdef sun
                    162: struct netent  *getnetbyname __P((char *));
                    163: #else
                    164: struct netent  *getnetbyname __P((const char *));
                    165: #endif
                    166: struct netent  *getnetent __P((void));
                    167: struct protoent        *getprotobyname __P((const char *));
                    168: struct protoent        *getprotobynumber __P((int));
                    169: struct protoent        *getprotoent __P((void));
                    170: struct servent *getservbyname __P((const char *, const char *));
                    171: struct servent *getservbyport __P((int, const char *));
                    172: struct servent *getservent __P((void));
                    173: struct rpcent  *getrpcbyname __P((const char *name));
                    174: struct rpcent  *getrpcbynumber __P((long number));
                    175: struct rpcent  *getrpcent __P((void));
                    176: void           setrpcent __P((int stayopen));
                    177: void           endrpcent __P((void));
                    178: 
                    179: void           herror __P((const char *));
                    180: char           *hstrerror __P((int));
                    181: void           sethostent __P((int));
                    182: /* void                sethostfile __P((const char *)); */
                    183: void           setnetent __P((int));
                    184: void           setprotoent __P((int));
                    185: void           setservent __P((int));
                    186: __END_DECLS
                    187: 
                    188: #endif /* !_NETDB_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.