| 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 |
|
|
* $Id: hostmask.h,v 1.33 2005/09/29 06:35:41 metalrock Exp $ |
| 23 |
|
|
*/ |
| 24 |
|
|
|
| 25 |
|
|
#ifndef INCLUDE_hostmask_h |
| 26 |
|
|
#define INCLUDE_hostmask_h 1 |
| 27 |
|
|
|
| 28 |
|
|
enum |
| 29 |
|
|
{ |
| 30 |
|
|
HM_HOST, |
| 31 |
|
|
HM_IPV4, |
| 32 |
|
|
HM_IPV6 |
| 33 |
|
|
}; |
| 34 |
|
|
|
| 35 |
|
|
struct HostMaskEntry |
| 36 |
|
|
{ |
| 37 |
|
|
int type, subtype; |
| 38 |
|
|
unsigned long precedence; |
| 39 |
|
|
char *hostmask; |
| 40 |
|
|
void *data; |
| 41 |
|
|
struct HostMaskEntry *next, *nexthash; |
| 42 |
|
|
}; |
| 43 |
|
|
|
| 44 |
|
|
extern int match_ipv6(struct irc_ssaddr *, struct irc_ssaddr *, int); |
| 45 |
|
|
extern int match_ipv4(struct irc_ssaddr *, struct irc_ssaddr *, int); |
| 46 |
|
|
extern void mask_addr(struct irc_ssaddr *, int); |
| 47 |
|
|
extern int parse_netmask(const char *, struct irc_ssaddr *, int *); |
| 48 |
|
|
|
| 49 |
|
|
extern void add_conf_by_address(int, struct AccessItem *); |
| 50 |
|
|
extern void delete_one_address_conf(const char *, struct AccessItem *); |
| 51 |
|
|
extern void clear_out_address_conf(void); |
| 52 |
|
|
extern void init_host_hash(void); |
| 53 |
|
|
extern void report_Klines(struct Client *, int); |
| 54 |
|
|
extern void report_auth(struct Client *); |
| 55 |
|
|
|
| 56 |
|
|
extern char *show_iline_prefix(struct Client *, struct AccessItem *, const char *); |
| 57 |
|
|
extern struct AccessItem *find_address_conf(const char *, const char *, |
| 58 |
|
|
struct irc_ssaddr *, int, char *); |
| 59 |
|
|
extern struct AccessItem *find_kline_conf(const char *, const char *, |
| 60 |
|
|
struct irc_ssaddr *, int); |
| 61 |
|
|
extern struct AccessItem *find_gline_conf(const char *, const char *, |
| 62 |
|
|
struct irc_ssaddr *, int); |
| 63 |
|
|
extern struct AccessItem *find_dline_conf(struct irc_ssaddr *, int); |
| 64 |
|
|
extern struct AccessItem *find_conf_by_address(const char *, struct irc_ssaddr *, |
| 65 |
|
|
int, int, const char *, const char *); |
| 66 |
|
|
|
| 67 |
|
|
/* Hashtable stuff... */ |
| 68 |
|
|
#define ATABLE_SIZE 0x1000 |
| 69 |
|
|
|
| 70 |
|
|
extern struct AddressRec *atable[ATABLE_SIZE]; |
| 71 |
|
|
|
| 72 |
|
|
struct AddressRec |
| 73 |
|
|
{ |
| 74 |
|
|
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */ |
| 75 |
|
|
int masktype; |
| 76 |
|
|
|
| 77 |
|
|
union |
| 78 |
|
|
{ |
| 79 |
|
|
struct |
| 80 |
|
|
{ |
| 81 |
|
|
/* Pointer into AccessItem... -A1kmm */ |
| 82 |
|
|
struct irc_ssaddr addr; |
| 83 |
|
|
int bits; |
| 84 |
|
|
} ipa; |
| 85 |
|
|
|
| 86 |
|
|
/* Pointer into AccessItem... -A1kmm */ |
| 87 |
|
|
const char *hostname; |
| 88 |
|
|
} Mask; |
| 89 |
|
|
|
| 90 |
|
|
/* type: CONF_CLIENT, CONF_DLINE, CONF_KILL etc... -A1kmm */ |
| 91 |
|
|
int type; |
| 92 |
|
|
|
| 93 |
|
|
/* Higher precedences overrule lower ones... */ |
| 94 |
|
|
unsigned long precedence; |
| 95 |
|
|
|
| 96 |
|
|
/* Only checked if !(type & 1)... */ |
| 97 |
|
|
const char *username; |
| 98 |
|
|
struct AccessItem *aconf; |
| 99 |
|
|
|
| 100 |
|
|
/* The next record in this hash bucket. */ |
| 101 |
|
|
struct AddressRec *next; |
| 102 |
|
|
}; |
| 103 |
|
|
#endif /* INCLUDE_hostmask_h */ |