第63行: 第63行:
 
; ucache_unlock [(int fd)]
 
; ucache_unlock [(int fd)]
  
 +
=== Hash相关 ===
 
     ucache_hashinit
 
     ucache_hashinit
 
     ucache_hash_deep [(const char *userid)]
 
     ucache_hash_deep [(const char *userid)]
    ucache_hash [(const char *userid)]
 
  
 +
; ucache_hash [(const char *userid)]
 +
* UCache.Hash()
 +
 +
=== ucache初始化 ===
 
     fillucache [(struct userec *uentp, int *number, int *prev)]
 
     fillucache [(struct userec *uentp, int *number, int *prev)]
 
     flush_ucache
 
     flush_ucache
第76行: 第80行:
 
     detach_ucache
 
     detach_ucache
  
    getuserid [(char *userid, int uid)]
+
=== 用户ID相关 ===
 +
 
 +
; getuserid [(char *userid, int uid)]
 +
* UserRecord.GetUserId()
  
 
     setuserid_internal [(int num, const char *userid)]
 
     setuserid_internal [(int num, const char *userid)]
第102行: 第109行:
 
     save_giveupinfo [(struct userec* lookupuser,int lcount,int s[10][2])]
 
     save_giveupinfo [(struct userec* lookupuser,int lcount,int s[10][2])]
 
     setcachehomefile [(char* path,const char* user,int unum,char* file)]
 
     setcachehomefile [(char* path,const char* user,int unum,char* file)]
 +
 +
=== TMPFS相关 ===
 
     init_cachedata [(const char* userid,int unum)]
 
     init_cachedata [(const char* userid,int unum)]
 
     flush_cachedata [(const char* userid)]
 
     flush_cachedata [(const char* userid)]
 
     clean_cachedata [(const char* userid,int unum)]
 
     clean_cachedata [(const char* userid,int unum)]
    do_after_login [(struct userec* user,int unum,int mode)]
+
 
    do_after_logout [(struct userec* user,struct user_info* userinfo,int unum,int mode)]
+
=== 登录/注销 ===
 +
 
 +
; do_after_login [(struct userec* user,int unum,int mode)]
 +
: 不使用TMPFS时可以忽略
 +
 
 +
; do_after_logout [(struct userec* user,struct user_info* userinfo,int unum,int mode)]
 +
* UCache.DoAfterLogout() '''尚未实现'''
 +
: 清理工作
  
 
=== 自定义User Title相关 ===
 
=== 自定义User Title相关 ===

2012年2月6日 (一) 04:54的最新版本


User Record

一个用户的信息,所有登录共用的。

struct userec {                 /* Structure used to hold information in */
    char userid[IDLEN + 2];     /* PASSFILE */
    char flags; /*一些标志,戒网,版面排序之类的*/
    unsigned char title; /*用户级别*/
    time_t firstlogin;
    char lasthost[16];
    unsigned int numlogins;
    unsigned int numposts;
#ifdef CONV_PASS
    char passwd[OLDPASSLEN];
	char unused_padding[2];
#endif
    char username[NAMELEN];
    unsigned int club_read_rights[MAXCLUB>>5];
    unsigned int club_write_rights[MAXCLUB>>5];
    unsigned char md5passwd[MD5PASSLEN];
    unsigned userlevel;
    time_t lastlogin;
    time_t stay;
    int signature;
    unsigned int userdefine[2];
    time_t notedate;
    int noteline;
    int notemode;
    time_t exittime;
	/* 生日数据转移到 userdata 结构中 */
    unsigned int usedspace;     /* used space of user's mailbox, in bytes */
#ifdef HAVE_USERMONEY
    int money;
    int score;
    char unused[20];
#endif
};


struct UCACHE {
    ucache_hashtable hashtable;
    ucache_hashtable hashusage;
    int hashhead[UCACHE_HASHSIZE + 1];
    int next[MAXUSERS];
    time_t uptime;
    int number;
#ifdef HAVE_CUSTOM_USER_TITLE
    char user_title[255][USER_TITLE_LEN]; //定义用户的称号字符串。
#endif
    struct userec passwd[MAXUSERS];
};

static struct UCACHE *uidshm = NULL;


ucache.c

ucache_lock
ucache_unlock [(int fd)]

Hash相关

   ucache_hashinit
   ucache_hash_deep [(const char *userid)]
ucache_hash [(const char *userid)]
  • UCache.Hash()

ucache初始化

   fillucache [(struct userec *uentp, int *number, int *prev)]
   flush_ucache
   load_ucache
resolve_ucache
  • UCache.Init()
   detach_ucache

用户ID相关

getuserid [(char *userid, int uid)]
  • UserRecord.GetUserId()
   setuserid_internal [(int num, const char *userid)]
   setuserid2 [(int num, const char *userid)]
   setuserid [(int num, const char *userid)]
   searchnewuser
searchuser [(const char *userid)]
  • UCache.SearchUser()
getuser [(const char *userid, struct userec **user)]
  • UCache.GetUser()
   getuserid2 [(int uid)]
   u_namearray [(char buf[][IDLEN + 1], int *pnum, char *tag)]
   getnewuserid3 [(char *userid)]
   getnewuserid2 [(char *userid)]
getuserbynum [(int num)]
  • UCache.GetUserByUid()
   getnewuserid [(char *userid)]
   update_user [(struct userec *user, int num, int all)]
   apply_users [(int (*fptr) (struct userec *, char *), char *arg)]
   get_giveupinfo [(char* userid,int* basicperm,int s[10][2])]
   save_giveupinfo [(struct userec* lookupuser,int lcount,int s[10][2])]
   setcachehomefile [(char* path,const char* user,int unum,char* file)]

TMPFS相关

   init_cachedata [(const char* userid,int unum)]
   flush_cachedata [(const char* userid)]
   clean_cachedata [(const char* userid,int unum)]

登录/注销

do_after_login [(struct userec* user,int unum,int mode)]
不使用TMPFS时可以忽略
do_after_logout [(struct userec* user,struct user_info* userinfo,int unum,int mode)]
  • UCache.DoAfterLogout() 尚未实现
清理工作

自定义User Title相关

   load_user_title
   flush_user_title
   get_user_title [(unsigned char titleidx)]
   set_user_title [(unsigned char titleidx,char* newtitle)]

WWW相关

   longlock [(int signo)]
   www_guest_lock
   www_guest_unlock [(int fd)]
   resolve_guest_table