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