ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/include/hostmask.h
Revision: 9595
Committed: Fri Sep 4 16:48:45 2020 UTC (5 years, 10 months ago) by michael
Content type: text/x-chdr
File size: 2687 byte(s)
Log Message:
- Cleanup ip address matching routine in various places

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2865 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 9102 * Copyright (c) 2001-2020 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 michael 4564 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2865 /*! \file hostmask.h
23     * \brief A header for the hostmask code.
24     * \version $Id$
25     */
26    
27 michael 6346 #ifndef INCLUDED_hostmask_h
28     #define INCLUDED_hostmask_h
29 adx 30
30 michael 6471 enum { ATABLE_SIZE = 0x1000 };
31 michael 1372
32 michael 1367 enum hostmask_type
33 adx 30 {
34     HM_HOST,
35     HM_IPV4,
36     HM_IPV6
37     };
38    
39     struct AddressRec
40     {
41     /* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
42 michael 1367 enum hostmask_type masktype;
43 michael 1644 /* type: CONF_CLIENT, CONF_DLINE, CONF_KLINE etc... -A1kmm */
44     enum maskitem_type type;
45 adx 30
46     union
47     {
48     struct
49     {
50 michael 1632 /* Pointer into MaskItem... -A1kmm */
51 adx 30 struct irc_ssaddr addr;
52     int bits;
53     } ipa;
54    
55 michael 1632 /* Pointer into MaskItem... -A1kmm */
56 adx 30 const char *hostname;
57     } Mask;
58    
59     /* Higher precedences overrule lower ones... */
60 michael 1343 unsigned int precedence;
61 adx 30
62     /* Only checked if !(type & 1)... */
63     const char *username;
64 michael 1632 struct MaskItem *conf;
65 adx 30
66 michael 1367 dlink_node node;
67 adx 30 };
68 michael 1372
69     extern dlink_list atable[ATABLE_SIZE];
70     extern int parse_netmask(const char *, struct irc_ssaddr *, int *);
71 michael 9595 extern bool address_compare(const void *, const void *, bool, bool, int);
72 michael 8687 extern bool match_ipv6(const struct irc_ssaddr *, const struct irc_ssaddr *, int);
73     extern bool match_ipv4(const struct irc_ssaddr *, const struct irc_ssaddr *, int);
74 michael 1372
75 michael 2811 extern struct AddressRec *add_conf_by_address(const unsigned int, struct MaskItem *);
76 michael 1632 extern void delete_one_address_conf(const char *, struct MaskItem *);
77 michael 1372 extern void clear_out_address_conf(void);
78     extern void hostmask_expire_temporary(void);
79    
80 michael 8828 extern struct MaskItem *find_address_conf(const char *, const char *, const struct irc_ssaddr *, const char *);
81     extern struct MaskItem *find_dline_conf(const struct irc_ssaddr *);
82 michael 5849 extern struct MaskItem *find_conf_by_address(const char *, const struct irc_ssaddr *,
83 michael 8828 unsigned int, const char *, const char *, int);
84 michael 6346 #endif /* INCLUDED_hostmask_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id