New source file added to maintain a netgroups database.
[become] / src / netg.h
diff --git a/src/netg.h b/src/netg.h
new file mode 100644 (file)
index 0000000..964acb6
--- /dev/null
@@ -0,0 +1,148 @@
+/* -*-c-*-
+ *
+ * $Id: netg.h,v 1.1 1997/08/07 09:45:00 mdw Exp $
+ *
+ * A local database of netgroups
+ *
+ * (c) 1997 EBI
+ */
+
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of `become'
+ *
+ * `Become' is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * `Become' is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with `become'; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ /*----- Revision history --------------------------------------------------*
+ *
+ * $Log: netg.h,v $
+ * Revision 1.1  1997/08/07 09:45:00  mdw
+ * New source file added to maintain a netgroups database.
+ *
+ */
+
+#ifndef NETG_H
+#define NETG_H
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+/*----- Required headers --------------------------------------------------*/
+
+#ifndef SYM_H
+#  include "sym.h"
+#endif
+
+/*----- Type definitions --------------------------------------------------*/
+
+typedef sym_iter netg_iter;
+typedef struct netg__sym netg;
+
+/*----- Functions provided ------------------------------------------------*/
+
+/* --- @netg_iterate@, @netg_iterate_r@ --- *
+ *
+ * Arguments:  @netg_iter *i@ = pointer to a netgroup iterator object
+ *
+ * Returns:    ---
+ *
+ * Use:                Starts iterating over the netgroups.
+ */
+
+extern void netg_iterate(void);
+extern void netg_iterate_r(netg_iter */*i*/);
+
+/* --- @netg_next@, @netg_next_r@ --- *
+ *
+ * Arguments:  @netg_iter *i@ = pointer to a netgroup iterator object
+ *
+ * Returns:    An opaque pointer to the next item, or null.
+ *
+ * Use:                Returns the next netgroup.
+ */
+
+extern netg *netg_next(void);
+extern netg *netg_next_r(netg_iter */*i*/);
+
+/* --- @netg_name@ --- *
+ *
+ * Arguments:  @netg *n@ = netgroup handle returned by @netg_next@.
+ *
+ * Returns:    A pointer to the name; you may not modify this string.
+ *
+ * Use:                Returns the name of a netgroup.
+ */
+
+extern const char *netg_name(netg */*n*/);
+
+/* --- @netg_scan@ --- *
+ *
+ * Arguments:  @netg *n@ = a netgroup handle returned by @netg_next@
+ *             @int (*proc)(netg *n, const char *host, const char *user,@
+ *                     @const char *domain, void *ctx)@ = function to call
+ *                             for each member.
+ *             @void *ctx@ = context pointer to pass to @proc@.
+ *
+ * Returns:    Zero if all went well, or the nonzero return value from
+ *             @proc@.
+ *
+ * Use:                Passes all the members of the netgroup to a given function.
+ *             The function is given the names, directly from the NIS
+ *             netgroup map, except that any empty entries are passed as
+ *             null pointers rather than empty strings.  You may not modify
+ *             any of the strings.  The enumeration function, @proc@, may
+ *             return nonzero to stop itself from being called any more;
+ *             if this happens, the value it returns becomes the result of
+ *             this function.  If all the items are enumerated OK, this
+ *             function returns zero.
+ */
+
+extern int netg_scan(netg */*n*/,
+                    int (*/*proc*/)(netg */*n*/, const char */*host*/,
+                                    const char */*user*/,
+                                    const char */*domain*/, void */*ctx*/),
+                    void */*ctx*/);
+
+/* --- @netg_init@ --- *
+ *
+ * Arguments:  ---
+ *
+ * Returns:    ---
+ *
+ * Use:                Reads the netgroup database and turns it into something nice.
+ */
+
+extern void netg_init(void);
+
+/* --- @netg_reinit@ --- *
+ *
+ * Arguments:  ---
+ *
+ * Returns:    ---
+ *
+ * Use:                Forces a re-read of the netgroups file.
+ */
+
+extern void netg_reinit(void);
+
+/*----- That's all, folks -------------------------------------------------*/
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif