ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 1798
Committed: Sun Mar 31 17:09:50 2013 UTC (12 years, 4 months ago) by michael
Content type: text/x-chdr
File size: 12850 byte(s)
Log Message:
- Cleanup/reorganize header file layout
- Fixed naming convention in some places

File Contents

# Content
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 #define IsConfOperator(x) ((x)->type == CONF_OPER)
38 #define IsConfKill(x) ((x)->type == CONF_KLINE)
39 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
40 #define IsConfGline(x) ((x)->type == CONF_GLINE)
41
42 /* MaskItem->flags */
43 #define CONF_FLAGS_DO_IDENTD 0x00000001
44 #define CONF_FLAGS_LIMIT_IP 0x00000002
45 #define CONF_FLAGS_NO_TILDE 0x00000004
46 #define CONF_FLAGS_NEED_IDENTD 0x00000008
47 #define CONF_FLAGS_NOMATCH_IP 0x00000010
48 #define CONF_FLAGS_EXEMPTKLINE 0x00000020
49 #define CONF_FLAGS_NOLIMIT 0x00000040
50 #define CONF_FLAGS_SPOOF_IP 0x00000080
51 #define CONF_FLAGS_SPOOF_NOTICE 0x00000100
52 #define CONF_FLAGS_REDIR 0x00000200
53 #define CONF_FLAGS_EXEMPTGLINE 0x00000400
54 #define CONF_FLAGS_CAN_FLOOD 0x00000800
55 #define CONF_FLAGS_NEED_PASSWORD 0x00001000
56 #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00002000
57 #define CONF_FLAGS_ENCRYPTED 0x00004000
58 #define CONF_FLAGS_IN_DATABASE 0x00008000
59 #define CONF_FLAGS_EXEMPTRESV 0x00010000
60 #define CONF_FLAGS_SSL 0x00020000
61 #define CONF_FLAGS_WEBIRC 0x00040000
62
63 /* Macros for struct MaskItem */
64 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
65 #define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP)
66 #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
67 #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
68 #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
69 #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
70 #define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP)
71 #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
72 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
73 #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
74 #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
75 #define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD)
76 #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
77 #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
78 #define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
79 #define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED)
80 #define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED)
81 #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
82 #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
83 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
84 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
85 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
86 #define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL)
87 #define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL)
88 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
89 #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
90
91
92 /* shared/cluster server entry types
93 * These defines are used for both shared and cluster.
94 */
95 #define SHARED_KLINE 0x0001
96 #define SHARED_UNKLINE 0x0002
97 #define SHARED_XLINE 0x0004
98 #define SHARED_UNXLINE 0x0008
99 #define SHARED_RESV 0x0010
100 #define SHARED_UNRESV 0x0020
101 #define SHARED_LOCOPS 0x0040
102 #define SHARED_DLINE 0x0080
103 #define SHARED_UNDLINE 0x0100
104 #define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\
105 SHARED_XLINE | SHARED_UNXLINE |\
106 SHARED_RESV | SHARED_UNRESV |\
107 SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
108
109
110 enum maskitem_type
111 {
112 CONF_RESERVED = 1 << 0, /* XXX */
113 CONF_CLIENT = 1 << 1,
114 CONF_SERVER = 1 << 2,
115 CONF_KLINE = 1 << 3,
116 CONF_DLINE = 1 << 4,
117 CONF_EXEMPT = 1 << 5,
118 CONF_CLUSTER = 1 << 6,
119 CONF_RKLINE = 1 << 7,
120 CONF_RXLINE = 1 << 8,
121 CONF_XLINE = 1 << 9,
122 CONF_ULINE = 1 << 10,
123 CONF_GLINE = 1 << 11,
124 CONF_CRESV = 1 << 12,
125 CONF_NRESV = 1 << 13,
126 CONF_SERVICE = 1 << 14,
127 CONF_OPER = 1 << 15,
128 CONF_HUB = 1 << 16, /* XXX There are no separate hub/leaf configs anymore. This is just for /stats h */
129 CONF_CLASS = 1 << 17 /* XXX Same here; just for /stats Y|y */
130 };
131
132 struct conf_parser_context
133 {
134 unsigned int boot;
135 unsigned int pass;
136 FILE *conf_file;
137 };
138
139 struct split_nuh_item
140 {
141 dlink_node node;
142
143 char *nuhmask;
144 char *nickptr;
145 char *userptr;
146 char *hostptr;
147
148 size_t nicksize;
149 size_t usersize;
150 size_t hostsize;
151 };
152
153 struct MaskItem
154 {
155 struct MaskItem *hnext;
156 dlink_node node;
157 dlink_list leaf_list;
158 dlink_list hub_list;
159 enum maskitem_type type;
160 unsigned int dns_failed;
161 unsigned int dns_pending;
162 unsigned int flags;
163 unsigned int modes;
164 unsigned int port;
165 unsigned int count;
166 unsigned int aftype;
167 unsigned int active;
168 unsigned int htype;
169 unsigned int ref_count; /* Number of *LOCAL* clients using this */
170 int bits;
171 time_t until; /* Hold action until this time (calendar time) */
172 time_t setat;
173 struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
174 struct irc_ssaddr addr; /* ip to connect to */
175 struct ClassItem *class; /* Class of connection */
176 char *name;
177 char *user; /* user part of user@host */
178 char *host; /* host part of user@host */
179 char *passwd;
180 char *spasswd; /* Password to send. */
181 char *reason;
182 char *cipher_list;
183 void *rsa_public_key;
184 void *regexuser;
185 void *regexhost;
186 };
187
188 struct CidrItem
189 {
190 dlink_node node;
191 struct irc_ssaddr mask;
192 unsigned int number_on_this_cidr;
193 };
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 unsigned int max_nick_length;
302 unsigned int max_topic_length;
303 int specific_ipv4_vhost;
304 int specific_ipv6_vhost;
305 struct sockaddr_in dns_host;
306 int can_use_v6;
307 };
308
309 struct admin_info
310 {
311 char *name;
312 char *description;
313 char *email;
314 };
315
316 struct logging_entry
317 {
318 unsigned int use_logging;
319 };
320
321 extern dlink_list server_items;
322 extern dlink_list cluster_items;
323 extern dlink_list xconf_items;
324 extern dlink_list rxconf_items;
325 extern dlink_list rkconf_items;
326 extern dlink_list service_items;
327 extern struct conf_parser_context conf_parser_ctx;
328 extern struct logging_entry ConfigLoggingEntry;
329 extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/
330 extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/
331 extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
332 extern struct server_info ServerInfo; /* defined in ircd.c */
333 extern struct admin_info AdminInfo; /* defined in ircd.c */
334 extern int valid_wild_card(struct Client *, int, int, ...);
335 /* End GLOBAL section */
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 conf_error_report(const char *);
362 extern void cleanup_tklines(void *);
363 extern int rehash(int);
364 extern void lookup_confhost(struct MaskItem *);
365 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
366
367 extern const char *get_oper_name(const struct Client *);
368
369 /* XXX should the parse_aline stuff go into another file ?? */
370 #define AWILD 0x1 /* check wild cards */
371 extern int parse_aline(const char *, struct Client *, int, char **,
372 int, char **, char **, time_t *, char **, char **);
373 extern int valid_comment(struct Client *, char *, int);
374
375
376 #define TK_SECONDS 0
377 #define TK_MINUTES 1
378 extern time_t valid_tkline(const char *, int);
379 extern int match_conf_password(const char *, const struct MaskItem *);
380
381 #define NOT_AUTHORIZED (-1)
382 #define I_LINE_FULL (-2)
383 #define TOO_MANY (-3)
384 #define BANNED_CLIENT (-4)
385 #define TOO_FAST (-5)
386
387 #define CLEANUP_TKLINES_TIME 60
388
389 extern void cluster_a_line(struct Client *,
390 const char *, int, int, const char *,...);
391 #endif /* INCLUDED_s_conf_h */

Properties

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