summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecp/server/acl.c20
-rw-r--r--ecp/server/acl.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/ecp/server/acl.c b/ecp/server/acl.c
index 7561af8..826b292 100644
--- a/ecp/server/acl.c
+++ b/ecp/server/acl.c
@@ -127,6 +127,16 @@ int acl_inlist(ecp_ecdh_public_t *public) {
return (item != NULL);
}
+unsigned int acl_count(void) {
+ unsigned int r = 0;
+
+ pthread_rwlock_rdlock(&acl_ht_rwlock);
+ if (acl_keys) r = ecp_ht_count(acl_keys);
+ pthread_rwlock_unlock(&acl_ht_rwlock);
+
+ return r;
+}
+
int acl_dir_inlist(ecp_ecdh_public_t *public) {
void *item = NULL;
@@ -137,6 +147,16 @@ int acl_dir_inlist(ecp_ecdh_public_t *public) {
return (item != NULL);
}
+unsigned int acl_dir_count(void) {
+ unsigned int r = 0;
+
+ pthread_rwlock_rdlock(&acl_ht_rwlock);
+ if (acl_keys) r = ecp_ht_count(acl_keys_dir);
+ pthread_rwlock_unlock(&acl_ht_rwlock);
+
+ return r;
+}
+
int acl_reset_ht(void) {
int rv = ECP_OK;
diff --git a/ecp/server/acl.h b/ecp/server/acl.h
index 5e3f83c..3724970 100644
--- a/ecp/server/acl.h
+++ b/ecp/server/acl.h
@@ -12,7 +12,9 @@ void acl_destroy_list(ACLItem *head);
int acl_add_key(ECPDirItem *dir_item);
int acl_inlist(ecp_ecdh_public_t *public);
+unsigned int acl_count(void);
int acl_dir_inlist(ecp_ecdh_public_t *public);
+unsigned int acl_dir_count(void);
int acl_reset_ht(void);
int acl_load_ht(void);