2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * Portions of this source code were derived from Berkeley 4.3 BSD
2N/A * under license from the Regents of the University of California.
2N/A */
2N/A
2N/A/*
2N/A * Structures returned by network data base library.
2N/A * All addresses are supplied in host order, and
2N/A * returned in network order (suitable for use in system calls).
2N/A */
2N/A
2N/A#ifndef _NETDB_H
2N/A#define _NETDB_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define _PATH_HEQUIV "/etc/hosts.equiv"
2N/A#define _PATH_HOSTS "/etc/hosts"
2N/A#define _PATH_NETWORKS "/etc/networks"
2N/A#define _PATH_PROTOCOLS "/etc/protocols"
2N/A#define _PATH_SERVICES "/etc/services"
2N/A
2N/Astruct hostent {
2N/A char *h_name; /* official name of host */
2N/A char **h_aliases; /* alias list */
2N/A int h_addrtype; /* host address type */
2N/A int h_length; /* length of address */
2N/A char **h_addr_list; /* list of addresses from name server */
2N/A#define h_addr h_addr_list[0] /* address, for backward compatiblity */
2N/A};
2N/A
2N/A/*
2N/A * Assumption here is that a network number
2N/A * fits in 32 bits -- probably a poor one.
2N/A */
2N/Astruct netent {
2N/A char *n_name; /* official name of net */
2N/A char **n_aliases; /* alias list */
2N/A int n_addrtype; /* net address type */
2N/A unsigned long n_net; /* network # */
2N/A};
2N/A
2N/Astruct servent {
2N/A char *s_name; /* official service name */
2N/A char **s_aliases; /* alias list */
2N/A int s_port; /* port # */
2N/A char *s_proto; /* protocol to use */
2N/A};
2N/A
2N/Astruct protoent {
2N/A char *p_name; /* official protocol name */
2N/A char **p_aliases; /* alias list */
2N/A int p_proto; /* protocol # */
2N/A};
2N/A
2N/A#ifdef __STDC__
2N/Astruct hostent *gethostbyname_r
2N/A (const char *, struct hostent *, char *, int, int *h_errnop);
2N/Astruct hostent *gethostbyaddr_r
2N/A (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
2N/Astruct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop);
2N/A
2N/Astruct servent *getservbyname_r
2N/A (const char *name, const char *, struct servent *, char *, int);
2N/Astruct servent *getservbyport_r
2N/A (int port, const char *, struct servent *, char *, int);
2N/Astruct servent *getservent_r(struct servent *, char *, int);
2N/A
2N/Astruct netent *getnetbyname_r
2N/A (const char *, struct netent *, char *, int);
2N/Astruct netent *getnetbyaddr_r(long, int, struct netent *, char *, int);
2N/Astruct netent *getnetent_r(struct netent *, char *, int);
2N/A
2N/Astruct protoent *getprotobyname_r
2N/A (const char *, struct protoent *, char *, int);
2N/Astruct protoent *getprotobynumber_r
2N/A (int, struct protoent *, char *, int);
2N/Astruct protoent *getprotoent_r(struct protoent *, char *, int);
2N/A
2N/Aint getnetgrent_r(char **, char **, char **, char *, int);
2N/Aint innetgr(const char *, const char *, const char *, const char *);
2N/A
2N/A/* Old interfaces that return a pointer to a static area; MT-unsafe */
2N/Astruct hostent *gethostbyname(const char *);
2N/Astruct hostent *gethostbyaddr(const char *, int, int);
2N/Astruct hostent *gethostent(void);
2N/Astruct netent *getnetbyname(const char *);
2N/Astruct netent *getnetbyaddr(long, int);
2N/Astruct netent *getnetent(void);
2N/Astruct servent *getservbyname(const char *, const char *);
2N/Astruct servent *getservbyport(int, const char *);
2N/Astruct servent *getservent(void);
2N/Astruct protoent *getprotobyname(const char *);
2N/Astruct protoent *getprotobynumber(int);
2N/Astruct protoent *getprotoent(void);
2N/Aint getnetgrent(char **, char **, char **);
2N/A
2N/Aint sethostent(int);
2N/Aint endhostent(void);
2N/Aint setnetent(int);
2N/Aint endnetent(void);
2N/Aint setservent(int);
2N/Aint endservent(void);
2N/Aint setprotoent(int);
2N/Aint endprotoent(void);
2N/Aint setnetgrent(const char *);
2N/Aint endnetgrent(void);
2N/Aint rcmd(char **ahost, unsigned short inport,
2N/A const char *luser, const char *ruser, const char *cmd, int *fd2p);
2N/Aint rexec(char **ahost, unsigned short inport,
2N/A const char *user, const char *passwd, const char *cmd, int *fd2p);
2N/Aint rresvport(int *);
2N/Aint ruserok(const char *rhost, int suser, const char *ruser, const char *luser);
2N/A#else
2N/Astruct hostent *gethostbyname_r();
2N/Astruct hostent *gethostbyaddr_r();
2N/Astruct hostent *gethostent_r();
2N/Astruct servent *getservbyname_r();
2N/Astruct servent *getservbyport_r();
2N/Astruct servent *getservent_r();
2N/Astruct netent *getnetbyname_r();
2N/Astruct netent *getnetbyaddr_r();
2N/Astruct netent *getnetent_r();
2N/Astruct protoent *getprotobyname_r();
2N/Astruct protoent *getprotobynumber_r();
2N/Astruct protoent *getprotoent_r();
2N/Aint getnetgrent_r();
2N/Aint innetgr();
2N/A
2N/A/* Old interfaces that return a pointer to a static area; MT-unsafe */
2N/Astruct hostent *gethostbyname();
2N/Astruct hostent *gethostbyaddr();
2N/Astruct hostent *gethostent();
2N/Astruct netent *getnetbyname();
2N/Astruct netent *getnetbyaddr();
2N/Astruct netent *getnetent();
2N/Astruct servent *getservbyname();
2N/Astruct servent *getservbyport();
2N/Astruct servent *getservent();
2N/Astruct protoent *getprotobyname();
2N/Astruct protoent *getprotobynumber();
2N/Astruct protoent *getprotoent();
2N/Aint getnetgrent();
2N/A
2N/Aint sethostent();
2N/Aint endhostent();
2N/Aint setnetent();
2N/Aint endnetent();
2N/Aint setservent();
2N/Aint endservent();
2N/Aint setprotoent();
2N/Aint endprotoent();
2N/Aint setnetgrent();
2N/Aint endnetgrent();
2N/Aint rcmd();
2N/Aint rexec();
2N/Aint rresvport();
2N/Aint ruserok();
2N/A#endif
2N/A
2N/A/*
2N/A * Error return codes from gethostbyname() and gethostbyaddr()
2N/A * (when using the resolver)
2N/A */
2N/A
2N/Aextern int h_errno;
2N/A
2N/A#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
2N/A#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
2N/A#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
2N/A#define NO_DATA 4 /* Valid name, no data record of requested type */
2N/A#define NO_ADDRESS NO_DATA /* no address, look for MX record */
2N/A
2N/A#define MAXHOSTNAMELEN 256
2N/A
2N/A#define MAXALIASES 35
2N/A#define MAXADDRS 35
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _NETDB_H */