1 /************************************************************************
2  *   IRC - Internet Relay Chat, common/class_def.h
3  *   Copyright (C) 1990 Darren Reed
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 1, or (at your option)
8  *   any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *   GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program; if not, write to the Free Software
17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifdef ENABLE_CIDR_LIMITS
21 struct _patricia_tree_t;
22 #endif
23 
24 typedef struct Class {
25 	int	class;
26 	int	conFreq;
27 	int	pingFreq;
28 	int	maxLinks;
29 	int	maxSendq;
30 	int	maxBSendq;
31 	int	maxHLocal;
32 	int	maxUHLocal;
33 	int	maxHGlobal;
34 	int	maxUHGlobal;
35 	int	links;
36 #ifdef ENABLE_CIDR_LIMITS
37 	int	cidr_len;
38 	int	cidr_amount;
39 	struct _patricia_tree_t *ip_limits;
40 #endif
41 	struct Class *next;
42 } aClass;
43 
44 #define	Class(x)	((x)->class)
45 #define	ConFreq(x)	((x)->conFreq)
46 #define	PingFreq(x)	((x)->pingFreq)
47 #define	MaxLinks(x)	((x)->maxLinks)
48 #define	MaxSendq(x)	((x)->maxSendq)
49 #define	MaxBSendq(x)	((x)->maxBSendq)
50 #define	MaxHLocal(x)	((x)->maxHLocal)
51 #define	MaxUHLocal(x)	((x)->maxUHLocal)
52 #define	MaxHGlobal(x)	((x)->maxHGlobal)
53 #define	MaxUHGlobal(x)	((x)->maxUHGlobal)
54 #define	Links(x)	((x)->links)
55 #define	IncSendq(x)	MaxSendq(x) = (int)((float)MaxSendq(x) * 1.1)
56 
57 #define	ConfLinks(x)	(Class(x)->links)
58 #define	ConfMaxLinks(x)	(Class(x)->maxLinks)
59 #define	ConfClass(x)	(Class(x)->class)
60 #define	ConfConFreq(x)	(Class(x)->conFreq)
61 #define	ConfPingFreq(x)	(Class(x)->pingFreq)
62 #define	ConfSendq(x)	(Class(x)->maxSendq)
63 #define	ConfMaxHLocal(x)	(Class(x)->maxHLocal)
64 #define	ConfMaxUHLocal(x)	(Class(x)->maxUHLocal)
65 #define	ConfMaxHGlobal(x)	(Class(x)->maxHGlobal)
66 #define	ConfMaxUHGlobal(x)	(Class(x)->maxUHGlobal)
67 #ifdef ENABLE_CIDR_LIMITS
68 #define	MaxCidrAmount(x)	((x)->cidr_amount)
69 #define	CidrLen(x)	((x)->cidr_len)
70 #define	CidrTree(x)	((x)->ip_limits)
71 #define	ConfMaxCidrAmount(x)	(Class(x)->cidr_amount)
72 #define	ConfCidrLen(x)	(Class(x)->cidr_len)
73 #define	ConfCidrTree(x)	(Class(x)->ip_limits)
74 #endif
75 
76 #define	FirstClass() 	classes
77 #define	NextClass(x)	((x)->next)
78