00001
00002
00003
00004
00005 #ifndef _U_PWD_H_
00006 #define _U_PWD_H_
00007
00008 #include <u/libu_conf.h>
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 #define U_PWD_LINE_MAX 256
00015
00016 struct u_pwd_s;
00017 typedef struct u_pwd_s u_pwd_t;
00018
00019 struct u_pwd_rec_s;
00020 typedef struct u_pwd_rec_s u_pwd_rec_t;
00021
00022
00023
00024 typedef int (*u_pwd_hash_cb_t) (const char *, size_t, char []);
00025
00026
00027
00028 typedef char *(*u_pwd_load_cb_t) (char *, int, void *);
00029
00030
00031
00032 typedef int (*u_pwd_open_cb_t) (const char *, void **);
00033
00034
00035
00036 typedef void (*u_pwd_close_cb_t) (void *);
00037
00038
00039
00040 typedef int (*u_pwd_notify_cb_t) (const char *, time_t, time_t *);
00041
00042
00043 int u_pwd_init (const char *res_uri, u_pwd_open_cb_t cb_open,
00044 u_pwd_load_cb_t cb_load, u_pwd_close_cb_t cb_close,
00045 u_pwd_notify_cb_t cb_notify, u_pwd_hash_cb_t cb_hash,
00046 size_t hash_len, int in_memory, u_pwd_t **ppwd);
00047 int u_pwd_init_file (const char *res_uri, u_pwd_hash_cb_t cb_hash,
00048 size_t hash_len, int in_memory, u_pwd_t **ppwd);
00049 void u_pwd_term (u_pwd_t *pwd);
00050 int u_pwd_in_memory (u_pwd_t *pwd);
00051 int u_pwd_retr (u_pwd_t *pwd, const char *user, u_pwd_rec_t **prec);
00052 int u_pwd_auth_user (u_pwd_t *pwd, const char *user, const char *password);
00053 void u_pwd_rec_free (u_pwd_t *pwd, u_pwd_rec_t *rec);
00054 const char *u_pwd_rec_get_user (u_pwd_rec_t *rec);
00055 const char *u_pwd_rec_get_password (u_pwd_rec_t *rec);
00056 const char *u_pwd_rec_get_opaque (u_pwd_rec_t *rec);
00057
00058 #ifdef __cplusplus
00059 }
00060 #endif
00061
00062 #endif