Remove building with NOCRYPTO option
[minix3.git] / lib / libc / gen / gr_private.h
blob2532a17545b52e949ea4f1499f0439e91614053a
1 /* $NetBSD: gr_private.h,v 1.2 2008/04/28 20:22:59 martin Exp $ */
3 /*-
4 * Copyright (c) 2004-2005 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Luke Mewburn.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Structures and functions used by various group(5) public functions
34 * and their back-end implementations.
35 * These are subject to change without notice and should not be used
36 * outside of libc (even by third-party nss_*.so modules implementing
37 * group(5) back-ends).
40 #define _GROUP_COMPAT /* "group" defaults to compat, so always provide it */
43 #if defined(__minix) && defined(_REENTRANT)
45 * mutex to serialize the public group(5) functions use of the
46 * back-end implementations, which may not be reentrant.
48 extern mutex_t __grmutex;
49 #endif /* defined(__minix) */
52 * files methods
54 struct __grstate_files { /* state shared between files methods */
55 int stayopen; /* see getgroupent(3) */
56 FILE *fp; /* groups file handle */
59 extern int __grstart_files(struct __grstate_files *);
60 extern int __grend_files(struct __grstate_files *);
61 extern int __grscan_files(int *, struct group *, char *, size_t,
62 struct __grstate_files *, int, const char *, gid_t);
65 * dns methods
67 struct __grstate_dns { /* state shared between dns methods */
68 int stayopen; /* see getgroupent(3) */
69 void *context; /* Hesiod context */
70 int num; /* group index, -1 if no more */
73 extern int __grstart_dns(struct __grstate_dns *);
74 extern int __grend_dns(struct __grstate_dns *state);
75 extern int __grscan_dns(int *, struct group *, char *, size_t,
76 struct __grstate_dns *, int, const char *, gid_t);
79 * nis methods
81 struct __grstate_nis { /* state shared between nis methods */
82 int stayopen; /* see getgroupent(3) */
83 char *domain; /* NIS domain */
84 int done; /* non-zero if search exhausted */
85 char *current; /* current first/next match */
86 int currentlen; /* length of _nis_current */
89 extern int __grstart_nis(struct __grstate_nis *);
90 extern int __grend_nis(struct __grstate_nis *);
91 extern int __grscan_nis(int *, struct group *, char *, size_t,
92 struct __grstate_nis *, int, const char *, gid_t);
95 * compat methods
97 struct __grstate_compat { /* state shared between compat methods */
98 int stayopen; /* see getgroupent(3) */
99 FILE *fp; /* file handle */
101 * XXX: convert name to a separate compatstate enum and grow name as necessary
102 * instead of using strdup & free for each + line
104 char *name; /* NULL if reading file, */
105 /* "" if compat "+", */
106 /* name if compat "+name" */
109 extern int __grbad_compat(void *nsrv, void *nscb, va_list ap);
110 extern int __grstart_compat(struct __grstate_compat *);
111 extern int __grend_compat(struct __grstate_compat *);
112 extern int __grscan_compat(int *, struct group *, char *, size_t,
113 struct __grstate_compat *, int, const char *, gid_t,
114 int (*)(void *, struct group **), void *);