]> jfr.im git - irc/rqf/shadowircd.git/blame - include/hostmask.h
Correct already X-Lined notice.
[irc/rqf/shadowircd.git] / include / hostmask.h
CommitLineData
212380e3 1/*
2 * charybdis: an advanced Internet Relay Chat Daemon(ircd).
3 * hostmask.h: A header for the hostmask code.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2004 ircd-ratbox development team
8 * Copyright (C) 2005-2006 charybdis development team
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * $Id: hostmask.h 2757 2006-11-10 22:58:15Z jilles $
26 */
27
28#ifndef INCLUDE_hostmask_h
29#define INCLUDE_hostmask_h 1
30enum
31{
32 HM_HOST,
33 HM_IPV4
34#ifdef IPV6
35 , HM_IPV6
36#endif
37};
38
39int parse_netmask(const char *, struct sockaddr *, int *);
40struct ConfItem *find_conf_by_address(const char *host, const char *sockhost,
41 const char *orighost, struct sockaddr *,
42 int, int, const char *);
43void add_conf_by_address(const char *, int, const char *, struct ConfItem *);
44void delete_one_address_conf(const char *, struct ConfItem *);
45void clear_out_address_conf(void);
46void clear_out_address_conf_bans(void);
47void init_host_hash(void);
48struct ConfItem *find_address_conf(const char *host, const char *sockhost,
49 const char *, const char *, struct sockaddr *,
50 int);
51
52struct ConfItem *find_dline(struct sockaddr *, int);
53
54#define find_kline(x) (find_conf_by_address((x)->host, (x)->sockhost, \
55 (x)->orighost, \
56 (struct sockaddr *)&(x)->localClient->ip, CONF_KILL,\
57 (x)->localClient->ip.ss_family, (x)->username))
58#define find_gline(x) (find_conf_by_address((x)->host, (x)->sockhost, \
59 (x)->orighost, \
60 (struct sockaddr *)&(x)->localClient->ip, CONF_GLINE,\
61 (x)->localClient->ip.ss_family, (x)->username))
62
63void report_Klines(struct Client *);
64void report_auth(struct Client *);
65#ifdef IPV6
66int match_ipv6(struct sockaddr *, struct sockaddr *, int);
67#endif
68int match_ipv4(struct sockaddr *, struct sockaddr *, int);
69
70/* Hashtable stuff... */
71#define ATABLE_SIZE 0x1000 /* 2^12 */
72#define ATABLE_BITS (32-12)
73
74extern struct AddressRec *atable[ATABLE_SIZE];
75
76struct AddressRec
77{
78 /* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
79 int masktype;
80
81 union
82 {
83 struct
84 {
85 /* Pointer into ConfItem... -A1kmm */
86 struct irc_sockaddr_storage addr;
87 int bits;
88 }
89 ipa;
90
91 /* Pointer into ConfItem... -A1kmm */
92 const char *hostname;
93 }
94 Mask;
95
96 /* type: CONF_CLIENT, CONF_DLINE, CONF_KILL etc... -A1kmm */
97 int type;
98
99 /* Higher precedences overrule lower ones... */
100 unsigned long precedence;
101
102 /* Only checked if !(type & 1)... */
103 const char *username;
104 struct ConfItem *aconf;
105
106 /* The next record in this hash bucket. */
107 struct AddressRec *next;
108};
109
110
111#endif /* INCLUDE_hostmask_h */