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