ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 5639
Committed: Sun Mar 1 16:14:54 2015 UTC (10 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 12466 byte(s)
Log Message:
- Constifications

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 5347 * Copyright (c) 1997-2015 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 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2865 /*! \file conf.h
23     * \brief A header for the configuration functions.
24     * \version $Id$
25     */
26    
27 adx 30 #ifndef INCLUDED_s_conf_h
28     #define INCLUDED_s_conf_h
29 michael 912 #include "config.h"
30 adx 30 #include "ircd_defs.h"
31     #include "client.h"
32 michael 1632 #include "conf_class.h"
33 adx 30
34 michael 967
35 michael 1646 #define CONF_NOREASON "<No reason supplied>"
36 adx 30
37 michael 1798 #define IsConfKill(x) ((x)->type == CONF_KLINE)
38     #define IsConfClient(x) ((x)->type == CONF_CLIENT)
39     #define IsConfGline(x) ((x)->type == CONF_GLINE)
40 michael 967
41 michael 1798 /* MaskItem->flags */
42 michael 4778 #define CONF_FLAGS_NO_TILDE 0x00000001U
43     #define CONF_FLAGS_NEED_IDENTD 0x00000002U
44     #define CONF_FLAGS_EXEMPTKLINE 0x00000004U
45     #define CONF_FLAGS_NOLIMIT 0x00000008U
46     #define CONF_FLAGS_SPOOF_IP 0x00000010U
47     #define CONF_FLAGS_SPOOF_NOTICE 0x00000020U
48     #define CONF_FLAGS_REDIR 0x00000040U
49     #define CONF_FLAGS_EXEMPTGLINE 0x00000080U
50     #define CONF_FLAGS_CAN_FLOOD 0x00000100U
51     #define CONF_FLAGS_NEED_PASSWORD 0x00000200U
52     #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00000400U
53     #define CONF_FLAGS_ENCRYPTED 0x00000800U
54     #define CONF_FLAGS_IN_DATABASE 0x00001000U
55     #define CONF_FLAGS_EXEMPTRESV 0x00002000U
56     #define CONF_FLAGS_SSL 0x00004000U
57     #define CONF_FLAGS_WEBIRC 0x00008000U
58 michael 967
59 michael 1798 /* Macros for struct MaskItem */
60 michael 4340 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
61     #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
62     #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
63     #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
64     #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
65     #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
66     #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
67     #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
68     #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
69     #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
70     #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
71     #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
72     #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
73 michael 1798 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
74 michael 4340 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
75     #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
76     #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
77     #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
78 michael 1798
79    
80 michael 2865 /* shared/cluster server entry types
81 michael 1798 * These defines are used for both shared and cluster.
82     */
83 michael 3925 #define SHARED_KLINE 0x00000001U
84     #define SHARED_UNKLINE 0x00000002U
85     #define SHARED_XLINE 0x00000004U
86     #define SHARED_UNXLINE 0x00000008U
87     #define SHARED_RESV 0x00000010U
88     #define SHARED_UNRESV 0x00000020U
89     #define SHARED_LOCOPS 0x00000040U
90     #define SHARED_DLINE 0x00000080U
91     #define SHARED_UNDLINE 0x00000100U
92 michael 1798 #define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\
93     SHARED_XLINE | SHARED_UNXLINE |\
94     SHARED_RESV | SHARED_UNRESV |\
95     SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
96    
97    
98 michael 1632 enum maskitem_type
99     {
100 michael 2995 CONF_CLIENT = 1 << 0,
101     CONF_SERVER = 1 << 1,
102     CONF_KLINE = 1 << 2,
103     CONF_DLINE = 1 << 3,
104     CONF_EXEMPT = 1 << 4,
105     CONF_CLUSTER = 1 << 5,
106     CONF_XLINE = 1 << 6,
107     CONF_ULINE = 1 << 7,
108     CONF_GLINE = 1 << 8,
109     CONF_CRESV = 1 << 9,
110     CONF_NRESV = 1 << 10,
111     CONF_SERVICE = 1 << 11,
112 michael 3663 CONF_OPER = 1 << 12
113 michael 1632 };
114 adx 30
115 michael 3093 enum
116     {
117     NOT_AUTHORIZED = -1,
118     I_LINE_FULL = -2,
119     TOO_MANY = -3,
120     BANNED_CLIENT = -4,
121     TOO_FAST = -5
122     };
123    
124 michael 593 struct split_nuh_item
125     {
126     dlink_node node;
127    
128     char *nuhmask;
129     char *nickptr;
130     char *userptr;
131     char *hostptr;
132    
133     size_t nicksize;
134     size_t usersize;
135     size_t hostsize;
136     };
137    
138 michael 1632 struct MaskItem
139 adx 30 {
140 michael 1644 dlink_node node;
141     dlink_list leaf_list;
142     dlink_list hub_list;
143 michael 1858 dlink_list exempt_list;
144 michael 1632 enum maskitem_type type;
145 michael 1644 unsigned int dns_failed;
146     unsigned int dns_pending;
147     unsigned int flags;
148     unsigned int modes;
149     unsigned int port;
150     unsigned int count;
151     unsigned int aftype;
152     unsigned int active;
153     unsigned int htype;
154     unsigned int ref_count; /* Number of *LOCAL* clients using this */
155     int bits;
156 michael 1649 time_t until; /* Hold action until this time (calendar time) */
157 michael 1644 time_t setat;
158     struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
159     struct irc_ssaddr addr; /* ip to connect to */
160     struct ClassItem *class; /* Class of connection */
161     char *name;
162 michael 1649 char *user; /* user part of user@host */
163 michael 1644 char *host; /* host part of user@host */
164     char *passwd;
165     char *spasswd; /* Password to send. */
166     char *reason;
167 michael 2228 char *certfp;
168 michael 5556 char *whois;
169 michael 1644 char *cipher_list;
170     void *rsa_public_key;
171 adx 30 };
172    
173 michael 1858 struct exempt
174     {
175     dlink_node node;
176     char *name;
177     char *user;
178     char *host;
179     size_t len;
180     time_t when;
181     struct irc_ssaddr addr;
182     int bits;
183     int type;
184 michael 4822 int country_id;
185 michael 1858 };
186    
187 adx 30 struct CidrItem
188     {
189 michael 1013 dlink_node node;
190 adx 30 struct irc_ssaddr mask;
191 michael 1644 unsigned int number_on_this_cidr;
192 adx 30 };
193    
194 michael 5602 struct conf_parser_context
195 adx 30 {
196 michael 4080 unsigned int boot;
197     unsigned int pass;
198     FILE *conf_file;
199 michael 5602 };
200 michael 4080
201 michael 5602 struct config_general_entry
202 michael 4080 {
203 michael 4340 const char *dpath;
204 michael 3239 const char *mpath;
205     const char *spath;
206 adx 30 const char *configfile;
207     const char *klinefile;
208 michael 1702 const char *glinefile;
209 adx 30 const char *xlinefile;
210     const char *dlinefile;
211 michael 1702 const char *resvfile;
212 adx 30
213 michael 3870 unsigned int gline_min_cidr;
214     unsigned int gline_min_cidr6;
215     unsigned int dots_in_ident;
216     unsigned int failed_oper_notice;
217     unsigned int anti_spam_exit_message_time;
218 michael 950 unsigned int max_accept;
219     unsigned int max_watch;
220 michael 4313 unsigned int away_time;
221     unsigned int away_count;
222 michael 3870 unsigned int max_nick_time;
223 michael 950 unsigned int max_nick_changes;
224 michael 3870 unsigned int ts_max_delta;
225     unsigned int ts_warn_delta;
226     unsigned int anti_nick_flood;
227     unsigned int warn_no_connect_block;
228     unsigned int invisible_on_connect;
229     unsigned int stats_e_disabled;
230 michael 5025 unsigned int stats_i_oper_only;
231     unsigned int stats_k_oper_only;
232     unsigned int stats_m_oper_only;
233 michael 3870 unsigned int stats_o_oper_only;
234     unsigned int stats_P_oper_only;
235     unsigned int stats_u_oper_only;
236     unsigned int short_motd;
237     unsigned int no_oper_flood;
238     unsigned int oper_pass_resv;
239     unsigned int glines;
240     unsigned int tkline_expire_notices;
241     unsigned int opers_bypass_callerid;
242     unsigned int ignore_bogus_ts;
243     unsigned int pace_wait;
244     unsigned int pace_wait_simple;
245     unsigned int gline_time;
246     unsigned int gline_request_time;
247 michael 3674 unsigned int oper_only_umodes;
248     unsigned int oper_umodes;
249 michael 3283 unsigned int max_targets;
250 michael 3870 unsigned int caller_id_wait;
251     unsigned int min_nonwildcard;
252     unsigned int min_nonwildcard_simple;
253     unsigned int kill_chase_time_limit;
254     unsigned int default_floodcount;
255 michael 3877 unsigned int throttle_count;
256 michael 3870 unsigned int throttle_time;
257     unsigned int ping_cookie;
258     unsigned int disable_auth;
259     unsigned int cycle_on_host_change;
260 michael 5602 };
261 adx 30
262 michael 5602 struct config_channel_entry
263 adx 30 {
264 michael 3870 unsigned int disable_fake_channels;
265 michael 3860 unsigned int invite_client_count;
266     unsigned int invite_client_time;
267     unsigned int knock_client_count;
268     unsigned int knock_client_time;
269 michael 3870 unsigned int knock_delay_channel;
270 adx 30 unsigned int max_bans;
271 michael 3933 unsigned int max_channels;
272 michael 5489 unsigned int default_join_flood_count;
273     unsigned int default_join_flood_time;
274 michael 3870 unsigned int no_create_on_split;
275     unsigned int no_join_on_split;
276     unsigned int default_split_server_count;
277     unsigned int default_split_user_count;
278 michael 5602 };
279 adx 30
280 michael 5602 struct config_server_hide
281 adx 30 {
282 michael 1013 char *hidden_name;
283 michael 3870 unsigned int flatten_links;
284     unsigned int disable_remote_commands;
285     unsigned int hide_servers;
286     unsigned int hide_services;
287     unsigned int links_delay;
288     unsigned int links_disabled;
289     unsigned int hidden;
290     unsigned int hide_server_ips;
291 michael 5602 };
292 adx 30
293 michael 5602 struct server_info
294 adx 30 {
295 michael 4114 #ifdef HAVE_LIBCRYPTO
296     const EVP_MD *message_digest_algorithm;
297     #endif
298 michael 1013 char *sid;
299 adx 30 char *name;
300     char *description;
301     char *network_name;
302     char *network_desc;
303     char *rsa_private_key_file;
304 michael 1644 void *rsa_private_key;
305     void *server_ctx;
306     void *client_ctx;
307 michael 3870 unsigned int hub;
308 michael 5489 unsigned int default_max_clients;
309 michael 1751 unsigned int max_nick_length;
310     unsigned int max_topic_length;
311 michael 3870 unsigned int specific_ipv4_vhost;
312     unsigned int specific_ipv6_vhost;
313 michael 4344 struct irc_ssaddr ip;
314     struct irc_ssaddr ip6;
315 michael 5602 };
316 adx 30
317 michael 5602 struct admin_info
318 adx 30 {
319     char *name;
320     char *description;
321     char *email;
322 michael 5602 };
323 adx 30
324 michael 5602 struct logging_entry
325 adx 30 {
326     unsigned int use_logging;
327 michael 5602 };
328 adx 30
329 michael 2156 extern dlink_list flatten_links;
330 adx 30 extern dlink_list server_items;
331     extern dlink_list cluster_items;
332 michael 1622 extern dlink_list xconf_items;
333 michael 1922 extern dlink_list uconf_items;
334     extern dlink_list oconf_items;
335 michael 1157 extern dlink_list service_items;
336 michael 2174 extern dlink_list nresv_items;
337     extern dlink_list cresv_items;
338 michael 5602 extern struct conf_parser_context conf_parser_ctx;
339     extern struct logging_entry ConfigLog;
340     extern struct config_general_entry ConfigGeneral;
341     extern struct config_channel_entry ConfigChannel;
342     extern struct config_server_hide ConfigServerHide;
343     extern struct server_info ConfigServerInfo;
344     extern struct admin_info ConfigAdminInfo;
345 michael 3493
346 michael 2130 extern int valid_wild_card_simple(const char *);
347 adx 30 extern int valid_wild_card(struct Client *, int, int, ...);
348     /* End GLOBAL section */
349    
350 michael 1632 extern struct MaskItem *conf_make(enum maskitem_type);
351 adx 30 extern void read_conf_files(int);
352 michael 1632 extern int attach_conf(struct Client *, struct MaskItem *);
353 adx 30 extern int attach_connect_block(struct Client *, const char *, const char *);
354 michael 1644 extern int check_client(struct Client *);
355 adx 30
356 michael 1644
357 michael 1632 extern void detach_conf(struct Client *, enum maskitem_type);
358     extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
359 adx 30 extern int conf_connect_allowed(struct irc_ssaddr *, int);
360 michael 5639 extern const char *oper_privs_as_string(const unsigned int);
361 michael 593 extern void split_nuh(struct split_nuh_item *);
362 michael 1632 extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
363     const char *, const char *, unsigned int);
364     extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
365 adx 30 const char *, const char *);
366 michael 1632 extern void conf_free(struct MaskItem *);
367 adx 30 extern void yyerror(const char *);
368 michael 1751 extern void conf_error_report(const char *);
369 adx 30 extern void cleanup_tklines(void *);
370 michael 4982 extern int conf_rehash(int);
371 michael 1647 extern void lookup_confhost(struct MaskItem *);
372 michael 1632 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
373 adx 30
374 michael 1364 extern const char *get_oper_name(const struct Client *);
375 adx 30
376     /* XXX should the parse_aline stuff go into another file ?? */
377 michael 2865 #define AWILD 0x1 /* check wild cards */
378 adx 30 extern int parse_aline(const char *, struct Client *, int, char **,
379 michael 2865 int, char **, char **, time_t *, char **, char **);
380 adx 30 extern int valid_comment(struct Client *, char *, int);
381    
382    
383     #define TK_SECONDS 0
384     #define TK_MINUTES 1
385 michael 2313 extern time_t valid_tkline(const char *, const int);
386 michael 1632 extern int match_conf_password(const char *, const struct MaskItem *);
387 adx 30
388 michael 1370 #define CLEANUP_TKLINES_TIME 60
389 adx 30
390 michael 5584 extern void cluster_a_line(struct Client *, const char *, unsigned int, unsigned int, const char *,...);
391 adx 30 #endif /* INCLUDED_s_conf_h */

Properties

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