2 * ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
3 * hostmask.h: A header for the hostmask code.
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
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: hostmask.h 18479 2005-02-15 23:53:30Z leeh $
27 #ifndef INCLUDE_hostmask_h
28 #define INCLUDE_hostmask_h 1
38 int parse_netmask(const char *, struct sockaddr
*, int *);
39 struct ConfItem
*find_conf_by_address(const char *host
, const char *sockhost
,
40 struct sockaddr
*, int, int, const char *);
41 void add_conf_by_address(const char *, int, const char *, struct ConfItem
*);
42 void delete_one_address_conf(const char *, struct ConfItem
*);
43 void clear_out_address_conf(void);
44 void clear_out_address_conf_bans(void);
45 void init_host_hash(void);
46 struct ConfItem
*find_address_conf(const char *host
, const char *sockhost
,
47 const char *, struct sockaddr
*, int);
49 struct ConfItem
*find_dline(struct sockaddr
*, int);
51 #define find_kline(x) (find_conf_by_address((x)->host, (x)->sockhost,\
52 (struct sockaddr *)&(x)->localClient->ip, CONF_KILL,\
53 (x)->localClient->ip.ss_family, (x)->username))
54 #define find_gline(x) (find_conf_by_address((x)->host, (x)->sockhost,\
55 (struct sockaddr *)&(x)->localClient->ip, CONF_GLINE,\
56 (x)->localClient->ip.ss_family, (x)->username))
58 void report_Klines(struct Client
*);
59 void report_auth(struct Client
*);
61 int match_ipv6(struct sockaddr
*, struct sockaddr
*, int);
63 int match_ipv4(struct sockaddr
*, struct sockaddr
*, int);
65 /* Hashtable stuff... */
66 #define ATABLE_SIZE 0x1000 /* 2^12 */
67 #define ATABLE_BITS (32-12)
69 extern struct AddressRec
*atable
[ATABLE_SIZE
];
73 /* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
80 /* Pointer into ConfItem... -A1kmm */
81 struct irc_sockaddr_storage addr
;
86 /* Pointer into ConfItem... -A1kmm */
91 /* type: CONF_CLIENT, CONF_DLINE, CONF_KILL etc... -A1kmm */
94 /* Higher precedences overrule lower ones... */
95 unsigned long precedence
;
97 /* Only checked if !(type & 1)... */
99 struct ConfItem
*aconf
;
101 /* The next record in this hash bucket. */
102 struct AddressRec
*next
;
106 #endif /* INCLUDE_hostmask_h */