1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* hostmask.h: A header for the hostmask code. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2005 by the past and present ircd coders, and others. |
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 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#ifndef INCLUDE_hostmask_h |
26 |
|
|
#define INCLUDE_hostmask_h 1 |
27 |
|
|
|
28 |
michael |
1372 |
#define ATABLE_SIZE 0x1000 |
29 |
|
|
|
30 |
|
|
|
31 |
michael |
1367 |
enum hostmask_type |
32 |
adx |
30 |
{ |
33 |
|
|
HM_HOST, |
34 |
|
|
HM_IPV4, |
35 |
|
|
HM_IPV6 |
36 |
|
|
}; |
37 |
|
|
|
38 |
|
|
struct HostMaskEntry |
39 |
|
|
{ |
40 |
|
|
int type, subtype; |
41 |
michael |
1343 |
unsigned int precedence; |
42 |
adx |
30 |
char *hostmask; |
43 |
|
|
void *data; |
44 |
|
|
struct HostMaskEntry *next, *nexthash; |
45 |
|
|
}; |
46 |
|
|
|
47 |
|
|
struct AddressRec |
48 |
|
|
{ |
49 |
|
|
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */ |
50 |
michael |
1367 |
enum hostmask_type masktype; |
51 |
adx |
30 |
|
52 |
|
|
union |
53 |
|
|
{ |
54 |
|
|
struct |
55 |
|
|
{ |
56 |
|
|
/* Pointer into AccessItem... -A1kmm */ |
57 |
|
|
struct irc_ssaddr addr; |
58 |
|
|
int bits; |
59 |
|
|
} ipa; |
60 |
|
|
|
61 |
|
|
/* Pointer into AccessItem... -A1kmm */ |
62 |
|
|
const char *hostname; |
63 |
|
|
} Mask; |
64 |
|
|
|
65 |
michael |
1369 |
/* type: CONF_CLIENT, CONF_DLINE, CONF_KLINE etc... -A1kmm */ |
66 |
michael |
1367 |
unsigned int type; |
67 |
adx |
30 |
|
68 |
|
|
/* Higher precedences overrule lower ones... */ |
69 |
michael |
1343 |
unsigned int precedence; |
70 |
adx |
30 |
|
71 |
|
|
/* Only checked if !(type & 1)... */ |
72 |
|
|
const char *username; |
73 |
|
|
struct AccessItem *aconf; |
74 |
|
|
|
75 |
michael |
1367 |
dlink_node node; |
76 |
adx |
30 |
}; |
77 |
michael |
1372 |
|
78 |
|
|
extern dlink_list atable[ATABLE_SIZE]; |
79 |
|
|
extern int parse_netmask(const char *, struct irc_ssaddr *, int *); |
80 |
|
|
extern int match_ipv6(struct irc_ssaddr *, struct irc_ssaddr *, int); |
81 |
|
|
extern int match_ipv4(struct irc_ssaddr *, struct irc_ssaddr *, int); |
82 |
|
|
|
83 |
|
|
extern void mask_addr(struct irc_ssaddr *, int); |
84 |
|
|
extern void init_host_hash(void); |
85 |
|
|
extern void add_conf_by_address(const unsigned int, struct AccessItem *); |
86 |
|
|
extern void delete_one_address_conf(const char *, struct AccessItem *); |
87 |
|
|
extern void clear_out_address_conf(void); |
88 |
|
|
extern void hostmask_expire_temporary(void); |
89 |
|
|
|
90 |
|
|
extern struct AccessItem *find_address_conf(const char *, const char *, |
91 |
|
|
struct irc_ssaddr *, int, char *); |
92 |
|
|
extern struct AccessItem *find_kline_conf(const char *, const char *, |
93 |
|
|
struct irc_ssaddr *, int); |
94 |
|
|
extern struct AccessItem *find_gline_conf(const char *, const char *, |
95 |
|
|
struct irc_ssaddr *, int); |
96 |
|
|
extern struct AccessItem *find_dline_conf(struct irc_ssaddr *, int); |
97 |
|
|
extern struct AccessItem *find_conf_by_address(const char *, struct irc_ssaddr *, |
98 |
|
|
unsigned int, int, const char *, const char *, int); |
99 |
adx |
30 |
#endif /* INCLUDE_hostmask_h */ |