File: class.h

package info (click to toggle)
ircd 2.10.04-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,248 kB
  • ctags: 2,145
  • sloc: ansic: 26,591; makefile: 666; sh: 418; perl: 18
file content (81 lines) | stat: -rw-r--r-- 2,690 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * IRC - Internet Relay Chat, include/class.h
 * Copyright (C) 1990 Darren Reed
 * Copyright (C) 1996 - 1997 Carlo Wood
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef CLASS_H
#define CLASS_H

/*=========================================================================
 * Structures
 */

struct ConfClass {
  unsigned int conClass;
  unsigned int conFreq;
  unsigned int pingFreq;
  unsigned int maxLinks;
  unsigned long maxSendq;
  unsigned int links;
  struct ConfClass *next;
};

/*=============================================================================
 * Macro's
 */

#define ConClass(x)	((x)->conClass)
#define ConFreq(x)	((x)->conFreq)
#define PingFreq(x)	((x)->pingFreq)
#define MaxLinks(x)	((x)->maxLinks)
#define MaxSendq(x)	((x)->maxSendq)
#define Links(x)	((x)->links)

#define ConfLinks(x)	((x)->confClass->links)
#define ConfMaxLinks(x) ((x)->confClass->maxLinks)
#define ConfClass(x)	((x)->confClass->conClass)
#define ConfConFreq(x)	((x)->confClass->conFreq)
#define ConfPingFreq(x) ((x)->confClass->pingFreq)
#define ConfSendq(x)	((x)->confClass->maxSendq)

#define FirstClass()	classes
#define NextClass(x)	((x)->next)

#define MarkDelete(x)	do { MaxLinks(x) = (unsigned int)-1; } while(0)
#define IsMarkedDelete(x) (MaxLinks(x) == (unsigned int)-1)

/*=============================================================================
 * Proto types
 */

extern aConfClass *find_class(unsigned int cclass);
extern aConfClass *make_class(void);
extern void free_class(aConfClass * tmp);
extern unsigned int get_con_freq(aConfClass * clptr);
extern unsigned int get_client_ping(aClient *acptr);
extern unsigned int get_conf_class(aConfItem *aconf);
extern unsigned int get_client_class(aClient *acptr);
extern void add_class(unsigned int conclass, unsigned int ping, unsigned int confreq, unsigned int maxli, size_t sendq);
extern void check_class(void);
extern void initclass(void);
extern void report_classes(aClient *sptr);
extern size_t get_sendq(aClient *cptr);

extern aConfClass *classes;

#endif /* CLASS_H */