]>
Commit | Line | Data |
---|---|---|
11032584 | 1 | #ifndef _BANS_H |
2 | #define _BANS_H | |
3 | ||
4 | #include "../lib/flags.h" | |
5 | #include "../lib/sstring.h" | |
6 | #include <time.h> | |
7 | ||
8 | #define CHANBAN_NICKEXACT 0x0001 /* Ban includes an exact nick (no wildcards) */ | |
9 | #define CHANBAN_NICKMASK 0x0002 /* Ban includes a nick mask with wildcards */ | |
10 | #define CHANBAN_NICKANY 0x0004 /* Ban is *!.. */ | |
11 | #define CHANBAN_NICKNULL 0x0008 /* Ban has no nick */ | |
12 | #define CHANBAN_USEREXACT 0x0010 /* Ban includes an exact user (no wildcards) */ | |
13 | #define CHANBAN_USERMASK 0x0020 /* Ban includes a user mask with wildcards */ | |
14 | #define CHANBAN_USERANY 0x0040 /* Ban is ..!*@.. */ | |
15 | #define CHANBAN_USERNULL 0x0080 /* Ban has no user */ | |
16 | #define CHANBAN_HOSTEXACT 0x0100 /* Ban includes an exact host */ | |
17 | #define CHANBAN_HOSTMASK 0x0200 /* Ban includes a host mask */ | |
18 | #define CHANBAN_HOSTANY 0x0400 /* Ban is ..@* */ | |
19 | #define CHANBAN_HOSTNULL 0x0800 /* Ban has no host */ | |
20 | #define CHANBAN_IP 0x1000 /* Ban could match against IP address */ | |
21 | #define CHANBAN_CIDR 0x2000 /* Ban includes a CIDR mask (e.g. 192.168.0.0/16 ) */ | |
22 | #define CHANBAN_INVALID 0x4000 /* Ban is nonsensical, i.e. has at least one really NULL component*/ | |
23 | #define CHANBAN_HIDDENHOST 0x8000 /* Ban could possibly match hidden host */ | |
24 | ||
25 | ||
26 | typedef struct chanban { | |
27 | flag_t flags; | |
28 | sstring *nick; | |
29 | sstring *user; | |
30 | sstring *host; | |
31 | time_t timeset; | |
e340eee8 | 32 | unsigned int ipaddr; |
33 | unsigned int mask; | |
11032584 | 34 | struct chanban *next; |
35 | } chanban; | |
36 | ||
37 | chanban *getchanban(); | |
38 | void freechanban(chanban *cbp); | |
39 | ||
40 | chanban *makeban(const char *mask); | |
41 | ||
42 | int banoverlap(const chanban *bana, const chanban *banb); | |
43 | int banequal(chanban *bana, chanban *banb); | |
44 | char *bantostring(chanban *bp); | |
45 | char *bantostringdebug(chanban *bp); | |
46 | ||
47 | ||
48 | #endif |