afce951b |
1 | /* -*-c-*- |
2 | * |
e6677daf |
3 | * $Id: netg.h,v 1.2 1997/08/20 16:19:24 mdw Exp $ |
afce951b |
4 | * |
5 | * A local database of netgroups |
6 | * |
7 | * (c) 1997 EBI |
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 | |
29 | /*----- Revision history --------------------------------------------------* |
30 | * |
31 | * $Log: netg.h,v $ |
e6677daf |
32 | * Revision 1.2 1997/08/20 16:19:24 mdw |
33 | * Replace `name_reinit' by `name_end' for more sensible restart. |
34 | * |
afce951b |
35 | * Revision 1.1 1997/08/07 09:45:00 mdw |
36 | * New source file added to maintain a netgroups database. |
37 | * |
38 | */ |
39 | |
40 | #ifndef NETG_H |
41 | #define NETG_H |
42 | |
43 | #ifdef __cplusplus |
44 | extern "C" { |
45 | #endif |
46 | |
47 | /*----- Required headers --------------------------------------------------*/ |
48 | |
49 | #ifndef SYM_H |
50 | # include "sym.h" |
51 | #endif |
52 | |
53 | /*----- Type definitions --------------------------------------------------*/ |
54 | |
55 | typedef sym_iter netg_iter; |
56 | typedef struct netg__sym netg; |
57 | |
58 | /*----- Functions provided ------------------------------------------------*/ |
59 | |
60 | /* --- @netg_iterate@, @netg_iterate_r@ --- * |
61 | * |
62 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
63 | * |
64 | * Returns: --- |
65 | * |
66 | * Use: Starts iterating over the netgroups. |
67 | */ |
68 | |
69 | extern void netg_iterate(void); |
70 | extern void netg_iterate_r(netg_iter */*i*/); |
71 | |
72 | /* --- @netg_next@, @netg_next_r@ --- * |
73 | * |
74 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
75 | * |
76 | * Returns: An opaque pointer to the next item, or null. |
77 | * |
78 | * Use: Returns the next netgroup. |
79 | */ |
80 | |
81 | extern netg *netg_next(void); |
82 | extern netg *netg_next_r(netg_iter */*i*/); |
83 | |
84 | /* --- @netg_name@ --- * |
85 | * |
86 | * Arguments: @netg *n@ = netgroup handle returned by @netg_next@. |
87 | * |
88 | * Returns: A pointer to the name; you may not modify this string. |
89 | * |
90 | * Use: Returns the name of a netgroup. |
91 | */ |
92 | |
93 | extern const char *netg_name(netg */*n*/); |
94 | |
95 | /* --- @netg_scan@ --- * |
96 | * |
97 | * Arguments: @netg *n@ = a netgroup handle returned by @netg_next@ |
98 | * @int (*proc)(netg *n, const char *host, const char *user,@ |
99 | * @const char *domain, void *ctx)@ = function to call |
100 | * for each member. |
101 | * @void *ctx@ = context pointer to pass to @proc@. |
102 | * |
103 | * Returns: Zero if all went well, or the nonzero return value from |
104 | * @proc@. |
105 | * |
106 | * Use: Passes all the members of the netgroup to a given function. |
107 | * The function is given the names, directly from the NIS |
108 | * netgroup map, except that any empty entries are passed as |
109 | * null pointers rather than empty strings. You may not modify |
110 | * any of the strings. The enumeration function, @proc@, may |
111 | * return nonzero to stop itself from being called any more; |
112 | * if this happens, the value it returns becomes the result of |
113 | * this function. If all the items are enumerated OK, this |
114 | * function returns zero. |
115 | */ |
116 | |
117 | extern int netg_scan(netg */*n*/, |
118 | int (*/*proc*/)(netg */*n*/, const char */*host*/, |
119 | const char */*user*/, |
120 | const char */*domain*/, void */*ctx*/), |
121 | void */*ctx*/); |
122 | |
123 | /* --- @netg_init@ --- * |
124 | * |
125 | * Arguments: --- |
126 | * |
127 | * Returns: --- |
128 | * |
129 | * Use: Reads the netgroup database and turns it into something nice. |
130 | */ |
131 | |
132 | extern void netg_init(void); |
133 | |
e6677daf |
134 | /* --- @netg_end@ --- * |
afce951b |
135 | * |
136 | * Arguments: --- |
137 | * |
138 | * Returns: --- |
139 | * |
e6677daf |
140 | * Use: Empties the netgroups database. |
afce951b |
141 | */ |
142 | |
e6677daf |
143 | extern void netg_end(void); |
afce951b |
144 | |
145 | /*----- That's all, folks -------------------------------------------------*/ |
146 | |
147 | #ifdef __cplusplus |
148 | } |
149 | #endif |
150 | |
151 | #endif |