]>
Commit | Line | Data |
---|---|---|
57583275 | 1 | #ifndef __AUTHEXT_H |
2 | #define __AUTHEXT_H | |
3 | ||
1a96a370 | 4 | #include "../irc/irc_config.h" |
0b0fb773 | 5 | #include "../lib/flags.h" |
92acf9ae CP |
6 | #include "../lib/ccassert.h" |
7 | ||
8 | #include <sys/types.h> | |
0b0fb773 | 9 | |
57583275 | 10 | #define MAXAUTHNAMEEXTS 5 |
11 | ||
92acf9ae CP |
12 | /* checking to see that u_int64_t == unsigned long long for strtoull */ |
13 | CCASSERT(sizeof(unsigned long long) == sizeof(u_int64_t)) | |
14 | ||
57583275 | 15 | struct nick; |
16 | ||
17 | typedef struct authname { | |
18 | unsigned long userid; | |
19 | int usercount; | |
20 | unsigned int marker; | |
21 | struct nick *nicks; | |
5a335041 CP |
22 | struct authname *next, *nextbyname; |
23 | unsigned int namebucket; | |
92acf9ae | 24 | u_int64_t flags; |
1a96a370 | 25 | char name[ACCOUNTLEN+1]; |
57583275 | 26 | /* These are extensions only used by other modules */ |
27 | void *exts[MAXAUTHNAMEEXTS]; | |
28 | } authname; | |
29 | ||
30 | #define AUTHNAMEHASHSIZE 60000 | |
31 | ||
32 | extern authname *authnametable[AUTHNAMEHASHSIZE]; | |
33 | ||
34 | /* Allocators */ | |
5a335041 | 35 | authname *newauthname(void); |
57583275 | 36 | void freeauthname (authname *hp); |
37 | ||
38 | /* EXT management */ | |
04b12064 | 39 | int registerauthnameext(const char *name, int persistant); |
57583275 | 40 | int findauthnameext(const char *name); |
41 | void releaseauthnameext(int index); | |
42 | ||
43 | /* Actual user commands */ | |
44 | authname *findauthname(unsigned long userid); | |
5a335041 CP |
45 | authname *findauthnamebyname(const char *name); |
46 | authname *findorcreateauthname(unsigned long userid, const char *name); | |
57583275 | 47 | void releaseauthname(authname *anp); |
48 | ||
49 | /* Marker */ | |
5a335041 | 50 | unsigned int nextauthnamemarker(void); |
57583275 | 51 | |
1cf62143 CP |
52 | authname *getauthbyname(const char *name); |
53 | ||
57583275 | 54 | #endif |