Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 2003 Pekka Riikonen
+ Copyright (C) 2001 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
* SilcHashTableList structure and traverse the hash table inside while()
* using the list structure. Both are equally fast.
*
+ * The hash table is not thread safe. If same hash table context is used in
+ * multi thread environment concurrency control must be employed.
+ *
***/
#ifndef SILCHASHTABLE_H
* SYNOPSIS
*
* typedef SilcBool (*SilcHashCompare)(void *key1, void *key2,
- * void *user_context);
+ * void *user_context);
*
* DESCRIPTION
*
* to the callback.
*
***/
-typedef SilcBool (*SilcHashCompare)(void *key1, void *key2, void *user_context);
+typedef SilcBool (*SilcHashCompare)(void *key1, void *key2,
+ void *user_context);
/****f* silcutil/SilcHashTableAPI/SilcHashDestructor
*
*
* SYNOPSIS
*
- * void silc_hash_table_add(SilcHashTable ht, void *key, void *context);
+ * SilcBool silc_hash_table_add(SilcHashTable ht, void *key, void *context);
*
* DESCRIPTION
*
* to the hash table reliably (it is collision resistant).
*
***/
-void silc_hash_table_add(SilcHashTable ht, void *key, void *context);
+SilcBool silc_hash_table_add(SilcHashTable ht, void *key, void *context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_replace
*
* SYNOPSIS
*
- * void silc_hash_table_replace(SilcHashTable ht, void *key, void *context);
+ * SilcBool silc_hash_table_replace(SilcHashTable ht, void *key,
+ * void *context);
*
* DESCRIPTION
*
* replaced key and context.
*
***/
-void silc_hash_table_replace(SilcHashTable ht, void *key, void *context);
+SilcBool silc_hash_table_replace(SilcHashTable ht, void *key, void *context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_del
*
* SYNOPSIS
*
* SilcBool silc_hash_table_del_by_context(SilcHashTable ht, void *key,
- * void *context);
+ * void *context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_del_by_context(SilcHashTable ht, void *key,
- void *context);
+ void *context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find
*
* SYNOPSIS
*
* SilcBool silc_hash_table_find(SilcHashTable ht, void *key,
- * void **ret_key, void **ret_context);
+ * void **ret_key, void **ret_context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_find(SilcHashTable ht, void *key,
- void **ret_key, void **ret_context);
+ void **ret_key, void **ret_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find_by_context
*
* SYNOPSIS
*
* SilcBool silc_hash_table_find_by_context(SilcHashTable ht, void *key,
- * void *context, void **ret_key);
+ * void *context, void **ret_key);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_find_by_context(SilcHashTable ht, void *key,
- void *context, void **ret_key);
+ void *context, void **ret_key);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find_foreach
*
* SYNOPSIS
*
* SilcBool silc_hash_table_get(SilcHashTableList *htl, void **key,
- * void **context);
+ * void **context);
*
* DESCRIPTION
*
* any entrys.
*
***/
-SilcBool silc_hash_table_get(SilcHashTableList *htl, void **key, void **context);
+SilcBool silc_hash_table_get(SilcHashTableList *htl,
+ void **key, void **context);
/* Extended hash table interface (same as above but with specific
*
* SYNOPSIS
*
- * void silc_hash_table_add_ext(SilcHashTable ht, void *key, void *context,
- * SilcHashFunction hash,
- * void *hash_user_context);
+ * SilcBool silc_hash_table_add_ext(SilcHashTable ht, void *key,
+ * void *context,
+ * SilcHashFunction hash,
+ * void *hash_user_context);
*
* DESCRIPTION
*
* function. If not provided the hash table's default is used.
*
***/
-void silc_hash_table_add_ext(SilcHashTable ht, void *key, void *context,
- SilcHashFunction hash, void *hash_user_context);
+SilcBool silc_hash_table_add_ext(SilcHashTable ht,
+ void *key, void *context,
+ SilcHashFunction hash,
+ void *hash_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_replace_ext
*
* SYNOPSIS
*
- * void silc_hash_table_replace_ext(SilcHashTable ht, void *key,
- * void *context,
- * SilcHashFunction hash,
- * void *hash_user_context);
+ * SilcBool silc_hash_table_replace_ext(SilcHashTable ht, void *key,
+ * void *context,
+ * SilcHashFunction hash,
+ * void *hash_user_context);
*
* DESCRIPTION
*
* function. If not provided the hash table's default is used.
*
***/
-void silc_hash_table_replace_ext(SilcHashTable ht, void *key, void *context,
- SilcHashFunction hash,
- void *hash_user_context);
+SilcBool silc_hash_table_replace_ext(SilcHashTable ht,
+ void *key, void *context,
+ SilcHashFunction hash,
+ void *hash_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_del_ext
*
* SYNOPSIS
*
* SilcBool silc_hash_table_del_ext(SilcHashTable ht, void *key,
- * SilcHashFunction hash,
- * void *hash_user_context,
- * SilcHashCompare compare,
- * void *compare_user_context,
- * SilcHashDestructor destructor,
- * void *destructor_user_context);
+ * SilcHashFunction hash,
+ * void *hash_user_context,
+ * SilcHashCompare compare,
+ * void *compare_user_context,
+ * SilcHashDestructor destructor,
+ * void *destructor_user_context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_del_ext(SilcHashTable ht, void *key,
- SilcHashFunction hash,
- void *hash_user_context,
- SilcHashCompare compare,
- void *compare_user_context,
- SilcHashDestructor destructor,
- void *destructor_user_context);
+ SilcHashFunction hash,
+ void *hash_user_context,
+ SilcHashCompare compare,
+ void *compare_user_context,
+ SilcHashDestructor destructor,
+ void *destructor_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_del_by_context_ext
*
* SYNOPSIS
*
- * SilcBool silc_hash_table_del_by_context_ext(SilcHashTable ht, void *key,
- * void *context,
- * SilcHashFunction hash,
- * void *hash_user_context,
- * SilcHashCompare compare,
- * void *compare_user_context,
- * SilcHashDestructor destructor,
- * void *destructor_user_context);
+ * SilcBool
+ * silc_hash_table_del_by_context_ext(SilcHashTable ht, void *key,
+ * void *context,
+ * SilcHashFunction hash,
+ * void *hash_user_context,
+ * SilcHashCompare compare,
+ * void *compare_user_context,
+ * SilcHashDestructor destructor,
+ * void *destructor_user_context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_del_by_context_ext(SilcHashTable ht, void *key,
- void *context,
- SilcHashFunction hash,
- void *hash_user_context,
- SilcHashCompare compare,
- void *compare_user_context,
- SilcHashDestructor destructor,
- void *destructor_user_context);
+ void *context,
+ SilcHashFunction hash,
+ void *hash_user_context,
+ SilcHashCompare compare,
+ void *compare_user_context,
+ SilcHashDestructor destructor,
+ void *destructor_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find_ext
*
* SYNOPSIS
*
* SilcBool silc_hash_table_find_ext(SilcHashTable ht, void *key,
- * void **ret_key, void **ret_context,
- * SilcHashFunction hash,
- * void *hash_user_context,
- * SilcHashCompare compare,
- * void *compare_user_context);
+ * void **ret_key, void **ret_context,
+ * SilcHashFunction hash,
+ * void *hash_user_context,
+ * SilcHashCompare compare,
+ * void *compare_user_context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_find_ext(SilcHashTable ht, void *key,
- void **ret_key, void **ret_context,
- SilcHashFunction hash,
- void *hash_user_context,
- SilcHashCompare compare,
- void *compare_user_context);
+ void **ret_key, void **ret_context,
+ SilcHashFunction hash,
+ void *hash_user_context,
+ SilcHashCompare compare,
+ void *compare_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find_by_context_ext
*
* SYNOPSIS
*
- * SilcBool silc_hash_table_find_by_context_ext(SilcHashTable ht, void *key,
- * void *context, void **ret_key,
- * SilcHashFunction hash,
- * void *hash_user_context,
- * SilcHashCompare compare,
- * void *compare_user_context);
+ * SilcBool
+ * silc_hash_table_find_by_context_ext(SilcHashTable ht, void *key,
+ * void *context, void **ret_key,
+ * SilcHashFunction hash,
+ * void *hash_user_context,
+ * SilcHashCompare compare,
+ * void *compare_user_context);
*
* DESCRIPTION
*
*
***/
SilcBool silc_hash_table_find_by_context_ext(SilcHashTable ht, void *key,
- void *context, void **ret_key,
- SilcHashFunction hash,
- void *hash_user_context,
- SilcHashCompare compare,
- void *compare_user_context);
+ void *context, void **ret_key,
+ SilcHashFunction hash,
+ void *hash_user_context,
+ SilcHashCompare compare,
+ void *compare_user_context);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_find_foreach_ext
*