summaryrefslogtreecommitdiff
path: root/ecp/server/acl.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-05-14 23:01:20 +0200
committerUros Majstorovic <majstor@majstor.org>2024-05-14 23:01:20 +0200
commit5e5a5d426e2a26ca0f3370a5efd80e2f8e371cbf (patch)
tree0ccfe8f70674327f307b4ef1e43fa77e90abe4ce /ecp/server/acl.c
parent5903b0819664f473d1279de57e8b00d60d76ae0e (diff)
improved acl diagnostics
Diffstat (limited to 'ecp/server/acl.c')
-rw-r--r--ecp/server/acl.c20
1 files changed, 20 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;