#ifndef HAVE_URTREE_PUBLIC_H #define HAVE_URTREE_PUBLIC_H /* --------------------------------------------------------------------- */ /* BEGIN COPYRIGHT AND LICENSE NOTICE */ /* --------------------------------------------------------------------- */ /* ** Copyright (c) 2007, 2009 by Richard Harter. ** ** Permission is hereby granted, free of charge, to any person ** obtaining a copy of this software and associated documentation ** files (the "Software"), to deal in the Software without ** restriction, including without limitation the rights to use, ** copy, modify, merge, publish, distribute, sublicense, and/or ** sell copies of the Software, and to permit persons to whom the ** Software is furnished to do so, subject to the following ** conditions: ** ** The above copyright notice and this permission notice shall be ** included in copies of this software and in copies of substantial ** portions, whether or not the software has been modified. ** ** Derivative works shall include a notice that the software is a ** modified version of the copyrighted software. ** ** There is no guarantee that this software is useful for anything ** or that it is any way correct or of value. The author disclaims ** any responsibility for the consequences of using this software. ** */ /* --------------------------------------------------------------------- */ /* END COPYRIGHT AND LICENSE NOTICE */ /* --------------------------------------------------------------------- */ /* Revision History */ /* */ /* 22 Apr 2007 - Base release 1.0.0 */ /* 23 Jun 2008 - Added key lookup, changed urtree_init to urtree_open */ /* --------------------------------------------------------------------- */ #define URT_HANDLE struct urt_handle #define VAL_ALT union urt_value_alt #define URT_RET struct urt_search_results #define URT_KEY struct urt_extracted_key #define URT_KEYSIG struct urt_key_signature #define ID_TYPE_INT 0 #define ID_TYPE_PTR 1 #define URT_NOCOPY 0 #define URT_COPY 1 #define URT_SUCCESS 1 #define URT_FAILURE 0 URT_HANDLE; VAL_ALT { int is_int; /* Value is an integer */ void * is_ptr; /* Value is a pointer */ }; URT_KEYSIG { void * sigloc; /* Ptr to location of lookup data */ size_t seqno; /* Validating sequence number */ }; URT_KEY { char * data; /* Ptr to key in char array form */ size_t len; /* Length of the key */ }; URT_RET { URT_KEYSIG sig; /* Signature to find key */ int success; /* Flag =0 failure, =1 success */ VAL_ALT value; /* Value returned, if any */ }; URT_RET urtree_search (URT_HANDLE *, unsigned char *, long); URT_RET urtree_insert (URT_HANDLE *, unsigned char *, long, VAL_ALT,int); int urtree_delete (URT_HANDLE *, unsigned char *, long, VAL_ALT); int urtree_verify (long, unsigned char *, unsigned char *); URT_KEY urtree_getkey (URT_KEYSIG); URT_HANDLE * urtree_open (FILE *, int, int); URT_HANDLE * urtree_copy (URT_HANDLE *); int urtree_close (URT_HANDLE *); void urtree_print_forest (FILE *, URT_HANDLE *); void urtree_print_stats (FILE *, URT_HANDLE *); #endif