]> jfr.im git - solanum.git/blob - include/blacklist.h
Add .travis.yml
[solanum.git] / include / blacklist.h
1 /*
2 * charybdis: A slightly useful ircd.
3 * blacklist.h: Manages DNS blacklist entries and lookups
4 *
5 * Copyright (C) 2006 charybdis development team
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 */
23
24 #ifndef _BLACKLIST_H_
25 #define _BLACKLIST_H_
26
27 #include "stdinc.h"
28
29 #define BLACKLIST_FILTER_ALL 1
30 #define BLACKLIST_FILTER_LAST 2
31
32 /* A configured DNSBL */
33 struct Blacklist {
34 unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
35 int refcount;
36 int ipv4; /* Does this blacklist support IPv4 lookups? */
37 int ipv6; /* Does this blacklist support IPv6 lookups? */
38 char host[IRCD_RES_HOSTLEN + 1];
39 rb_dlink_list filters; /* Filters for queries */
40 char reject_reason[IRCD_BUFSIZE];
41 unsigned int hits;
42 time_t lastwarning;
43 };
44
45 /* A lookup in progress for a particular DNSBL for a particular client */
46 struct BlacklistClient {
47 struct Blacklist *blacklist;
48 struct Client *client_p;
49 uint16_t dns_id;
50 rb_dlink_node node;
51 };
52
53 /* A blacklist filter */
54 struct BlacklistFilter {
55 int type; /* Type of filter */
56 char filterstr[HOSTIPLEN]; /* The filter itself */
57 rb_dlink_node node;
58 };
59
60 /* public interfaces */
61 struct Blacklist *new_blacklist(char *host, char *reject_reason, int ipv4, int ipv6, rb_dlink_list *filters);
62 void lookup_blacklists(struct Client *client_p);
63 void abort_blacklist_queries(struct Client *client_p);
64 void unref_blacklist(struct Blacklist *blptr);
65 void destroy_blacklists(void);
66
67 extern rb_dlink_list blacklist_list;
68
69 #endif