xref: /onnv-gate/usr/src/lib/libresolv2/include/isc/heap.h (revision 11038:74b12212b8a2)
10Sstevel@tonic-gate /*
2*11038SRao.Shoaib@Sun.COM  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3*11038SRao.Shoaib@Sun.COM  * Copyright (c) 1997,1999 by Internet Software Consortium.
40Sstevel@tonic-gate  *
50Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
60Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
70Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
80Sstevel@tonic-gate  *
9*11038SRao.Shoaib@Sun.COM  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*11038SRao.Shoaib@Sun.COM  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*11038SRao.Shoaib@Sun.COM  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*11038SRao.Shoaib@Sun.COM  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*11038SRao.Shoaib@Sun.COM  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*11038SRao.Shoaib@Sun.COM  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*11038SRao.Shoaib@Sun.COM  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
160Sstevel@tonic-gate  */
170Sstevel@tonic-gate 
180Sstevel@tonic-gate typedef int (*heap_higher_priority_func)(void *, void *);
190Sstevel@tonic-gate typedef void (*heap_index_func)(void *, int);
200Sstevel@tonic-gate typedef void (*heap_for_each_func)(void *, void *);
210Sstevel@tonic-gate 
220Sstevel@tonic-gate typedef struct heap_context {
230Sstevel@tonic-gate 	int array_size;
240Sstevel@tonic-gate 	int array_size_increment;
250Sstevel@tonic-gate 	int heap_size;
260Sstevel@tonic-gate 	void **heap;
270Sstevel@tonic-gate 	heap_higher_priority_func higher_priority;
280Sstevel@tonic-gate 	heap_index_func index;
290Sstevel@tonic-gate } *heap_context;
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #define heap_new	__heap_new
320Sstevel@tonic-gate #define heap_free	__heap_free
330Sstevel@tonic-gate #define heap_insert	__heap_insert
340Sstevel@tonic-gate #define heap_delete	__heap_delete
350Sstevel@tonic-gate #define heap_increased	__heap_increased
360Sstevel@tonic-gate #define heap_decreased	__heap_decreased
370Sstevel@tonic-gate #define heap_element	__heap_element
380Sstevel@tonic-gate #define heap_for_each	__heap_for_each
390Sstevel@tonic-gate 
400Sstevel@tonic-gate heap_context	heap_new(heap_higher_priority_func, heap_index_func, int);
410Sstevel@tonic-gate int		heap_free(heap_context);
420Sstevel@tonic-gate int		heap_insert(heap_context, void *);
430Sstevel@tonic-gate int		heap_delete(heap_context, int);
440Sstevel@tonic-gate int		heap_increased(heap_context, int);
450Sstevel@tonic-gate int		heap_decreased(heap_context, int);
460Sstevel@tonic-gate void *		heap_element(heap_context, int);
470Sstevel@tonic-gate int		heap_for_each(heap_context, heap_for_each_func, void *);
48*11038SRao.Shoaib@Sun.COM 
49*11038SRao.Shoaib@Sun.COM /*! \file */
50