Replace privilege-controlling Feature settings with
[ircu2.10.12-pk.git] / include / class.h
1 /*
2  * IRC - Internet Relay Chat, include/class.h
3  * Copyright (C) 1990 Darren Reed
4  * Copyright (C) 1996 - 1997 Carlo Wood
5  *
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, or (at your option)
9  * 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  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * $Id$
21  */
22 #ifndef INCLUDED_class_h
23 #define INCLUDED_class_h
24 #ifndef INCLUDED_sys_types_h
25 #include <sys/types.h>
26 #define INCLUDED_sys_types_h
27 #endif
28
29 #include "client.h"
30
31 struct ConfItem;
32 struct StatDesc;
33
34 /*
35  * Structures
36  */
37 struct ConnectionClass {
38   struct ConnectionClass* next;
39   char                    *cc_name;
40   char                    *default_umode;
41   struct Privs            privs;
42   struct Privs            privs_dirty;
43   unsigned int            max_sendq;
44   short                   ping_freq;
45   short                   conn_freq;
46   short                   max_links;
47   unsigned char           valid;
48   int                     ref_count;
49 };
50
51 /*
52  * Macro's
53  */
54
55 #define ConClass(x)     ((x)->cc_name)
56 #define PingFreq(x)     ((x)->ping_freq)
57 #define ConFreq(x)      ((x)->conn_freq)
58 #define MaxLinks(x)     ((x)->max_links)
59 #define MaxSendq(x)     ((x)->max_sendq)
60 #define Links(x)        ((x)->ref_count)
61
62 #define ConfClass(x)    ((x)->conn_class->cc_name)
63 #define ConfPingFreq(x) ((x)->conn_class->ping_freq)
64 #define ConfConFreq(x)  ((x)->conn_class->conn_freq)
65 #define ConfMaxLinks(x) ((x)->conn_class->max_links)
66 #define ConfSendq(x)    ((x)->conn_class->max_sendq)
67 #define ConfLinks(x)    ((x)->conn_class->ref_count)
68 #define ConfUmode(x)    ((x)->conn_class->default_umode)
69
70 /*
71  * Proto types
72  */
73
74 extern void init_class(void);
75
76 extern const struct ConnectionClass* get_class_list(void);
77 extern void class_mark_delete(void);
78 extern void class_delete_marked(void);
79
80 extern struct ConnectionClass *find_class(const char *name);
81 extern struct ConnectionClass *make_class(void);
82 extern void free_class(struct ConnectionClass * tmp);
83 extern unsigned int get_con_freq(struct ConnectionClass * clptr);
84 extern char *get_conf_class(const struct ConfItem *aconf);
85 extern int get_conf_ping(const struct ConfItem *aconf);
86 extern char *get_client_class(struct Client *acptr);
87 extern void add_class(char *name, unsigned int ping,
88                       unsigned int confreq, unsigned int maxli,
89                       unsigned int sendq);
90 extern void check_class(void);
91 extern void report_classes(struct Client *sptr, struct StatDesc *sd, int stat,
92                            char *param);
93 extern unsigned int get_sendq(struct Client* cptr);
94
95 extern void class_send_meminfo(struct Client* cptr);
96 #endif /* INCLUDED_class_h */