xref: /onnv-gate/usr/src/lib/nsswitch/compat/common/compat_common.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1992, by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  *
25*0Sstevel@tonic-gate  * Common code and structures used by name-service-switch "compat" backends.
26*0Sstevel@tonic-gate  */
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate #ifndef _COMPAT_COMMON_H
29*0Sstevel@tonic-gate #define	_COMPAT_COMMON_H
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #include <nss_common.h>
34*0Sstevel@tonic-gate #include <nss_dbdefs.h>
35*0Sstevel@tonic-gate #include <stdio.h>
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #ifdef	__cplusplus
38*0Sstevel@tonic-gate extern "C" {
39*0Sstevel@tonic-gate #endif
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate typedef struct compat_backend *compat_backend_ptr_t;
42*0Sstevel@tonic-gate typedef nss_status_t	(*compat_backend_op_t)(compat_backend_ptr_t, void *);
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * ===> Fix da comments (and in files_common.h too...)
46*0Sstevel@tonic-gate  * Iterator function for _nss_files_do_all(), which probably calls yp_all().
47*0Sstevel@tonic-gate  *   NSS_NOTFOUND means "keep enumerating", NSS_SUCCESS means"return now",
48*0Sstevel@tonic-gate  *   other values don't make much sense.  In other words we're abusing
49*0Sstevel@tonic-gate  *   (overloading) the meaning of nss_status_t, but hey...
50*0Sstevel@tonic-gate  * _nss_compat_XY_all() is a wrapper around _nss_files_do_all() that does the
51*0Sstevel@tonic-gate  *   generic work for nss_XbyY_args_t backends (calls cstr2ent etc).
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate typedef nss_status_t	(*files_do_all_func_t)(const char *, int, void *args);
54*0Sstevel@tonic-gate /* ===> ^^ nuke this line */
55*0Sstevel@tonic-gate typedef int		(*compat_XY_check_func)(nss_XbyY_args_t *);
56*0Sstevel@tonic-gate typedef const char 	*(*compat_get_name)(nss_XbyY_args_t *);
57*0Sstevel@tonic-gate typedef int		(*compat_merge_func)(compat_backend_ptr_t,
58*0Sstevel@tonic-gate 					    nss_XbyY_args_t	*,
59*0Sstevel@tonic-gate 					    const char		**fields);
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate #if defined(__STDC__)
62*0Sstevel@tonic-gate extern nss_backend_t	*_nss_compat_constr(compat_backend_op_t	*ops,
63*0Sstevel@tonic-gate 					    int			n_ops,
64*0Sstevel@tonic-gate 					    const char		*filename,
65*0Sstevel@tonic-gate 					    int			min_bufsize,
66*0Sstevel@tonic-gate 					    nss_db_root_t	*rootp,
67*0Sstevel@tonic-gate 					    nss_db_initf_t	initf,
68*0Sstevel@tonic-gate 					    int			netgroups,
69*0Sstevel@tonic-gate 					    compat_get_name	getname_func,
70*0Sstevel@tonic-gate 					    compat_merge_func	merge_func);
71*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_destr(compat_backend_ptr_t, void *dummy);
72*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_setent(compat_backend_ptr_t, void *dummy);
73*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_endent(compat_backend_ptr_t, void *dummy);
74*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_getent(compat_backend_ptr_t, void *);
75*0Sstevel@tonic-gate extern nss_status_t 	_nss_compat_XY_all(compat_backend_ptr_t,
76*0Sstevel@tonic-gate 					nss_XbyY_args_t	*args,
77*0Sstevel@tonic-gate 					compat_XY_check_func	check,
78*0Sstevel@tonic-gate 					nss_dbop_t		op_num);
79*0Sstevel@tonic-gate extern nss_status_t 	_attrdb_compat_XY_all(compat_backend_ptr_t,
80*0Sstevel@tonic-gate 					nss_XbyY_args_t	*args,
81*0Sstevel@tonic-gate 					int netdb,
82*0Sstevel@tonic-gate 					compat_XY_check_func	check,
83*0Sstevel@tonic-gate 					nss_dbop_t		op_num);
84*0Sstevel@tonic-gate #else
85*0Sstevel@tonic-gate extern nss_backend_t	*_nss_compat_constr();
86*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_destr();
87*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_setent();
88*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_endent();
89*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_getent();
90*0Sstevel@tonic-gate extern nss_status_t	_nss_compat_XY_all();
91*0Sstevel@tonic-gate extern nss_status_t	_attrdb_compat_XY_all();
92*0Sstevel@tonic-gate #endif
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate #ifdef	__cplusplus
95*0Sstevel@tonic-gate }
96*0Sstevel@tonic-gate #endif
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate #endif /* _COMPAT_COMMON_H */
99