4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * Portions of this source code were derived from Berkeley 4.3 BSD
32 * under license from the Regents of the University of California.
36 * Structures returned by network data base library.
37 * All addresses are supplied in host order, and
38 * returned in network order (suitable for use in system calls).
48 #define _PATH_HEQUIV "/etc/hosts.equiv"
49 #define _PATH_HOSTS "/etc/hosts"
50 #define _PATH_NETWORKS "/etc/networks"
51 #define _PATH_PROTOCOLS "/etc/protocols"
52 #define _PATH_SERVICES "/etc/services"
55 char *h_name
; /* official name of host */
56 char **h_aliases
; /* alias list */
57 int h_addrtype
; /* host address type */
58 int h_length
; /* length of address */
59 char **h_addr_list
; /* list of addresses from name server */
60 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
64 * Assumption here is that a network number
65 * fits in 32 bits -- probably a poor one.
68 char *n_name
; /* official name of net */
69 char **n_aliases
; /* alias list */
70 int n_addrtype
; /* net address type */
71 unsigned long n_net
; /* network # */
75 char *s_name
; /* official service name */
76 char **s_aliases
; /* alias list */
77 int s_port
; /* port # */
78 char *s_proto
; /* protocol to use */
82 char *p_name
; /* official protocol name */
83 char **p_aliases
; /* alias list */
84 int p_proto
; /* protocol # */
88 struct hostent
*gethostbyname_r
89 (const char *, struct hostent
*, char *, int, int *h_errnop
);
90 struct hostent
*gethostbyaddr_r
91 (const char *, int, int, struct hostent
*, char *, int, int *h_errnop
);
92 struct hostent
*gethostent_r(struct hostent
*, char *, int, int *h_errnop
);
94 struct servent
*getservbyname_r
95 (const char *name
, const char *, struct servent
*, char *, int);
96 struct servent
*getservbyport_r
97 (int port
, const char *, struct servent
*, char *, int);
98 struct servent
*getservent_r(struct servent
*, char *, int);
100 struct netent
*getnetbyname_r
101 (const char *, struct netent
*, char *, int);
102 struct netent
*getnetbyaddr_r(long, int, struct netent
*, char *, int);
103 struct netent
*getnetent_r(struct netent
*, char *, int);
105 struct protoent
*getprotobyname_r
106 (const char *, struct protoent
*, char *, int);
107 struct protoent
*getprotobynumber_r
108 (int, struct protoent
*, char *, int);
109 struct protoent
*getprotoent_r(struct protoent
*, char *, int);
111 int getnetgrent_r(char **, char **, char **, char *, int);
112 int innetgr(const char *, const char *, const char *, const char *);
114 /* Old interfaces that return a pointer to a static area; MT-unsafe */
115 struct hostent
*gethostbyname(const char *);
116 struct hostent
*gethostbyaddr(const char *, int, int);
117 struct hostent
*gethostent(void);
118 struct netent
*getnetbyname(const char *);
119 struct netent
*getnetbyaddr(long, int);
120 struct netent
*getnetent(void);
121 struct servent
*getservbyname(const char *, const char *);
122 struct servent
*getservbyport(int, const char *);
123 struct servent
*getservent(void);
124 struct protoent
*getprotobyname(const char *);
125 struct protoent
*getprotobynumber(int);
126 struct protoent
*getprotoent(void);
127 int getnetgrent(char **, char **, char **);
130 int endhostent(void);
134 int endservent(void);
135 int setprotoent(int);
136 int endprotoent(void);
137 int setnetgrent(const char *);
138 int endnetgrent(void);
139 int rcmd(char **ahost
, unsigned short inport
,
140 const char *luser
, const char *ruser
, const char *cmd
, int *fd2p
);
141 int rexec(char **ahost
, unsigned short inport
,
142 const char *user
, const char *passwd
, const char *cmd
, int *fd2p
);
143 int rresvport(int *);
144 int ruserok(const char *rhost
, int suser
, const char *ruser
, const char *luser
);
146 struct hostent
*gethostbyname_r();
147 struct hostent
*gethostbyaddr_r();
148 struct hostent
*gethostent_r();
149 struct servent
*getservbyname_r();
150 struct servent
*getservbyport_r();
151 struct servent
*getservent_r();
152 struct netent
*getnetbyname_r();
153 struct netent
*getnetbyaddr_r();
154 struct netent
*getnetent_r();
155 struct protoent
*getprotobyname_r();
156 struct protoent
*getprotobynumber_r();
157 struct protoent
*getprotoent_r();
161 /* Old interfaces that return a pointer to a static area; MT-unsafe */
162 struct hostent
*gethostbyname();
163 struct hostent
*gethostbyaddr();
164 struct hostent
*gethostent();
165 struct netent
*getnetbyname();
166 struct netent
*getnetbyaddr();
167 struct netent
*getnetent();
168 struct servent
*getservbyname();
169 struct servent
*getservbyport();
170 struct servent
*getservent();
171 struct protoent
*getprotobyname();
172 struct protoent
*getprotobynumber();
173 struct protoent
*getprotoent();
193 * Error return codes from gethostbyname() and gethostbyaddr()
194 * (when using the resolver)
199 #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
200 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
201 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
202 #define NO_DATA 4 /* Valid name, no data record of requested type */
203 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
205 #define MAXHOSTNAMELEN 256
207 #define MAXALIASES 35
214 #endif /* _NETDB_H */