]> jfr.im git - irc/quakenet/newserv.git/blob - authext/authext.h
CHANFIX: Ooops, should be after, not before
[irc/quakenet/newserv.git] / authext / authext.h
1 #ifndef __AUTHEXT_H
2 #define __AUTHEXT_H
3
4 #include "../irc/irc_config.h"
5 #include "../lib/flags.h"
6 #include "../lib/ccassert.h"
7
8 #include <sys/types.h>
9
10 #define MAXAUTHNAMEEXTS 5
11
12 /* checking to see that u_int64_t == unsigned long long for strtoull */
13 CCASSERT(sizeof(unsigned long long) == sizeof(u_int64_t))
14
15 struct nick;
16
17 typedef struct authname {
18 unsigned long userid;
19 int usercount;
20 unsigned int marker;
21 struct nick *nicks;
22 struct authname *next, *nextbyname;
23 unsigned int namebucket;
24 u_int64_t flags;
25 char name[ACCOUNTLEN+1];
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 */
35 authname *newauthname(void);
36 void freeauthname (authname *hp);
37
38 /* EXT management */
39 int registerauthnameext(const char *name, int persistant);
40 int findauthnameext(const char *name);
41 void releaseauthnameext(int index);
42
43 /* Actual user commands */
44 authname *findauthname(unsigned long userid);
45 authname *findauthnamebyname(const char *name);
46 authname *findorcreateauthname(unsigned long userid, const char *name);
47 void releaseauthname(authname *anp);
48
49 /* Marker */
50 unsigned int nextauthnamemarker(void);
51
52 authname *getauthbyname(const char *name);
53
54 #endif