/[svn]/ircd-hybrid/trunk/include/conf.h
ViewVC logotype

Contents of /ircd-hybrid/trunk/include/conf.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1702 - (show annotations)
Thu Dec 20 15:49:20 2012 UTC (7 years, 11 months ago) by michael
File MIME type: text/x-csrc
File size: 12476 byte(s)
- /info now also shows pathnames of g-/x-line database files

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

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28