summaryrefslogtreecommitdiff
path: root/accel-pppd/pwdb.h
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-09-20 12:18:49 +0400
committerDmitry Kozlov <xeb@mail.ru>2014-09-20 12:18:49 +0400
commit62e89248160d3592c2d754fcaa15e37586a5b091 (patch)
treea6513cfd1e8ef6c6079ea2436e8573b122cc1ec6 /accel-pppd/pwdb.h
parent0a58c20b44136c1fba996becea18696b3f67a1f9 (diff)
downloadaccel-ppp-62e89248160d3592c2d754fcaa15e37586a5b091.tar.gz
accel-ppp-62e89248160d3592c2d754fcaa15e37586a5b091.zip
rewrite of authentication/accounting procedures
This patch gets rid of synchronuos style of authentication/accounting. Synchronous style of authentication/accounting produced sleeping threads which becomes a problem when lots of sessions started/stopped and all they want authorization/accounting.
Diffstat (limited to 'accel-pppd/pwdb.h')
-rw-r--r--accel-pppd/pwdb.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/accel-pppd/pwdb.h b/accel-pppd/pwdb.h
index f7d62d6a..7618bbc6 100644
--- a/accel-pppd/pwdb.h
+++ b/accel-pppd/pwdb.h
@@ -12,16 +12,18 @@ struct ap_session;
#define PWDB_SUCCESS 0
#define PWDB_DENIED 1
-#define PWDB_NO_IMPL 2
+#define PWDB_WAIT 2
+#define PWDB_NO_IMPL 3
-struct pwdb_t
-{
+typedef void (*pwdb_callback)(void *arg, int res);
+
+struct pwdb_t {
struct list_head entry;
- int (*check)(struct pwdb_t *, struct ap_session *, const char *username, int type, va_list args);
+ int (*check)(struct pwdb_t *, struct ap_session *, pwdb_callback cb, void *cb_arg, const char *username, int type, va_list args);
char* (*get_passwd)(struct pwdb_t *, struct ap_session *, const char *username);
};
-int pwdb_check(struct ap_session *, const char *username, int type, ...);
+int pwdb_check(struct ap_session *, pwdb_callback cb, void *cb_arg, const char *username, int type, ...);
char *pwdb_get_passwd(struct ap_session *, const char *username);
void pwdb_register(struct pwdb_t *);