xref: /illumos-gate/usr/src/cmd/sgs/link_audit/common/hash.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*20c1c355SRod Evans  * Common Development and Distribution License (the "License").
6*20c1c355SRod Evans  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate /*
23*20c1c355SRod Evans  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
25*20c1c355SRod Evans #ifndef _HASH_H
26*20c1c355SRod Evans #define	_HASH_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate typedef struct hash_entry {
29*20c1c355SRod Evans 	struct hash_entry	*next_entry;
30*20c1c355SRod Evans 	struct hash_entry	*right_entry;
31*20c1c355SRod Evans 	struct hash_entry	*left_entry;
327c478bd9Sstevel@tonic-gate 	char			*key;
337c478bd9Sstevel@tonic-gate 	char			*data;
347c478bd9Sstevel@tonic-gate } hash_entry;
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate typedef struct hash {
377c478bd9Sstevel@tonic-gate 	size_t			size;
387c478bd9Sstevel@tonic-gate 	hash_entry		**table;
397c478bd9Sstevel@tonic-gate 	hash_entry		*start;
40*20c1c355SRod Evans 	enum hash_type {
41*20c1c355SRod Evans 		String_Key = 0,
42*20c1c355SRod Evans 		Integer_Key = 1
43*20c1c355SRod Evans 	} hash_type;
447c478bd9Sstevel@tonic-gate } hash;
457c478bd9Sstevel@tonic-gate 
46*20c1c355SRod Evans extern hash	*make_hash(size_t);
47*20c1c355SRod Evans extern hash	*make_ihash(size_t);
48*20c1c355SRod Evans extern char	**get_hash(hash *, char *);
49*20c1c355SRod Evans extern char	**find_hash(hash *, const char *);
50*20c1c355SRod Evans extern char	*del_hash(hash *, const char *);
51*20c1c355SRod Evans extern size_t 	operate_hash(hash *, void (*)(), const char *);
52*20c1c355SRod Evans extern void 	destroy_hash(hash *, int (*)(), const char *);
537c478bd9Sstevel@tonic-gate 
54*20c1c355SRod Evans #endif /* _HASH_H */
55