xref: /titanic_41/usr/src/head/nss_netdir.h (revision 06e1a7147edd272b7296f208141627a5b1191731)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * nss_netdir.h
28  *
29  * Defines structures that are shared between the OSNET-private
30  * _get_hostserv_inetnetdir_byYY() interfaces and the public
31  * interfaces gethostbyYY()/getservbyYY() and netdir_getbyYY().
32  * Ideally, this header file should never be visible to developers
33  * outside of the OSNET build.
34  */
35 
36 #ifndef _NSS_NETDIR_H
37 #define	_NSS_NETDIR_H
38 
39 #pragma ident	"%Z%%M%	%I%	%E% SMI"
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 typedef enum {
46 	NSS_HOST,
47 	NSS_SERV,
48 	NETDIR_BY,
49 	NETDIR_BY_NOSRV,		/* bypass service lookup */
50 	NETDIR_BY6,
51 	NETDIR_BY_NOSRV6,		/* bypass service lookup */
52 	NSS_HOST6
53 } nss_netdir_op_t;
54 
55 struct nss_netdirbyname_in {
56 	nss_netdir_op_t	op_t;
57 	union {
58 		struct nd_hostserv *nd_hs;
59 		union {
60 			struct {
61 				const char	*name;
62 				char	*buf;
63 				int	buflen;
64 			} host;
65 			struct {
66 				const char	*name;
67 				char	*buf;
68 				int	buflen;
69 				int	af_family;	/* for ipnode */
70 				int	flags;		/* for ipnode */
71 			} host6;
72 			struct {
73 				const char	*name;
74 				const char	*proto;
75 				char	*buf;
76 				int	buflen;
77 			} serv;
78 		} nss;
79 	} arg;
80 };
81 
82 union nss_netdirbyname_out {
83 	struct nd_addrlist **nd_alist;
84 	union {
85 		struct {
86 			struct hostent *hent;
87 			int	*herrno_p;
88 		} host;
89 		struct servent *serv;
90 	} nss;
91 };
92 
93 struct nss_netdirbyaddr_in {
94 	nss_netdir_op_t	op_t;
95 	union {
96 		struct netbuf *nd_nbuf;
97 		union {
98 			struct {
99 				const char	*addr;
100 				int	len;
101 				int	type;
102 				char	*buf;
103 				int	buflen;
104 			} host;
105 			struct {
106 				int	port;
107 				const char	*proto;
108 				char	*buf;
109 				int	buflen;
110 			} serv;
111 		} nss;
112 	} arg;
113 };
114 
115 union nss_netdirbyaddr_out {
116 	struct nd_hostservlist **nd_hslist;
117 	union {
118 		struct {
119 			struct hostent *hent;
120 			int	*herrno_p;
121 		} host;
122 		struct servent *serv;
123 	} nss;
124 };
125 
126 #ifdef __STDC__
127 
128 int __classic_netdir_getbyname(struct netconfig *,
129 		struct nd_hostserv *, struct nd_addrlist **);
130 int __classic_netdir_getbyaddr(struct netconfig *,
131 		struct nd_hostservlist **, struct netbuf *);
132 int _get_hostserv_inetnetdir_byname(struct netconfig *,
133 		struct nss_netdirbyname_in *, union nss_netdirbyname_out *);
134 int _get_hostserv_inetnetdir_byaddr(struct netconfig *,
135 		struct nss_netdirbyaddr_in *, union nss_netdirbyaddr_out *);
136 int __inet_netdir_options(struct netconfig *,
137 		int option, int fd, char *par);
138 struct netbuf *__inet_uaddr2taddr(struct netconfig *, char *);
139 char *__inet_taddr2uaddr(struct netconfig *, struct netbuf *);
140 
141 #else
142 
143 int __classic_netdir_getbyname();
144 int __classic_netdir_getbyaddr();
145 int _get_hostserv_inetnetdir_byname();
146 int _get_hostserv_inetnetdir_byaddr();
147 int __inet_netdir_options();
148 struct netbuf *__inet_uaddr2taddr();
149 char *__inet_taddr2uaddr();
150 
151 #endif /* __STDC__ */
152 
153 #ifdef	__cplusplus
154 }
155 #endif
156 
157 #endif /* _NSS_NETDIR_H */
158