17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3*9525b14bSRao Shoaib  * Copyright (c) 1997,1999 by Internet Software Consortium.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
67c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
77c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
87c478bd9Sstevel@tonic-gate  *
9*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*9525b14bSRao Shoaib  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*9525b14bSRao Shoaib  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*9525b14bSRao Shoaib  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*9525b14bSRao Shoaib  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*9525b14bSRao Shoaib  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*9525b14bSRao Shoaib  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167c478bd9Sstevel@tonic-gate  */
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate typedef int (*heap_higher_priority_func)(void *, void *);
197c478bd9Sstevel@tonic-gate typedef void (*heap_index_func)(void *, int);
207c478bd9Sstevel@tonic-gate typedef void (*heap_for_each_func)(void *, void *);
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate typedef struct heap_context {
237c478bd9Sstevel@tonic-gate 	int array_size;
247c478bd9Sstevel@tonic-gate 	int array_size_increment;
257c478bd9Sstevel@tonic-gate 	int heap_size;
267c478bd9Sstevel@tonic-gate 	void **heap;
277c478bd9Sstevel@tonic-gate 	heap_higher_priority_func higher_priority;
287c478bd9Sstevel@tonic-gate 	heap_index_func index;
297c478bd9Sstevel@tonic-gate } *heap_context;
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #define heap_new	__heap_new
327c478bd9Sstevel@tonic-gate #define heap_free	__heap_free
337c478bd9Sstevel@tonic-gate #define heap_insert	__heap_insert
347c478bd9Sstevel@tonic-gate #define heap_delete	__heap_delete
357c478bd9Sstevel@tonic-gate #define heap_increased	__heap_increased
367c478bd9Sstevel@tonic-gate #define heap_decreased	__heap_decreased
377c478bd9Sstevel@tonic-gate #define heap_element	__heap_element
387c478bd9Sstevel@tonic-gate #define heap_for_each	__heap_for_each
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate heap_context	heap_new(heap_higher_priority_func, heap_index_func, int);
417c478bd9Sstevel@tonic-gate int		heap_free(heap_context);
427c478bd9Sstevel@tonic-gate int		heap_insert(heap_context, void *);
437c478bd9Sstevel@tonic-gate int		heap_delete(heap_context, int);
447c478bd9Sstevel@tonic-gate int		heap_increased(heap_context, int);
457c478bd9Sstevel@tonic-gate int		heap_decreased(heap_context, int);
467c478bd9Sstevel@tonic-gate void *		heap_element(heap_context, int);
477c478bd9Sstevel@tonic-gate int		heap_for_each(heap_context, heap_for_each_func, void *);
48*9525b14bSRao Shoaib 
49*9525b14bSRao Shoaib /*! \file */
50