pwd.h

00001 /*
00002  * Copyright (c) 2005-2012 by KoanLogic s.r.l. - All rights reserved.
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 
00015 /* forward decls */
00016 struct u_pwd_s;
00017 struct u_pwd_rec_s;
00018 
00026 #ifndef U_PWD_LINE_MAX
00027 #define U_PWD_LINE_MAX  256
00028 #endif  /* !U_PWD_LINE_MAX */
00029 
00031 typedef struct u_pwd_s u_pwd_t;
00032 
00034 typedef struct u_pwd_rec_s u_pwd_rec_t;
00035 
00038 typedef int (*u_pwd_hash_cb_t) (const char *, size_t, char []);
00039 
00042 typedef char *(*u_pwd_load_cb_t) (char *, int, void *);
00043 
00047 typedef int (*u_pwd_open_cb_t) (const char *, void **);
00048 
00049 /* \brief   Master password DB close callback prototype: takes the resource 
00050  *          handler, return nothing */
00051 typedef void (*u_pwd_close_cb_t) (void *);
00052 
00056 typedef int (*u_pwd_notify_cb_t) (const char *, time_t, time_t *);
00057 
00062 /* interface */
00063 int u_pwd_init (const char *res_uri, u_pwd_open_cb_t cb_open, 
00064         u_pwd_load_cb_t cb_load, u_pwd_close_cb_t cb_close, 
00065         u_pwd_notify_cb_t cb_notify, u_pwd_hash_cb_t cb_hash, 
00066         size_t hash_len, int in_memory, u_pwd_t **ppwd);
00067 int u_pwd_init_file (const char *res_uri, u_pwd_hash_cb_t cb_hash, 
00068         size_t hash_len, int in_memory, u_pwd_t **ppwd);
00069 void u_pwd_term (u_pwd_t *pwd);
00070 int u_pwd_in_memory (u_pwd_t *pwd);
00071 int u_pwd_retr (u_pwd_t *pwd, const char *user, u_pwd_rec_t **prec);
00072 int u_pwd_auth_user (u_pwd_t *pwd, const char *user, const char *password);
00073 void u_pwd_rec_free (u_pwd_t *pwd, u_pwd_rec_t *rec);
00074 const char *u_pwd_rec_get_user (u_pwd_rec_t *rec);
00075 const char *u_pwd_rec_get_password (u_pwd_rec_t *rec);
00076 const char *u_pwd_rec_get_opaque (u_pwd_rec_t *rec);
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif /* !_U_PWD_H_ */

←Products
© 2005-2012 - KoanLogic S.r.l. - All rights reserved