第76行: 第76行:
 
     myfriend [(int uid, char *fexp)]
 
     myfriend [(int uid, char *fexp)]
 
     hisfriend [(int uid,struct user_info* him)]
 
     hisfriend [(int uid,struct user_info* him)]
 +
 +
== ucache.c ==
 +
 +
; ucache_lock
 +
; ucache_unlock [(int fd)]
 +
 +
    ucache_hashinit
 +
    ucache_hash_deep [(const char *userid)]
 +
    ucache_hash [(const char *userid)]
 +
 +
    fillucache [(struct userec *uentp, int *number, int *prev)]
 +
    flush_ucache
 +
    load_ucache
 +
 +
; resolve_ucache
 +
* UCache.Init()
 +
 +
    detach_ucache
 +
 +
    getuserid [(char *userid, int uid)]
 +
 +
    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)]
 +
    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)]
 +
    do_after_logout [(struct userec* user,struct user_info* userinfo,int unum,int mode)]
 +
 +
=== 自定义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

2012年1月30日 (一) 08:54的版本

BBS的用户相关的东西。这块非常复杂,分成好几个部分。

UTMP

UTMPHEAD

struct UTMPHEAD {
    int next[USHM_SIZE];
    int hashhead[UTMP_HASHSIZE + 1];    /* use UCACHE_HASHSIZE/32 */
    int number;
    int listhead;
    int list_prev[USHM_SIZE];   /* sorted list prev ptr */
    int list_next[USHM_SIZE];   /* sorted list next ptr */
    time_t uptime;
};

static struct UTMPHEAD *utmphead;

utmphead其实指向一块shared memory,key = UTMP_SHMKEY

UTMPHEAD结构/数据由UtmpHead类处理,全都为GetXXX/SetXXX形式。

utmp.c

get_utmpshm_addr()
  • Utmp.utmpshm
longlock [(int signo)]
  • inside Utmp.Lock()
utmp_lock
  • Utmp.Lock()
utmp_unlock [(int fd)]
  • Utmp.Unlock()
utmp_setreadonly [(int readonly)]
  • UtmpHead.SetReadOnly()
detach_utmp

仅在WWW中使用。

resolve_utmp
  • Utmp.Init()
utmp_hash [(const char *userid)]
  • Utmp.Hash()
   logloop
getnewutmpent [(struct user_info *up)]
  • Utmp.GetNewUtmpEntry()
getnewutmpent2 [(struct user_info *up)]

仅在WWW中使用。

   rebuild_list [(struct user_info *up, char *arg, int p)]
   apply_ulist [(APPLY_UTMP_FUNC fptr, void *arg)]
   apply_ulist_addr [(APPLY_UTMP_FUNC fptr, void *arg)]
   apply_utmpuid [(APPLY_UTMP_FUNC fptr, int uid, void *arg)]
   apply_utmp [(APPLY_UTMP_FUNC fptr, int maxcount,const char *userid, void *arg)]
   search_ulist [(struct user_info *uentp, int (*fptr) (int, struct user_info *), int farg)]
clear_utmp2 [(int uent)]
  • Utmp.Clear()
   clear_utmp [(int uent, int useridx, int pid)]
get_utmp_number
  • UtmpHead.GetNumber()
   get_utmpent [(int utmpnum)]
   get_utmpent_num [(struct user_info *uent)]
   cmpfuid [(const void*a,const void*b)]
   getfriendstr [(struct userec* user,struct user_info* puinfo)]
   myfriend [(int uid, char *fexp)]
   hisfriend [(int uid,struct user_info* him)]

ucache.c

ucache_lock
ucache_unlock [(int fd)]
   ucache_hashinit
   ucache_hash_deep [(const char *userid)]
   ucache_hash [(const char *userid)]
   fillucache [(struct userec *uentp, int *number, int *prev)]
   flush_ucache
   load_ucache
resolve_ucache
  • UCache.Init()
   detach_ucache
   getuserid [(char *userid, int uid)]
   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)]
   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)]
   do_after_logout [(struct userec* user,struct user_info* userinfo,int unum,int mode)]

自定义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