xref: /titanic_41/usr/src/lib/nsswitch/compat/common/compat_common.h (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1992, by Sun Microsystems, Inc.
24  *
25  * Common code and structures used by name-service-switch "compat" backends.
26  */
27 
28 #ifndef _COMPAT_COMMON_H
29 #define	_COMPAT_COMMON_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #include <nss_common.h>
34 #include <nss_dbdefs.h>
35 #include <stdio.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 typedef struct compat_backend *compat_backend_ptr_t;
42 typedef nss_status_t	(*compat_backend_op_t)(compat_backend_ptr_t, void *);
43 
44 /*
45  * ===> Fix da comments (and in files_common.h too...)
46  * Iterator function for _nss_files_do_all(), which probably calls yp_all().
47  *   NSS_NOTFOUND means "keep enumerating", NSS_SUCCESS means"return now",
48  *   other values don't make much sense.  In other words we're abusing
49  *   (overloading) the meaning of nss_status_t, but hey...
50  * _nss_compat_XY_all() is a wrapper around _nss_files_do_all() that does the
51  *   generic work for nss_XbyY_args_t backends (calls cstr2ent etc).
52  */
53 typedef nss_status_t	(*files_do_all_func_t)(const char *, int, void *args);
54 /* ===> ^^ nuke this line */
55 typedef int		(*compat_XY_check_func)(nss_XbyY_args_t *);
56 typedef const char 	*(*compat_get_name)(nss_XbyY_args_t *);
57 typedef int		(*compat_merge_func)(compat_backend_ptr_t,
58 					    nss_XbyY_args_t	*,
59 					    const char		**fields);
60 
61 #if defined(__STDC__)
62 extern nss_backend_t	*_nss_compat_constr(compat_backend_op_t	*ops,
63 					    int			n_ops,
64 					    const char		*filename,
65 					    int			min_bufsize,
66 					    nss_db_root_t	*rootp,
67 					    nss_db_initf_t	initf,
68 					    int			netgroups,
69 					    compat_get_name	getname_func,
70 					    compat_merge_func	merge_func);
71 extern nss_status_t	_nss_compat_destr(compat_backend_ptr_t, void *dummy);
72 extern nss_status_t	_nss_compat_setent(compat_backend_ptr_t, void *dummy);
73 extern nss_status_t	_nss_compat_endent(compat_backend_ptr_t, void *dummy);
74 extern nss_status_t	_nss_compat_getent(compat_backend_ptr_t, void *);
75 extern nss_status_t 	_nss_compat_XY_all(compat_backend_ptr_t,
76 					nss_XbyY_args_t	*args,
77 					compat_XY_check_func	check,
78 					nss_dbop_t		op_num);
79 extern nss_status_t 	_attrdb_compat_XY_all(compat_backend_ptr_t,
80 					nss_XbyY_args_t	*args,
81 					int netdb,
82 					compat_XY_check_func	check,
83 					nss_dbop_t		op_num);
84 #else
85 extern nss_backend_t	*_nss_compat_constr();
86 extern nss_status_t	_nss_compat_destr();
87 extern nss_status_t	_nss_compat_setent();
88 extern nss_status_t	_nss_compat_endent();
89 extern nss_status_t	_nss_compat_getent();
90 extern nss_status_t	_nss_compat_XY_all();
91 extern nss_status_t	_attrdb_compat_XY_all();
92 #endif
93 
94 #ifdef	__cplusplus
95 }
96 #endif
97 
98 #endif /* _COMPAT_COMMON_H */
99