Home | History | Annotate | Line # | Download | only in revnetgroup
hash.h revision 1.1
      1  1.1  lukem /* $OpenBSD: hash.h,v 1.1 1997/04/15 22:06:12 maja Exp $ */
      2  1.1  lukem /*
      3  1.1  lukem  * Copyright (c) 1995
      4  1.1  lukem  *	Bill Paul <wpaul (at) ctr.columbia.edu>.  All rights reserved.
      5  1.1  lukem  *
      6  1.1  lukem  * Redistribution and use in source and binary forms, with or without
      7  1.1  lukem  * modification, are permitted provided that the following conditions
      8  1.1  lukem  * are met:
      9  1.1  lukem  * 1. Redistributions of source code must retain the above copyright
     10  1.1  lukem  *    notice, this list of conditions and the following disclaimer.
     11  1.1  lukem  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  lukem  *    notice, this list of conditions and the following disclaimer in the
     13  1.1  lukem  *    documentation and/or other materials provided with the distribution.
     14  1.1  lukem  * 3. All advertising materials mentioning features or use of this software
     15  1.1  lukem  *    must display the following acknowledgement:
     16  1.1  lukem  *	This product includes software developed by Bill Paul.
     17  1.1  lukem  * 4. Neither the name of the author nor the names of any co-contributors
     18  1.1  lukem  *    may be used to endorse or promote products derived from this software
     19  1.1  lukem  *    without specific prior written permission.
     20  1.1  lukem  *
     21  1.1  lukem  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
     22  1.1  lukem  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1  lukem  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1  lukem  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
     25  1.1  lukem  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1  lukem  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1  lukem  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  lukem  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1  lukem  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  lukem  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1  lukem  * SUCH DAMAGE.
     32  1.1  lukem  *
     33  1.1  lukem  *	$FreeBSD: hash.h,v 1.5 1997/02/22 14:22:02 peter Exp $
     34  1.1  lukem  */
     35  1.1  lukem 
     36  1.1  lukem /* Groupname entry hung off a member_entry node. */
     37  1.1  lukem struct grouplist {
     38  1.1  lukem 	char *groupname;
     39  1.1  lukem 	struct grouplist *next;
     40  1.1  lukem };
     41  1.1  lukem 
     42  1.1  lukem /* Entry in the cooked member list hash table. */
     43  1.1  lukem struct member_entry {
     44  1.1  lukem 	char *key;
     45  1.1  lukem 	char *domain;
     46  1.1  lukem 	struct grouplist *groups;
     47  1.1  lukem 	struct member_entry *next;
     48  1.1  lukem };
     49  1.1  lukem 
     50  1.1  lukem /* Entry in the raw netgroup table. */
     51  1.1  lukem struct group_entry {
     52  1.1  lukem 	char *key;
     53  1.1  lukem 	char *data;
     54  1.1  lukem 	struct group_entry *next;
     55  1.1  lukem };
     56  1.1  lukem 
     57  1.1  lukem /* Table size (chosen arbitrarily). Not too big, not too small. */
     58  1.1  lukem #define TABLESIZE 256
     59  1.1  lukem #define HASH_MASK 0x000000FF
     60  1.1  lukem 
     61  1.1  lukem #define LINSIZ 1024 * 10
     62  1.1  lukem 
     63  1.1  lukem extern void store __P(( struct group_entry ** , char *, char * ));
     64  1.1  lukem extern void mstore __P(( struct member_entry ** , char *, char *, char * ));
     65  1.1  lukem extern char *lookup __P(( struct group_entry **, char * ));
     66  1.1  lukem extern void __endnetgrent __P(( void ));
     67  1.1  lukem extern void __setnetgrent __P(( char * ));
     68  1.1  lukem extern int __getnetgrent __P(( char **, char **, char ** ));
     69