ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 3093
Committed: Sat Mar 1 19:44:52 2014 UTC (11 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 12427 byte(s)
Log Message:
- conf.h: made some more constants use an enum

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 ircd-hybrid development team
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 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 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file conf.h
23 * \brief A header for the configuration functions.
24 * \version $Id$
25 */
26
27 #ifndef INCLUDED_s_conf_h
28 #define INCLUDED_s_conf_h
29 #include "config.h"
30 #include "ircd_defs.h"
31 #include "client.h"
32 #include "hook.h"
33 #include "conf_class.h"
34
35
36 #define CONF_NOREASON "<No reason supplied>"
37
38 #define IsConfOperator(x) ((x)->type == CONF_OPER)
39 #define IsConfKill(x) ((x)->type == CONF_KLINE)
40 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
41 #define IsConfGline(x) ((x)->type == CONF_GLINE)
42
43 /* MaskItem->flags */
44 #define CONF_FLAGS_DO_IDENTD 0x00000001
45 #define CONF_FLAGS_NO_TILDE 0x00000004
46 #define CONF_FLAGS_NEED_IDENTD 0x00000008
47 #define CONF_FLAGS_EXEMPTKLINE 0x00000010
48 #define CONF_FLAGS_NOLIMIT 0x00000020
49 #define CONF_FLAGS_SPOOF_IP 0x00000040
50 #define CONF_FLAGS_SPOOF_NOTICE 0x00000080
51 #define CONF_FLAGS_REDIR 0x00000100
52 #define CONF_FLAGS_EXEMPTGLINE 0x00000200
53 #define CONF_FLAGS_CAN_FLOOD 0x00000400
54 #define CONF_FLAGS_NEED_PASSWORD 0x00000800
55 #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00001000
56 #define CONF_FLAGS_ENCRYPTED 0x00002000
57 #define CONF_FLAGS_IN_DATABASE 0x00004000
58 #define CONF_FLAGS_EXEMPTRESV 0x00008000
59 #define CONF_FLAGS_SSL 0x00010000
60 #define CONF_FLAGS_WEBIRC 0x00020000
61
62 /* Macros for struct MaskItem */
63 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
64 #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
65 #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
66 #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
67 #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
68 #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
69 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
70 #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
71 #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
72 #define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD)
73 #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
74 #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
75 #define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
76 #define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED)
77 #define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED)
78 #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
79 #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
80 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
81 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
82 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
83 #define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL)
84 #define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL)
85 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
86 #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
87
88
89 /* shared/cluster server entry types
90 * These defines are used for both shared and cluster.
91 */
92 #define SHARED_KLINE 0x0001
93 #define SHARED_UNKLINE 0x0002
94 #define SHARED_XLINE 0x0004
95 #define SHARED_UNXLINE 0x0008
96 #define SHARED_RESV 0x0010
97 #define SHARED_UNRESV 0x0020
98 #define SHARED_LOCOPS 0x0040
99 #define SHARED_DLINE 0x0080
100 #define SHARED_UNDLINE 0x0100
101 #define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\
102 SHARED_XLINE | SHARED_UNXLINE |\
103 SHARED_RESV | SHARED_UNRESV |\
104 SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
105
106
107 enum maskitem_type
108 {
109 CONF_CLIENT = 1 << 0,
110 CONF_SERVER = 1 << 1,
111 CONF_KLINE = 1 << 2,
112 CONF_DLINE = 1 << 3,
113 CONF_EXEMPT = 1 << 4,
114 CONF_CLUSTER = 1 << 5,
115 CONF_XLINE = 1 << 6,
116 CONF_ULINE = 1 << 7,
117 CONF_GLINE = 1 << 8,
118 CONF_CRESV = 1 << 9,
119 CONF_NRESV = 1 << 10,
120 CONF_SERVICE = 1 << 11,
121 CONF_OPER = 1 << 12,
122 };
123
124 enum
125 {
126 NOT_AUTHORIZED = -1,
127 I_LINE_FULL = -2,
128 TOO_MANY = -3,
129 BANNED_CLIENT = -4,
130 TOO_FAST = -5
131 };
132
133 struct conf_parser_context
134 {
135 unsigned int boot;
136 unsigned int pass;
137 FILE *conf_file;
138 };
139
140 struct split_nuh_item
141 {
142 dlink_node node;
143
144 char *nuhmask;
145 char *nickptr;
146 char *userptr;
147 char *hostptr;
148
149 size_t nicksize;
150 size_t usersize;
151 size_t hostsize;
152 };
153
154 struct MaskItem
155 {
156 dlink_node node;
157 dlink_list leaf_list;
158 dlink_list hub_list;
159 dlink_list exempt_list;
160 enum maskitem_type type;
161 unsigned int dns_failed;
162 unsigned int dns_pending;
163 unsigned int flags;
164 unsigned int modes;
165 unsigned int port;
166 unsigned int count;
167 unsigned int aftype;
168 unsigned int active;
169 unsigned int htype;
170 unsigned int ref_count; /* Number of *LOCAL* clients using this */
171 int bits;
172 time_t until; /* Hold action until this time (calendar time) */
173 time_t setat;
174 struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
175 struct irc_ssaddr addr; /* ip to connect to */
176 struct ClassItem *class; /* Class of connection */
177 char *name;
178 char *user; /* user part of user@host */
179 char *host; /* host part of user@host */
180 char *passwd;
181 char *spasswd; /* Password to send. */
182 char *reason;
183 char *certfp;
184 char *cipher_list;
185 void *rsa_public_key;
186 };
187
188 struct exempt
189 {
190 dlink_node node;
191 char *name;
192 char *user;
193 char *host;
194 size_t len;
195 time_t when;
196 struct irc_ssaddr addr;
197 int bits;
198 int type;
199 int coid;
200 };
201
202 struct CidrItem
203 {
204 dlink_node node;
205 struct irc_ssaddr mask;
206 unsigned int number_on_this_cidr;
207 };
208
209 struct config_file_entry
210 {
211 const char *dpath; /* DPATH if set from command line */
212 const char *configfile;
213 const char *klinefile;
214 const char *glinefile;
215 const char *xlinefile;
216 const char *dlinefile;
217 const char *resvfile;
218 char *mpath;
219 char *rpath;
220
221 char *egdpool_path;
222 char *service_name;
223
224 int gline_min_cidr;
225 int gline_min_cidr6;
226 int dots_in_ident;
227 int failed_oper_notice;
228 int anti_spam_exit_message_time;
229 unsigned int max_accept;
230 unsigned int max_watch;
231 int max_nick_time;
232 unsigned int max_nick_changes;
233 int ts_max_delta;
234 int ts_warn_delta;
235 int anti_nick_flood;
236 int warn_no_nline;
237 int invisible_on_connect;
238 int stats_e_disabled;
239 int stats_o_oper_only;
240 int stats_k_oper_only;
241 int stats_i_oper_only;
242 int stats_P_oper_only;
243 int stats_u_oper_only;
244 int short_motd;
245 int no_oper_flood;
246 int true_no_oper_flood;
247 int oper_pass_resv;
248 int glines;
249 int hide_spoof_ips;
250 int tkline_expire_notices;
251 int opers_bypass_callerid;
252 int ignore_bogus_ts;
253 int pace_wait;
254 int pace_wait_simple;
255 int gline_time;
256 int gline_request_time;
257 int oper_only_umodes;
258 int oper_umodes;
259 int max_targets;
260 int caller_id_wait;
261 int min_nonwildcard;
262 int min_nonwildcard_simple;
263 int kill_chase_time_limit;
264 int default_floodcount;
265 /* 0 == don't use throttle... */
266 int throttle_time;
267 int use_egd;
268 int ping_cookie;
269 int disable_auth;
270 int cycle_on_host_change;
271 };
272
273 struct config_channel_entry
274 {
275 int disable_fake_channels;
276 int knock_delay;
277 int knock_delay_channel;
278 unsigned int max_bans;
279 unsigned int max_chans_per_user;
280 unsigned int max_chans_per_oper;
281 int no_create_on_split;
282 int no_join_on_split;
283 int default_split_server_count;
284 int default_split_user_count;
285 };
286
287 struct config_server_hide
288 {
289 char *hidden_name;
290 int flatten_links;
291 int disable_remote_commands;
292 int hide_servers;
293 int hide_services;
294 int links_delay;
295 int links_disabled;
296 int hidden;
297 int hide_server_ips;
298 };
299
300 struct server_info
301 {
302 char *sid;
303 char *name;
304 char *description;
305 char *network_name;
306 char *network_desc;
307 char *rsa_private_key_file;
308 void *rsa_private_key;
309 void *server_ctx;
310 void *client_ctx;
311 int hub;
312 struct irc_ssaddr ip;
313 struct irc_ssaddr ip6;
314 unsigned int max_clients;
315 unsigned int max_nick_length;
316 unsigned int max_topic_length;
317 int specific_ipv4_vhost;
318 int specific_ipv6_vhost;
319 struct sockaddr_in dns_host;
320 int can_use_v6;
321 };
322
323 struct admin_info
324 {
325 char *name;
326 char *description;
327 char *email;
328 };
329
330 struct logging_entry
331 {
332 unsigned int use_logging;
333 };
334
335 extern dlink_list flatten_links;
336 extern dlink_list server_items;
337 extern dlink_list cluster_items;
338 extern dlink_list xconf_items;
339 extern dlink_list uconf_items;
340 extern dlink_list oconf_items;
341 extern dlink_list service_items;
342 extern dlink_list nresv_items;
343 extern dlink_list cresv_items;
344 extern struct conf_parser_context conf_parser_ctx;
345 extern struct logging_entry ConfigLoggingEntry;
346 extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/
347 extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/
348 extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
349 extern struct server_info ServerInfo; /* defined in ircd.c */
350 extern struct admin_info AdminInfo; /* defined in ircd.c */
351 extern int valid_wild_card_simple(const char *);
352 extern int valid_wild_card(struct Client *, int, int, ...);
353 /* End GLOBAL section */
354
355 extern void init_ip_hash_table(void);
356 extern void count_ip_hash(unsigned int *, uint64_t *);
357 extern void remove_one_ip(struct irc_ssaddr *);
358 extern struct MaskItem *conf_make(enum maskitem_type);
359 extern void read_conf_files(int);
360 extern int attach_conf(struct Client *, struct MaskItem *);
361 extern int attach_connect_block(struct Client *, const char *, const char *);
362 extern int check_client(struct Client *);
363
364
365 extern void detach_conf(struct Client *, enum maskitem_type);
366 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
367 extern int conf_connect_allowed(struct irc_ssaddr *, int);
368 extern char *oper_privs_as_string(const unsigned int);
369 extern void split_nuh(struct split_nuh_item *);
370 extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
371 const char *, const char *, unsigned int);
372 extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
373 const char *, const char *);
374 extern void conf_free(struct MaskItem *);
375 extern void yyerror(const char *);
376 extern void conf_error_report(const char *);
377 extern void cleanup_tklines(void *);
378 extern int rehash(int);
379 extern void lookup_confhost(struct MaskItem *);
380 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
381
382 extern const char *get_oper_name(const struct Client *);
383
384 /* XXX should the parse_aline stuff go into another file ?? */
385 #define AWILD 0x1 /* check wild cards */
386 extern int parse_aline(const char *, struct Client *, int, char **,
387 int, char **, char **, time_t *, char **, char **);
388 extern int valid_comment(struct Client *, char *, int);
389
390
391 #define TK_SECONDS 0
392 #define TK_MINUTES 1
393 extern time_t valid_tkline(const char *, const int);
394 extern int match_conf_password(const char *, const struct MaskItem *);
395
396 #define CLEANUP_TKLINES_TIME 60
397
398 extern void cluster_a_line(struct Client *, const char *, int, int, const char *,...);
399 #endif /* INCLUDED_s_conf_h */

Properties

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