summaryrefslogtreecommitdiff
path: root/src/libstrongswan/collections/hashtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/collections/hashtable.h')
-rw-r--r--src/libstrongswan/collections/hashtable.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libstrongswan/collections/hashtable.h b/src/libstrongswan/collections/hashtable.h
index 520a86c90..0a7ebeb65 100644
--- a/src/libstrongswan/collections/hashtable.h
+++ b/src/libstrongswan/collections/hashtable.h
@@ -31,7 +31,7 @@ typedef struct hashtable_t hashtable_t;
* @param key key to hash
* @return hash code
*/
-typedef u_int (*hashtable_hash_t)(void *key);
+typedef u_int (*hashtable_hash_t)(const void *key);
/**
* Hashtable hash function calculation the hash solely based on the key pointer.
@@ -39,7 +39,7 @@ typedef u_int (*hashtable_hash_t)(void *key);
* @param key key to hash
* @return hash of key
*/
-u_int hashtable_hash_ptr(void *key);
+u_int hashtable_hash_ptr(const void *key);
/**
* Hashtable hash function calculation the hash for char* keys.
@@ -47,7 +47,7 @@ u_int hashtable_hash_ptr(void *key);
* @param key key to hash, a char*
* @return hash of key
*/
-u_int hashtable_hash_str(void *key);
+u_int hashtable_hash_str(const void *key);
/**
* Prototype for a function that compares the two keys for equality.
@@ -56,7 +56,7 @@ u_int hashtable_hash_str(void *key);
* @param other_key second key
* @return TRUE if the keys are equal
*/
-typedef bool (*hashtable_equals_t)(void *key, void *other_key);
+typedef bool (*hashtable_equals_t)(const void *key, const void *other_key);
/**
* Hashtable equals function comparing pointers.
@@ -65,7 +65,7 @@ typedef bool (*hashtable_equals_t)(void *key, void *other_key);
* @param other_key other key to compare
* @return TRUE if key == other_key
*/
-bool hashtable_equals_ptr(void *key, void *other_key);
+bool hashtable_equals_ptr(const void *key, const void *other_key);
/**
* Hashtable equals function comparing char* keys.
@@ -74,7 +74,7 @@ bool hashtable_equals_ptr(void *key, void *other_key);
* @param other_key other key to compare
* @return TRUE if streq(key, other_key)
*/
-bool hashtable_equals_str(void *key, void *other_key);
+bool hashtable_equals_str(const void *key, const void *other_key);
/**
* Class implementing a hash table.
@@ -100,7 +100,7 @@ struct hashtable_t {
* @param value the value to store
* @return NULL if no item was replaced, the old value otherwise
*/
- void *(*put) (hashtable_t *this, void *key, void *value);
+ void *(*put) (hashtable_t *this, const void *key, void *value);
/**
* Returns the value with the given key, if the hash table contains such an
@@ -109,7 +109,7 @@ struct hashtable_t {
* @param key the key of the requested value
* @return the value, NULL if not found
*/
- void *(*get) (hashtable_t *this, void *key);
+ void *(*get) (hashtable_t *this, const void *key);
/**
* Returns the value with a matching key, if the hash table contains such an
@@ -125,7 +125,8 @@ struct hashtable_t {
* @param match match function to be used when comparing keys
* @return the value, NULL if not found
*/
- void *(*get_match) (hashtable_t *this, void *key, hashtable_equals_t match);
+ void *(*get_match) (hashtable_t *this, const void *key,
+ hashtable_equals_t match);
/**
* Removes the value with the given key from the hash table and returns the
@@ -134,7 +135,7 @@ struct hashtable_t {
* @param key the key of the value to remove
* @return the removed value, NULL if not found
*/
- void *(*remove) (hashtable_t *this, void *key);
+ void *(*remove) (hashtable_t *this, const void *key);
/**
* Removes the key and value pair from the hash table at which the given