1 |
adx |
30 |
/* |
2 |
michael |
2865 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
adx |
30 |
* |
4 |
michael |
2865 |
* Copyright (c) 2001-2014 ircd-hybrid development team |
5 |
adx |
30 |
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
|
* USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
michael |
2865 |
/*! \file hostmask.h |
23 |
|
|
* \brief A header for the hostmask code. |
24 |
|
|
* \version $Id$ |
25 |
|
|
*/ |
26 |
|
|
|
27 |
adx |
30 |
#ifndef INCLUDE_hostmask_h |
28 |
michael |
2865 |
#define INCLUDE_hostmask_h |
29 |
adx |
30 |
|
30 |
michael |
1372 |
#define ATABLE_SIZE 0x1000 |
31 |
|
|
|
32 |
|
|
|
33 |
michael |
1367 |
enum hostmask_type |
34 |
adx |
30 |
{ |
35 |
|
|
HM_HOST, |
36 |
|
|
HM_IPV4, |
37 |
|
|
HM_IPV6 |
38 |
|
|
}; |
39 |
|
|
|
40 |
|
|
struct AddressRec |
41 |
|
|
{ |
42 |
|
|
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */ |
43 |
michael |
1367 |
enum hostmask_type masktype; |
44 |
michael |
1644 |
/* type: CONF_CLIENT, CONF_DLINE, CONF_KLINE etc... -A1kmm */ |
45 |
|
|
enum maskitem_type type; |
46 |
adx |
30 |
|
47 |
|
|
union |
48 |
|
|
{ |
49 |
|
|
struct |
50 |
|
|
{ |
51 |
michael |
1632 |
/* Pointer into MaskItem... -A1kmm */ |
52 |
adx |
30 |
struct irc_ssaddr addr; |
53 |
|
|
int bits; |
54 |
|
|
} ipa; |
55 |
|
|
|
56 |
michael |
1632 |
/* Pointer into MaskItem... -A1kmm */ |
57 |
adx |
30 |
const char *hostname; |
58 |
|
|
} Mask; |
59 |
|
|
|
60 |
|
|
/* Higher precedences overrule lower ones... */ |
61 |
michael |
1343 |
unsigned int precedence; |
62 |
adx |
30 |
|
63 |
|
|
/* Only checked if !(type & 1)... */ |
64 |
|
|
const char *username; |
65 |
michael |
1632 |
struct MaskItem *conf; |
66 |
adx |
30 |
|
67 |
michael |
1367 |
dlink_node node; |
68 |
adx |
30 |
}; |
69 |
michael |
1372 |
|
70 |
|
|
extern dlink_list atable[ATABLE_SIZE]; |
71 |
|
|
extern int parse_netmask(const char *, struct irc_ssaddr *, int *); |
72 |
michael |
1455 |
extern int match_ipv6(const struct irc_ssaddr *, const struct irc_ssaddr *, int); |
73 |
|
|
extern int match_ipv4(const struct irc_ssaddr *, const struct irc_ssaddr *, int); |
74 |
michael |
1372 |
|
75 |
|
|
extern void mask_addr(struct irc_ssaddr *, int); |
76 |
|
|
extern void init_host_hash(void); |
77 |
michael |
2811 |
extern struct AddressRec *add_conf_by_address(const unsigned int, struct MaskItem *); |
78 |
michael |
1632 |
extern void delete_one_address_conf(const char *, struct MaskItem *); |
79 |
michael |
1372 |
extern void clear_out_address_conf(void); |
80 |
|
|
extern void hostmask_expire_temporary(void); |
81 |
|
|
|
82 |
michael |
1632 |
extern struct MaskItem *find_address_conf(const char *, const char *, |
83 |
michael |
1372 |
struct irc_ssaddr *, int, char *); |
84 |
michael |
1632 |
extern struct MaskItem *find_dline_conf(struct irc_ssaddr *, int); |
85 |
|
|
extern struct MaskItem *find_conf_by_address(const char *, struct irc_ssaddr *, |
86 |
|
|
unsigned int, int, const char *, const char *, int); |
87 |
adx |
30 |
#endif /* INCLUDE_hostmask_h */ |