summaryrefslogtreecommitdiffstats
path: root/authdb.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-09-14 14:59:38 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-09-14 14:59:38 +0300
commit84354c50f807607700b95debdd3a7ddfde0c09f9 (patch)
tree56065d6d7a34b45a6cbb5eef662ae1f1bad64484 /authdb.h
parent4be1e8fd5e352a54e87a81979d5ad303efdcbffe (diff)
downloadsquark-84354c50f807607700b95debdd3a7ddfde0c09f9.tar.bz2
squark-84354c50f807607700b95debdd3a7ddfde0c09f9.tar.xz
authdb: use configuration file to decide blocked categories
and cache the information to authdb properly.
Diffstat (limited to 'authdb.h')
-rw-r--r--authdb.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/authdb.h b/authdb.h
index 29000bd..7bfa2f4 100644
--- a/authdb.h
+++ b/authdb.h
@@ -8,8 +8,18 @@
#define AUTHDB_IP_HASH_SIZE 64
+struct sqdb;
struct authdb_map_entry;
+struct authdb_config {
+ struct sqdb *db;
+ time_t last_check;
+ time_t last_change;
+ uint64_t block_categories;
+ uint64_t hard_block_categories;
+ blob_t redirect_url_base;
+};
+
struct authdb {
struct authdb_map_entry *hash_bucket[AUTHDB_IP_HASH_SIZE];
};
@@ -35,7 +45,7 @@ struct authdb_map_entry {
struct authdb_entry * entries;
};
-int authdb_open(struct authdb *adb);
+int authdb_open(struct authdb *adb, struct authdb_config *adbc, struct sqdb *db);
void authdb_close(struct authdb *adb);
void *authdb_get(struct authdb *adb, sockaddr_any *addr, struct authdb_entry *entry, int create);
@@ -43,8 +53,10 @@ void *authdb_get(struct authdb *adb, sockaddr_any *addr, struct authdb_entry *en
void authdb_clear_entry(struct authdb_entry *entry);
int authdb_set(void *token, struct authdb_entry *entry);
int authdb_check_login(void *token, struct authdb_entry *e, blob_t username, time_t now);
-void authdb_commit_login(void *token, struct authdb_entry *e, time_t now);
+void authdb_commit_login(void *token, struct authdb_entry *e, time_t now, struct authdb_config *cfg);
void authdb_commit_logout(void *token);
void authdb_commit_override(void *token, struct authdb_entry *entry, time_t now);
+int adbc_refresh(struct authdb_config *cfg, time_t now);
+
#endif