]> jfr.im git - solanum.git/blame - include/blacklist.h
IRCD_BUFSIZE is redundant with BUFSIZE, so kill it.
[solanum.git] / include / blacklist.h
CommitLineData
212380e3
AC
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
212380e3
AC
21 */
22
23#ifndef _BLACKLIST_H_
24#define _BLACKLIST_H_
25
3c93d380
EM
26#include "stdinc.h"
27
28#define BLACKLIST_FILTER_ALL 1
29#define BLACKLIST_FILTER_LAST 2
30
212380e3
AC
31/* A configured DNSBL */
32struct Blacklist {
33 unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
34 int refcount;
0a1e77c2
EM
35 int ipv4; /* Does this blacklist support IPv4 lookups? */
36 int ipv6; /* Does this blacklist support IPv6 lookups? */
db3efb7a 37 char host[IRCD_RES_HOSTLEN + 1];
3c93d380 38 rb_dlink_list filters; /* Filters for queries */
82236a2a 39 char reject_reason[BUFSIZE];
212380e3 40 unsigned int hits;
96274734 41 time_t lastwarning;
212380e3
AC
42};
43
44/* A lookup in progress for a particular DNSBL for a particular client */
45struct BlacklistClient {
46 struct Blacklist *blacklist;
47 struct Client *client_p;
1d02144f 48 uint16_t dns_id;
5b96d9a6 49 rb_dlink_node node;
212380e3
AC
50};
51
3c93d380
EM
52/* A blacklist filter */
53struct BlacklistFilter {
54 int type; /* Type of filter */
55 char filterstr[HOSTIPLEN]; /* The filter itself */
56 rb_dlink_node node;
57};
58
212380e3 59/* public interfaces */
3c93d380 60struct Blacklist *new_blacklist(char *host, char *reject_reason, int ipv4, int ipv6, rb_dlink_list *filters);
212380e3
AC
61void lookup_blacklists(struct Client *client_p);
62void abort_blacklist_queries(struct Client *client_p);
63void unref_blacklist(struct Blacklist *blptr);
64void destroy_blacklists(void);
65
5b96d9a6 66extern rb_dlink_list blacklist_list;
212380e3
AC
67
68#endif