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