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