diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 21:54:45 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 21:54:45 +0200 |
commit | 810dde21ee65653c15606917b19566cfbaaf165e (patch) | |
tree | 4cd84b109e06660a9c59f2487822905e5672681e /ecp/src/ecp/htable/htable.c | |
parent | aee853a208d6abec53ec81dc4ef110b63e13342f (diff) |
ecp server added
Diffstat (limited to 'ecp/src/ecp/htable/htable.c')
-rw-r--r-- | ecp/src/ecp/htable/htable.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/ecp/src/ecp/htable/htable.c b/ecp/src/ecp/htable/htable.c index c0efebb..c22d2ab 100644 --- a/ecp/src/ecp/htable/htable.c +++ b/ecp/src/ecp/htable/htable.c @@ -1,9 +1,9 @@ #include <stdlib.h> -#include <core.h> -#include <cr.h> -#include <tr.h> -#include <ht.h> +#include <ecp/core.h> +#include <ecp/cr.h> +#include <ecp/tr.h> +#include <ecp/ht.h> ecp_ht_table_t *ecp_ht_create_keys(void) { return hashtable_create(1000, (unsigned int (*)(void *))ecp_ecdh_pub_hash, (int (*)(void *, void *))ecp_ecdh_pub_eq); @@ -17,7 +17,7 @@ void ecp_ht_destroy(ecp_ht_table_t *h) { hashtable_destroy(h, 0); } -int ecp_ht_insert(ecp_ht_table_t *h, void *k, ECPConnection *v) { +int ecp_ht_insert(ecp_ht_table_t *h, void *k, void *v) { int rv; rv = hashtable_insert(h, k, v); @@ -25,14 +25,26 @@ int ecp_ht_insert(ecp_ht_table_t *h, void *k, ECPConnection *v) { return ECP_OK; } -ECPConnection *ecp_ht_remove(ecp_ht_table_t *h, void *k) { +void *ecp_ht_remove(ecp_ht_table_t *h, void *k) { return hashtable_remove(h, k); } -ECPConnection *ecp_ht_search(ecp_ht_table_t *h, void *k) { +void *ecp_ht_remove_kv(ecp_ht_table_t *h, void *k, void *v) { + return hashtable_remove_kv(h, k, v); +} + +void *ecp_ht_search(ecp_ht_table_t *h, void *k) { return hashtable_search(h, k); } +void *ecp_ht_search_next(ecp_ht_table_t *h, void *k, void *v) { + return hashtable_search_next(h, k, v); +} + +unsigned int ecp_ht_count(ecp_ht_table_t *h) { + return hashtable_count(h); +} + void ecp_ht_itr_create(ecp_ht_itr_t *i, ecp_ht_table_t *h) { hashtable_iterator(i, h); } @@ -42,7 +54,7 @@ int ecp_ht_itr_advance(ecp_ht_itr_t *i) { rv = hashtable_iterator_advance(i); if (rv == 0) return ECP_ITR_END; - return rv; + return ECP_OK; } int ecp_ht_itr_remove(ecp_ht_itr_t *i) { @@ -65,6 +77,6 @@ void *ecp_ht_itr_key(ecp_ht_itr_t *i) { return hashtable_iterator_key(i); } -ECPConnection *ecp_ht_itr_value(ecp_ht_itr_t *i) { +void *ecp_ht_itr_value(ecp_ht_itr_t *i) { return hashtable_iterator_value(i); } |