afce951b |
1 | /* -*-c-*- |
2 | * |
af4f4d6a |
3 | * $Id: netg.h,v 1.5 2004/04/08 01:36:20 mdw Exp $ |
afce951b |
4 | * |
5 | * A local database of netgroups |
6 | * |
c758e654 |
7 | * (c) 1998 EBI |
afce951b |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of `become' |
13 | * |
14 | * `Become' is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2 of the License, or |
17 | * (at your option) any later version. |
18 | * |
19 | * `Become' is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | * GNU General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU General Public License |
25 | * along with `become'; if not, write to the Free Software Foundation, |
26 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
27 | */ |
28 | |
afce951b |
29 | #ifndef NETG_H |
30 | #define NETG_H |
31 | |
32 | #ifdef __cplusplus |
33 | extern "C" { |
34 | #endif |
35 | |
36 | /*----- Required headers --------------------------------------------------*/ |
37 | |
f60a3434 |
38 | #include <mLib/sym.h> |
afce951b |
39 | |
40 | /*----- Type definitions --------------------------------------------------*/ |
41 | |
42 | typedef sym_iter netg_iter; |
43 | typedef struct netg__sym netg; |
44 | |
45 | /*----- Functions provided ------------------------------------------------*/ |
46 | |
47 | /* --- @netg_iterate@, @netg_iterate_r@ --- * |
48 | * |
49 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
50 | * |
51 | * Returns: --- |
52 | * |
53 | * Use: Starts iterating over the netgroups. |
54 | */ |
55 | |
56 | extern void netg_iterate(void); |
57 | extern void netg_iterate_r(netg_iter */*i*/); |
58 | |
59 | /* --- @netg_next@, @netg_next_r@ --- * |
60 | * |
61 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
62 | * |
63 | * Returns: An opaque pointer to the next item, or null. |
64 | * |
65 | * Use: Returns the next netgroup. |
66 | */ |
67 | |
68 | extern netg *netg_next(void); |
69 | extern netg *netg_next_r(netg_iter */*i*/); |
70 | |
71 | /* --- @netg_name@ --- * |
72 | * |
73 | * Arguments: @netg *n@ = netgroup handle returned by @netg_next@. |
74 | * |
75 | * Returns: A pointer to the name; you may not modify this string. |
76 | * |
77 | * Use: Returns the name of a netgroup. |
78 | */ |
79 | |
80 | extern const char *netg_name(netg */*n*/); |
81 | |
82 | /* --- @netg_scan@ --- * |
83 | * |
84 | * Arguments: @netg *n@ = a netgroup handle returned by @netg_next@ |
85 | * @int (*proc)(netg *n, const char *host, const char *user,@ |
86 | * @const char *domain, void *ctx)@ = function to call |
87 | * for each member. |
88 | * @void *ctx@ = context pointer to pass to @proc@. |
89 | * |
90 | * Returns: Zero if all went well, or the nonzero return value from |
91 | * @proc@. |
92 | * |
93 | * Use: Passes all the members of the netgroup to a given function. |
94 | * The function is given the names, directly from the NIS |
95 | * netgroup map, except that any empty entries are passed as |
96 | * null pointers rather than empty strings. You may not modify |
97 | * any of the strings. The enumeration function, @proc@, may |
98 | * return nonzero to stop itself from being called any more; |
99 | * if this happens, the value it returns becomes the result of |
100 | * this function. If all the items are enumerated OK, this |
101 | * function returns zero. |
102 | */ |
103 | |
104 | extern int netg_scan(netg */*n*/, |
105 | int (*/*proc*/)(netg */*n*/, const char */*host*/, |
106 | const char */*user*/, |
107 | const char */*domain*/, void */*ctx*/), |
108 | void */*ctx*/); |
109 | |
110 | /* --- @netg_init@ --- * |
111 | * |
112 | * Arguments: --- |
113 | * |
114 | * Returns: --- |
115 | * |
116 | * Use: Reads the netgroup database and turns it into something nice. |
117 | */ |
118 | |
119 | extern void netg_init(void); |
120 | |
e6677daf |
121 | /* --- @netg_end@ --- * |
afce951b |
122 | * |
123 | * Arguments: --- |
124 | * |
125 | * Returns: --- |
126 | * |
e6677daf |
127 | * Use: Empties the netgroups database. |
afce951b |
128 | */ |
129 | |
e6677daf |
130 | extern void netg_end(void); |
afce951b |
131 | |
132 | /*----- That's all, folks -------------------------------------------------*/ |
133 | |
134 | #ifdef __cplusplus |
135 | } |
136 | #endif |
137 | |
138 | #endif |