]> jfr.im git - irc/quakenet/newserv.git/blob - rbl/rbl.h
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / rbl / rbl.h
1 #ifndef __RBL_H
2 #define __RBL_H
3
4 struct rbl_instance;
5
6 typedef struct rbl_ops {
7 int (*lookup)(struct rbl_instance *rbl, struct irc_in_addr *ip, char *message, size_t msglen);
8 int (*refresh)(struct rbl_instance *rbl);
9 void (*dtor)(struct rbl_instance *rbl);
10 } rbl_ops;
11
12 typedef struct rbl_instance {
13 sstring *name;
14 const rbl_ops *ops;
15 void *udata;
16 struct rbl_instance *next;
17 } rbl_instance;
18
19 extern rbl_instance *rbl_instances;
20
21 int registerrbl(const char *name, const rbl_ops *ops, void *udata);
22 void deregisterrblbyops(const rbl_ops *ops);
23
24 #define RBL_LOOKUP(rbl, ip, msg, msglen) rbl->ops->lookup(rbl, ip, msg, msglen)
25 #define RBL_REFRESH(rbl) rbl->ops->refresh(rbl)
26 #define RBL_DTOR(rbl) rbl->ops->dtor(rbl)
27
28 #endif /* __RBL_H */