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).
44 #pragma ident "%Z%%M% %I% %E% SMI"
50 #define _PATH_HEQUIV "/etc/hosts.equiv"
51 #define _PATH_HOSTS "/etc/hosts"
52 #define _PATH_NETWORKS "/etc/networks"
53 #define _PATH_PROTOCOLS "/etc/protocols"
54 #define _PATH_SERVICES "/etc/services"
57 char *h_name
; /* official name of host */
58 char **h_aliases
; /* alias list */
59 int h_addrtype
; /* host address type */
60 int h_length
; /* length of address */
61 char **h_addr_list
; /* list of addresses from name server */
62 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
66 * Assumption here is that a network number
67 * fits in 32 bits -- probably a poor one.
70 char *n_name
; /* official name of net */
71 char **n_aliases
; /* alias list */
72 int n_addrtype
; /* net address type */
73 unsigned long n_net
; /* network # */
77 char *s_name
; /* official service name */
78 char **s_aliases
; /* alias list */
79 int s_port
; /* port # */
80 char *s_proto
; /* protocol to use */
84 char *p_name
; /* official protocol name */
85 char **p_aliases
; /* alias list */
86 int p_proto
; /* protocol # */
90 struct hostent
*gethostbyname_r
91 (const char *, struct hostent
*, char *, int, int *h_errnop
);
92 struct hostent
*gethostbyaddr_r
93 (const char *, int, int, struct hostent
*, char *, int, int *h_errnop
);
94 struct hostent
*gethostent_r(struct hostent
*, char *, int, int *h_errnop
);
96 struct servent
*getservbyname_r
97 (const char *name
, const char *, struct servent
*, char *, int);
98 struct servent
*getservbyport_r
99 (int port
, const char *, struct servent
*, char *, int);
100 struct servent
*getservent_r(struct servent
*, char *, int);
102 struct netent
*getnetbyname_r
103 (const char *, struct netent
*, char *, int);
104 struct netent
*getnetbyaddr_r(long, int, struct netent
*, char *, int);
105 struct netent
*getnetent_r(struct netent
*, char *, int);
107 struct protoent
*getprotobyname_r
108 (const char *, struct protoent
*, char *, int);
109 struct protoent
*getprotobynumber_r
110 (int, struct protoent
*, char *, int);
111 struct protoent
*getprotoent_r(struct protoent
*, char *, int);
113 int getnetgrent_r(char **, char **, char **, char *, int);
114 int innetgr(const char *, const char *, const char *, const char *);
116 /* Old interfaces that return a pointer to a static area; MT-unsafe */
117 struct hostent
*gethostbyname(const char *);
118 struct hostent
*gethostbyaddr(const char *, int, int);
119 struct hostent
*gethostent(void);
120 struct netent
*getnetbyname(const char *);
121 struct netent
*getnetbyaddr(long, int);
122 struct netent
*getnetent(void);
123 struct servent
*getservbyname(const char *, const char *);
124 struct servent
*getservbyport(int, const char *);
125 struct servent
*getservent(void);
126 struct protoent
*getprotobyname(const char *);
127 struct protoent
*getprotobynumber(int);
128 struct protoent
*getprotoent(void);
129 int getnetgrent(char **, char **, char **);
132 int endhostent(void);
136 int endservent(void);
137 int setprotoent(int);
138 int endprotoent(void);
139 int setnetgrent(const char *);
140 int endnetgrent(void);
141 int rcmd(char **ahost
, unsigned short inport
,
142 const char *luser
, const char *ruser
, const char *cmd
, int *fd2p
);
143 int rexec(char **ahost
, unsigned short inport
,
144 const char *user
, const char *passwd
, const char *cmd
, int *fd2p
);
145 int rresvport(int *);
146 int ruserok(const char *rhost
, int suser
, const char *ruser
, const char *luser
);
148 struct hostent
*gethostbyname_r();
149 struct hostent
*gethostbyaddr_r();
150 struct hostent
*gethostent_r();
151 struct servent
*getservbyname_r();
152 struct servent
*getservbyport_r();
153 struct servent
*getservent_r();
154 struct netent
*getnetbyname_r();
155 struct netent
*getnetbyaddr_r();
156 struct netent
*getnetent_r();
157 struct protoent
*getprotobyname_r();
158 struct protoent
*getprotobynumber_r();
159 struct protoent
*getprotoent_r();
163 /* Old interfaces that return a pointer to a static area; MT-unsafe */
164 struct hostent
*gethostbyname();
165 struct hostent
*gethostbyaddr();
166 struct hostent
*gethostent();
167 struct netent
*getnetbyname();
168 struct netent
*getnetbyaddr();
169 struct netent
*getnetent();
170 struct servent
*getservbyname();
171 struct servent
*getservbyport();
172 struct servent
*getservent();
173 struct protoent
*getprotobyname();
174 struct protoent
*getprotobynumber();
175 struct protoent
*getprotoent();
195 * Error return codes from gethostbyname() and gethostbyaddr()
196 * (when using the resolver)
201 #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
202 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
203 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
204 #define NO_DATA 4 /* Valid name, no data record of requested type */
205 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
207 #define MAXHOSTNAMELEN 256
209 #define MAXALIASES 35
216 #endif /* _NETDB_H */