5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2001 - 2007 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silcutil/SILC Hash Table Interface
24 * Implementation of collision resistant hash table. This is a hash table
25 * that provides a reliable (what you add there stays there, and duplicate
26 * keys are allowed) with as fast reference to the key as possible. If
27 * there are a lot of duplicate keys in the hash table the lookup slows down.
28 * However, this is reliable and no data is lost at any point. If you know
29 * that you never have duplicate keys then this is as fast as any simple hash
32 * The interface provides many ways to search the hash table including
33 * an extended interface where caller can specify its own hash and comparison
34 * functions. The interface also supports SilcStack and all memory allocated
35 * by the hash table can be allocated from SilcStack.
37 * There are two ways to traverse the entire hash table if this feature
38 * is needed. There exists a foreach function that calls a foreach
39 * callback for each entry in the hash table. Other way is to use
40 * SilcHashTableList structure and traverse the hash table inside while()
41 * using the list structure. Both are equally fast.
43 * The hash table is not thread safe. If same SilcHashtable context is used
44 * in multi thread environment concurrency control must be employed.
48 #ifndef SILCHASHTABLE_H
49 #define SILCHASHTABLE_H
51 /****s* silcutil/SilcHashTableAPI/SilcHashTable
55 * typedef struct SilcHashTableStruct *SilcHashTable;
59 * This context is the actual hash table and is allocated
60 * by silc_hash_table_alloc and given as argument usually to
61 * all silc_hash_table_* functions. It is freed by the
62 * silc_hash_table_free function.
65 typedef struct SilcHashTableStruct *SilcHashTable;
67 /****s* silcutil/SilcHashTableAPI/SilcHashTableList
71 * typedef struct SilcHashTableListStruct SilcHashTableList;
75 * This structure is used to tarverse the hash table. This structure
76 * is given as argument to the silc_hash_table_list function to
77 * initialize it and then used to traverse the hash table with the
78 * silc_hash_table_get function. It needs not be allocated or freed.
82 * SilcHashTableList htl;
83 * silc_hash_table_list(hash_table, &htl);
84 * while (silc_hash_table_get(&htl, (void *)&key, (void *)&context))
86 * silc_hash_table_list_reset(&htl);
90 typedef struct SilcHashTableListStruct SilcHashTableList;
92 /* List structure to traverse the hash table. */
93 struct SilcHashTableListStruct {
96 unsigned int index : 31;
97 unsigned int auto_rehash : 1;
101 /****f* silcutil/SilcHashTableAPI/SilcHashFunction
105 * typedef SilcUInt32 (*SilcHashFunction)(void *key, void *user_context);
109 * A type for the hash function. This function is used to hash the
110 * provided key value `key' and return the index for the hash table.
111 * The `user_context' is application specific context and is delivered
115 typedef SilcUInt32 (*SilcHashFunction)(void *key, void *user_context);
117 /****f* silcutil/SilcHashTableAPI/SilcHashCompare
121 * typedef SilcBool (*SilcHashCompare)(void *key1, void *key2,
122 * void *user_context);
126 * A comparison funtion that is called to compare the two keys `key1' and
127 * `key2'. If they are equal this must return TRUE or FALSE otherwise.
128 * The application provides this function when allocating a new hash table.
129 * The `user_context' is application specific context and is delivered
133 typedef SilcBool (*SilcHashCompare)(void *key1, void *key2,
136 /****f* silcutil/SilcHashTableAPI/SilcHashDestructor
140 * typedef void (*SilcHashDestructor)(void *key, void *context,
141 * void *user_context);
145 * A destructor callback that the library will call to destroy the
146 * `key' and `context'. The application provides the function when
147 * allocating a new hash table. The `user_context' is application
148 * specific context and is delivered to the callback.
151 typedef void (*SilcHashDestructor)(void *key, void *context,
154 /****f* silcutil/SilcHashTableAPI/SilcHashForeach
158 * typedef void (*SilcHashForeach)(void *key, void *context,
159 * void *user_context);
163 * Foreach function. This is called when traversing the entrys in the
164 * hash table using silc_hash_table_foreach. The `user_context' is
165 * application specific context and is delivered to the callback.
168 typedef void (*SilcHashForeach)(void *key, void *context, void *user_context);
170 /* Simple hash table interface */
172 /****f* silcutil/SilcHashTableAPI/silc_hash_table_alloc
176 * SilcHashTable silc_hash_table_alloc(SilcStack stack,
177 * SilcUInt32 table_size,
178 * SilcHashFunction hash,
179 * void *hash_user_context,
180 * SilcHashCompare compare,
181 * void *compare_user_context,
182 * SilcHashDestructor destructor,
183 * void *destructor_user_context,
184 * SilcBool auto_rehash);
188 * Allocates new hash table and returns it. If the `stack' is non-NULL
189 * the hash table is allocated from `stack'. If the `table_size' is not
190 * zero then the hash table size is the size provided. If zero then the
191 * default size will be used. Note that if the `table_size' is provided
192 * it should be a prime. The `hash', `compare' and `destructor' are
193 * the hash function, the key comparison function and key and context
194 * destructor function, respectively. The `hash' is mandatory, the others
195 * are optional. Returns NULL if system is out of memory.
198 SilcHashTable silc_hash_table_alloc(SilcStack stack,
199 SilcUInt32 table_size,
200 SilcHashFunction hash,
201 void *hash_user_context,
202 SilcHashCompare compare,
203 void *compare_user_context,
204 SilcHashDestructor destructor,
205 void *destructor_user_context,
206 SilcBool auto_rehash);
208 /****f* silcutil/SilcHashTableAPI/silc_hash_table_free
212 * void silc_hash_table_free(SilcHashTable ht);
216 * Frees the hash table. The destructor function provided in the
217 * silc_hash_table_alloc will be called for all keys in the hash table.
219 * If the SilcStack was given to silc_hash_table_alloc this call will
220 * release all memory allocated during the life time of the `ht' back
224 void silc_hash_table_free(SilcHashTable ht);
226 /****f* silcutil/SilcHashTableAPI/silc_hash_table_size
230 * SilcUInt32 silc_hash_table_size(SilcHashTable ht);
234 * Returns the size of the hash table. This is the true size of the
238 SilcUInt32 silc_hash_table_size(SilcHashTable ht);
240 /****f* silcutil/SilcHashTableAPI/silc_hash_table_count
244 * SilcUInt32 silc_hash_table_count(SilcHashTable ht);
248 * Returns the number of the entires in the hash table. If there is more
249 * entries in the table thatn the size of the hash table calling the
250 * silc_hash_table_rehash is recommended.
253 SilcUInt32 silc_hash_table_count(SilcHashTable ht);
255 /****f* silcutil/SilcHashTableAPI/silc_hash_table_add
259 * SilcBool silc_hash_table_add(SilcHashTable ht, void *key, void *context);
263 * Adds new entry to the hash table. The `key' is hashed using the
264 * hash function and the both `key' and `context' will be saved to the
265 * hash table. This function quarantees that the entry is always added
266 * to the hash table reliably (it is collision resistant).
269 SilcBool silc_hash_table_add(SilcHashTable ht, void *key, void *context);
271 /****f* silcutil/SilcHashTableAPI/silc_hash_table_set
275 * SilcBool silc_hash_table_set(SilcHashTable ht, void *key,
280 * Same as silc_hash_table_add but if the `key' already exists in the
281 * hash table the old key and the old context will be replaced with the
282 * `key' and the `context. The destructor function will be called for the
283 * replaced key and context.
286 SilcBool silc_hash_table_set(SilcHashTable ht, void *key, void *context);
288 /****f* silcutil/SilcHashTableAPI/silc_hash_table_del
292 * SilcBool silc_hash_table_del(SilcHashTable ht, void *key);
296 * Removes the entry from the hash table by the provided `key'. This will
297 * call the destructor funtion for the found entry. Return TRUE if the
298 * entry was removed successfully and FALSE otherwise.
301 SilcBool silc_hash_table_del(SilcHashTable ht, void *key);
303 /****f* silcutil/SilcHashTableAPI/silc_hash_table_del_by_context
307 * SilcBool silc_hash_table_del_by_context(SilcHashTable ht, void *key,
312 * Same as silc_hash_table_del but verifies that the context associated
313 * with the `key' matches the `context'. This is handy to use with hash
314 * tables that may have duplicate keys. In that case the `context' may
315 * be used to check whether the correct entry is being deleted.
318 SilcBool silc_hash_table_del_by_context(SilcHashTable ht, void *key,
321 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find
325 * SilcBool silc_hash_table_find(SilcHashTable ht, void *key,
326 * void **ret_key, void **ret_context);
330 * Finds the entry in the hash table by the provided `key' as fast as
331 * possible. Return TRUE if the entry was found and FALSE otherwise.
332 * The found entry is returned to the `ret_key' and `ret_context',
333 * respectively. If the `ret_key and `ret_context' are NULL then this
334 * maybe used only to check whether given key exists in the table.
337 SilcBool silc_hash_table_find(SilcHashTable ht, void *key,
338 void **ret_key, void **ret_context);
340 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find_by_context
344 * SilcBool silc_hash_table_find_by_context(SilcHashTable ht, void *key,
345 * void *context, void **ret_key);
349 * Finds the entry in the hash table by the provided `key' and
350 * `context' as fast as possible. This is handy function when there
351 * can be multiple same keys in the hash table. By using this function
352 * the specific key with specific context can be found. Return
353 * TRUE if the entry with the key and context was found and FALSE
354 * otherwise. The function returns only the key to `ret_key' since
355 * the caller already knows the context.
358 SilcBool silc_hash_table_find_by_context(SilcHashTable ht, void *key,
359 void *context, void **ret_key);
361 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find_foreach
365 * void silc_hash_table_find_foreach(SilcHashTable ht, void *key,
366 * SilcHashForeach foreach,
367 * void *user_context);
371 * As the hash table is collision resistant it is possible to save duplicate
372 * keys to the hash table. This function can be used to find all keys
373 * and contexts from the hash table that are found using the `key'. The
374 * `foreach' is called for every found key. If no entries can be found
375 * the `foreach' will be called once with the context set NULL and
376 * `key' and `user_context' sent to the function.
380 * The hash table will not be rehashed during the traversing of the table,
381 * even if the table was marked as auto rehashable. The caller also must
382 * not call silc_hash_table_rehash while traversing the table.
385 void silc_hash_table_find_foreach(SilcHashTable ht, void *key,
386 SilcHashForeach foreach, void *user_context);
388 /****f* silcutil/SilcHashTableAPI/silc_hash_table_foreach
392 * void silc_hash_table_foreach(SilcHashTable ht, SilcHashForeach foreach,
393 * void *user_context);
397 * Traverse all entrys in the hash table and call the `foreach' for
398 * every entry with the `user_context' context.
402 * The hash table will not be rehashed during the traversing of the table,
403 * even if the table was marked as auto rehashable. The caller also must
404 * not call silc_hash_table_rehash while traversing the table.
407 void silc_hash_table_foreach(SilcHashTable ht, SilcHashForeach foreach,
410 /****f* silcutil/SilcHashTableAPI/silc_hash_table_rehash
414 * void silc_hash_table_rehash(SilcHashTable ht, SilcUInt32 new_size);
418 * Rehashs the hash table. The size of the new hash table is provided
419 * as `new_size'. If the `new_size' is zero then this routine will make
420 * the new table of a suitable size. Note that this operation may be
424 void silc_hash_table_rehash(SilcHashTable ht, SilcUInt32 new_size);
426 /****f* silcutil/SilcHashTableAPI/silc_hash_table_list
430 * void silc_hash_table_list(SilcHashTable ht, SilcHashTableList *htl);
434 * Prepares the `htl' SilcHashTableList sent as argument to be used in the
435 * hash table traversing with the silc_hash_table_get. After the hash
436 * table traversing is completed the silc_hash_table_list_reset must be
441 * The hash table will not be rehashed during the traversing of the list,
442 * even if the table was marked as auto rehashable. The caller also must
443 * not call silc_hash_table_rehash while traversing the list.
446 void silc_hash_table_list(SilcHashTable ht, SilcHashTableList *htl);
448 /****f* silcutil/SilcHashTableAPI/silc_hash_table_list_reset
452 * void silc_hash_table_list_reset(SilcHashTableList *htl);
456 * Resets the `htl' SilcHashTableList. This must be called after the
457 * hash table traversing is completed.
460 void silc_hash_table_list_reset(SilcHashTableList *htl);
462 /****f* silcutil/SilcHashTableAPI/silc_hash_table_get
466 * SilcBool silc_hash_table_get(SilcHashTableList *htl, void **key,
471 * Returns always the next entry in the hash table into the `key' and
472 * `context' and TRUE. If this returns FALSE then there are no more
477 * SilcHashTableList htl;
478 * silc_hash_table_list(hash_table, &htl);
479 * while (silc_hash_table_get(&htl, (void *)&key, (void *)&context))
481 * silc_hash_table_list_reset(&htl);
484 SilcBool silc_hash_table_get(SilcHashTableList *htl,
485 void **key, void **context);
488 /* Extended hash table interface (same as above but with specific
489 hash and comparison functions). */
491 /****f* silcutil/SilcHashTableAPI/silc_hash_table_add_ext
495 * SilcBool silc_hash_table_add_ext(SilcHashTable ht, void *key,
497 * SilcHashFunction hash,
498 * void *hash_user_context);
502 * Adds new entry to the hash table. The `key' is hashed using the
503 * hash function and the both `key' and `context' will be saved to the
504 * hash table. This function quarantees that the entry is always added
505 * to the hash table reliably (it is collision resistant).
507 * The `hash' and `hash_user_context' are application specified hash
508 * function. If not provided the hash table's default is used.
511 SilcBool silc_hash_table_add_ext(SilcHashTable ht,
512 void *key, void *context,
513 SilcHashFunction hash,
514 void *hash_user_context);
516 /****f* silcutil/SilcHashTableAPI/silc_hash_table_set_ext
520 * SilcBool silc_hash_table_set_ext(SilcHashTable ht, void *key,
522 * SilcHashFunction hash,
523 * void *hash_user_context);
527 * Same as silc_hash_table_add_ext but if the `key' already exists in the
528 * hash table the old key and the old context will be replaced with the
529 * `key' and the `context. The destructor function will be called for the
530 * replaced key and context.
532 * The `hash' and `hash_user_context' are application specified hash
533 * function. If not provided the hash table's default is used.
536 SilcBool silc_hash_table_set_ext(SilcHashTable ht,
537 void *key, void *context,
538 SilcHashFunction hash,
539 void *hash_user_context);
541 /****f* silcutil/SilcHashTableAPI/silc_hash_table_del_ext
545 * SilcBool silc_hash_table_del_ext(SilcHashTable ht, void *key,
546 * SilcHashFunction hash,
547 * void *hash_user_context,
548 * SilcHashCompare compare,
549 * void *compare_user_context,
550 * SilcHashDestructor destructor,
551 * void *destructor_user_context);
555 * Removes the entry from the hash table by the provided `key'. This will
556 * call the destructor funtion for the found entry. Return TRUE if the
557 * entry was removed successfully and FALSE otherwise.
559 * The `hash' and `hash_user_context' are application specified hash
560 * function. If not provided the hash table's default is used.
561 * The `compare' and `compare_user_context' are application specified
562 * comparing function. If not provided the hash table's default is used.
563 * The `destructor' and `destructor_user_context' are application
564 * specific destructor function.
567 SilcBool silc_hash_table_del_ext(SilcHashTable ht, void *key,
568 SilcHashFunction hash,
569 void *hash_user_context,
570 SilcHashCompare compare,
571 void *compare_user_context,
572 SilcHashDestructor destructor,
573 void *destructor_user_context);
575 /****f* silcutil/SilcHashTableAPI/silc_hash_table_del_by_context_ext
580 * silc_hash_table_del_by_context_ext(SilcHashTable ht, void *key,
582 * SilcHashFunction hash,
583 * void *hash_user_context,
584 * SilcHashCompare compare,
585 * void *compare_user_context,
586 * SilcHashDestructor destructor,
587 * void *destructor_user_context);
591 * Same as silc_hash_table_del but verifies that the context associated
592 * with the `key' matches the `context'. This is handy to use with hash
593 * tables that may have duplicate keys. In that case the `context' may
594 * be used to check whether the correct entry is being deleted.
596 * The `hash' and `hash_user_context' are application specified hash
597 * function. If not provided the hash table's default is used.
598 * The `compare' and `compare_user_context' are application specified
599 * comparing function. If not provided the hash table's default is used.
600 * The `destructor' and `destructor_user_context' are application
601 * specific destructor function.
604 SilcBool silc_hash_table_del_by_context_ext(SilcHashTable ht, void *key,
606 SilcHashFunction hash,
607 void *hash_user_context,
608 SilcHashCompare compare,
609 void *compare_user_context,
610 SilcHashDestructor destructor,
611 void *destructor_user_context);
613 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find_ext
617 * SilcBool silc_hash_table_find_ext(SilcHashTable ht, void *key,
618 * void **ret_key, void **ret_context,
619 * SilcHashFunction hash,
620 * void *hash_user_context,
621 * SilcHashCompare compare,
622 * void *compare_user_context);
626 * Finds the entry in the hash table by the provided `key' as fast as
627 * possible. Return TRUE if the entry was found and FALSE otherwise.
628 * The found entry is returned to the `ret_key' and `ret_context',
629 * respectively. If the `ret_key and `ret_context' are NULL then this
630 * maybe used only to check whether given key exists in the table.
632 * The `hash' and `hash_user_context' are application specified hash
633 * function. If not provided the hash table's default is used.
634 * The `compare' and `compare_user_context' are application specified
635 * comparing function. If not provided the hash table's default is used.
638 SilcBool silc_hash_table_find_ext(SilcHashTable ht, void *key,
639 void **ret_key, void **ret_context,
640 SilcHashFunction hash,
641 void *hash_user_context,
642 SilcHashCompare compare,
643 void *compare_user_context);
645 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find_by_context_ext
650 * silc_hash_table_find_by_context_ext(SilcHashTable ht, void *key,
651 * void *context, void **ret_key,
652 * SilcHashFunction hash,
653 * void *hash_user_context,
654 * SilcHashCompare compare,
655 * void *compare_user_context);
659 * Finds the entry in the hash table by the provided `key' and
660 * `context' as fast as possible. This is handy function when there
661 * can be multiple same keys in the hash table. By using this function
662 * the specific key with specific context can be found. Return
663 * TRUE if the entry with the key and context was found and FALSE
664 * otherwise. The function returns only the key to `ret_key' since
665 * the caller already knows the context.
667 * The `hash' and `hash_user_context' are application specified hash
668 * function. If not provided the hash table's default is used.
669 * The `compare' and `compare_user_context' are application specified
670 * comparing function. If not provided the hash table's default is used.
673 SilcBool silc_hash_table_find_by_context_ext(SilcHashTable ht, void *key,
674 void *context, void **ret_key,
675 SilcHashFunction hash,
676 void *hash_user_context,
677 SilcHashCompare compare,
678 void *compare_user_context);
680 /****f* silcutil/SilcHashTableAPI/silc_hash_table_find_foreach_ext
684 * void silc_hash_table_find_foreach_ext(SilcHashTable ht, void *key,
685 * SilcHashFunction hash,
686 * void *hash_user_context,
687 * SilcHashCompare compare,
688 * void *compare_user_context,
689 * SilcHashForeach foreach,
690 * void *foreach_user_context);
694 * As the hash table is collision resistant it is possible to save duplicate
695 * keys to the hash table. This function can be used to find all keys
696 * and contexts from the hash table that are found using the `key'. The
697 * `foreach' is called for every found key. If no entries can be found
698 * the `foreach' will be called once with the context set NULL and
699 * `key' and `user_context' sent to the function.
701 * The `hash' and `hash_user_context' are application specified hash
702 * function. If not provided the hash table's default is used.
703 * The `compare' and `compare_user_context' are application specified
704 * comparing function. If not provided the hash table's default is used.
708 * The hash table will not be rehashed during the traversing of the table,
709 * even if the table was marked as auto rehashable. The caller also must
710 * not call silc_hash_table_rehash while traversing the table.
713 void silc_hash_table_find_foreach_ext(SilcHashTable ht, void *key,
714 SilcHashFunction hash,
715 void *hash_user_context,
716 SilcHashCompare compare,
717 void *compare_user_context,
718 SilcHashForeach foreach,
719 void *foreach_user_context);
721 /****f* silcutil/SilcHashTableAPI/silc_hash_table_rehash_ext
725 * void silc_hash_table_rehash_ext(SilcHashTable ht, SilcUInt32 new_size,
726 * SilcHashFunction hash,
727 * void *hash_user_context);
731 * Rehashs the hash table. The size of the new hash table is provided
732 * as `new_size'. If the `new_size' is zero then this routine will make
733 * the new table of a suitable size. Note that this operation may be
736 * The `hash' and `hash_user_context' are application specified hash
737 * function. If not provided the hash table's default is used.
740 void silc_hash_table_rehash_ext(SilcHashTable ht, SilcUInt32 new_size,
741 SilcHashFunction hash,
742 void *hash_user_context);
746 /****f* silcutil/SilcHashTableAPI/silc_hash_string
750 * SilcUInt32 silc_hash_string(void *key, void *user_context);
754 * Basic hash function to hash strings. May be used with the SilcHashTable.
755 * This uses Bob Jenkin's one-at-a-time (described in Wikipedia) hash
759 SilcUInt32 silc_hash_string(void *key, void *user_context);
761 /****f* silcutil/SilcHashTableAPI/silc_hash_string_case
765 * SilcUInt32 silc_hash_string_case(void *key, void *user_context);
769 * Basic hash function to hash strings. May be used with the SilcHashTable.
770 * This ignores the string's case, ie. 'Foo' and 'foo' will hash to same
771 * value. This uses Bob Jenkin's one-at-a-time (described in Wikipedia)
775 SilcUInt32 silc_hash_string_case(void *key, void *user_context);
777 /****f* silcutil/SilcHashTableAPI/silc_hash_utf8_string
781 * SilcUInt32 silc_hash_utf8_string(void *key, void *user_context);
785 * Basic has function to hash UTF-8 strings. May be used with the
786 * SilcHashTable. Used with identifier strings. The key is
787 * expected to be casefolded.
790 SilcUInt32 silc_hash_utf8_string(void *key, void *user_context);
792 /****f* silcutil/SilcHashTableAPI/silc_hash_uint
796 * SilcUInt32 silc_hash_uint(void *key, void *user_context);
800 * Basic hash function to hash integers. May be used with the SilcHashTable.
801 * Comparison function is not needed, the SilcHashTable will automatically
802 * compare integer values.
805 SilcUInt32 silc_hash_uint(void *key, void *user_context);
807 /****f* silcutil/SilcHashTableAPI/silc_hash_ptr
811 * SilcUInt32 silc_hash_ptr(void *key, void *user_context);
815 * Basic hash funtion to hash pointers. May be used with the SilcHashTable.
816 * Comparison function is not needed, the SilcHashTable will automatically
817 * compare pointer values.
820 SilcUInt32 silc_hash_ptr(void *key, void *user_context);
822 /****f* silcutil/SilcHashTableAPI/silc_hash_data
826 * SilcUInt32 silc_hash_data(void *key, void *user_context);
830 * Hash binary data. The `user_context' is the data length. This uses Bob
831 * Jenkin's one-at-a-time (described in Wikipedia) hash function.
834 SilcUInt32 silc_hash_data(void *key, void *user_context);
836 /* Comparison functions */
838 /****f* silcutil/SilcHashTableAPI/silc_hash_string_compare
842 * SilcBool silc_hash_string_compare(void *key1, void *key2,
843 * void *user_context);
847 * Compares two strings. It may be used as SilcHashTable comparison
851 SilcBool silc_hash_string_compare(void *key1, void *key2, void *user_context);
853 /****f* silcutil/SilcHashTableAPI/silc_hash_string_case_compare
857 * SilcBool silc_hash_string_case_compare(void *key1, void *key2,
858 * void *user_context);
862 * Compares two strings. This ignores the case while comparing. It may
863 * be used as SilcHashTable comparison function.
866 SilcBool silc_hash_string_case_compare(void *key1, void *key2,
869 /****f* silcutil/SilcHashTableAPI/silc_hash_utf8_compare
873 * SilcBool silc_hash_utf8_compare(void *key1, void *key2,
874 * void *user_context);
878 * Compares UTF-8 strings. Casefolded and NULL terminated strings are
879 * expected. May be used as SilcHashTable comparison function.
882 SilcBool silc_hash_utf8_compare(void *key1, void *key2, void *user_context);
884 /****f* silcutil/SilcHashTableAPI/silc_hash_data_compare
888 * SilcBool silc_hash_data_compare(void *key1, void *key2,
889 * void *user_context);
893 * Compares binary data. May be used as SilcHashTable comparison function.
896 SilcBool silc_hash_data_compare(void *key1, void *key2, void *user_context);