]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * chanservdb_alloc.c: | |
3 | * Handles allocation of the various chanserv structures. | |
4 | */ | |
5 | ||
6 | #include "../chanserv.h" | |
7 | #include "../../core/nsmalloc.h" | |
8 | ||
9 | regchan *getregchan() { | |
10 | regchan *rcp = nsmalloc(POOL_CHANSERVDB, sizeof(regchan)); | |
11 | ||
12 | if (!rcp) | |
13 | return NULL; | |
14 | ||
15 | tagregchan(rcp); | |
16 | ||
17 | return rcp; | |
18 | } | |
19 | ||
20 | void freeregchan(regchan *rcp) { | |
21 | verifyregchan(rcp); | |
22 | nsfree(POOL_CHANSERVDB, rcp); | |
23 | } | |
24 | ||
25 | reguser *getreguser() { | |
26 | reguser *rup = nsmalloc(POOL_CHANSERVDB, sizeof(reguser)); | |
27 | ||
28 | if (!rup) | |
29 | return NULL; | |
30 | ||
31 | tagreguser(rup); | |
32 | ||
33 | return rup; | |
34 | } | |
35 | ||
36 | void freereguser(reguser *rup) { | |
37 | verifyreguser(rup); | |
38 | nsfree(POOL_CHANSERVDB, rup); | |
39 | } | |
40 | ||
41 | regchanuser *getregchanuser() { | |
42 | regchanuser *rcup = nsmalloc(POOL_CHANSERVDB, sizeof(regchanuser)); | |
43 | ||
44 | if (!rcup) | |
45 | return NULL; | |
46 | ||
47 | tagregchanuser(rcup); | |
48 | ||
49 | return rcup; | |
50 | } | |
51 | ||
52 | void freeregchanuser(regchanuser *rcup) { | |
53 | verifyregchanuser(rcup); | |
54 | nsfree(POOL_CHANSERVDB, rcup); | |
55 | } | |
56 | ||
57 | regban *getregban() { | |
58 | regban *rbp = nsmalloc(POOL_CHANSERVDB, sizeof(regban)); | |
59 | ||
60 | if (!rbp) | |
61 | return NULL; | |
62 | ||
63 | tagregchanban(rbp); | |
64 | ||
65 | return rbp; | |
66 | } | |
67 | ||
68 | void freeregban(regban *rbp) { | |
69 | verifyregchanban(rbp); | |
70 | nsfree(POOL_CHANSERVDB, rbp); | |
71 | } | |
72 | ||
73 | activeuser *getactiveuser() { | |
74 | activeuser *aup = nsmalloc(POOL_CHANSERVDB, sizeof(activeuser)); | |
75 | ||
76 | if (!aup) | |
77 | return NULL; | |
78 | ||
79 | tagactiveuser(aup); | |
80 | ||
81 | aup->authattempts=0; | |
82 | aup->helloattempts=0; | |
83 | aup->entropyttl=0; | |
84 | ||
85 | return aup; | |
86 | } | |
87 | ||
88 | void freeactiveuser(activeuser *aup) { | |
89 | verifyactiveuser(aup); | |
90 | nsfree(POOL_CHANSERVDB, aup); | |
91 | } | |
92 | ||
93 | maildomain *getmaildomain() { | |
94 | maildomain *mdp = nsmalloc(POOL_CHANSERVDB, sizeof(maildomain)); | |
95 | ||
96 | if (!mdp) | |
97 | return NULL; | |
98 | ||
99 | tagmaildomain(mdp); | |
100 | ||
101 | return mdp; | |
102 | } | |
103 | ||
104 | void freemaildomain(maildomain *mdp) { | |
105 | verifymaildomain(mdp); | |
106 | nsfree(POOL_CHANSERVDB, mdp); | |
107 | } | |
108 | ||
109 | maillock *getmaillock() { | |
110 | maillock *mlp = nsmalloc(POOL_CHANSERVDB, sizeof(maillock)); | |
111 | ||
112 | if (!mlp) | |
113 | return NULL; | |
114 | ||
115 | tagmaillock(mlp); | |
116 | ||
117 | return mlp; | |
118 | } | |
119 | ||
120 | void freemaillock(maillock *mlp) { | |
121 | verifymaillock(mlp); | |
122 | ||
123 | freesstring(mlp->pattern); | |
124 | freesstring(mlp->reason); | |
125 | nsfree(POOL_CHANSERVDB, mlp); | |
126 | } |