/[svn]/ircd-hybrid/branches/8.2.x/include/conf.h
ViewVC logotype

Contents of /ircd-hybrid/branches/8.2.x/include/conf.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6346 - (show annotations)
Tue Aug 11 17:23:45 2015 UTC (4 years, 11 months ago) by michael
File MIME type: text/x-csrc
File size: 11866 byte(s)
- Cleanup/fix names of several #ifndef INCLUDED_*

1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2015 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file conf.h
23 * \brief A header for the configuration functions.
24 * \version $Id$
25 */
26
27 #ifndef INCLUDED_conf_h
28 #define INCLUDED_conf_h
29 #include "config.h"
30 #include "ircd_defs.h"
31 #include "client.h"
32 #include "conf_class.h"
33
34
35 #define CONF_NOREASON "<No reason supplied>"
36
37 /* MaskItem->flags */
38 enum
39 {
40 CONF_FLAGS_NO_TILDE = 0x00000001U,
41 CONF_FLAGS_NEED_IDENTD = 0x00000002U,
42 CONF_FLAGS_EXEMPTKLINE = 0x00000004U,
43 CONF_FLAGS_NOLIMIT = 0x00000008U,
44 CONF_FLAGS_SPOOF_IP = 0x00000010U,
45 CONF_FLAGS_SPOOF_NOTICE = 0x00000020U,
46 CONF_FLAGS_REDIR = 0x00000040U,
47 CONF_FLAGS_CAN_FLOOD = 0x00000080U,
48 CONF_FLAGS_NEED_PASSWORD = 0x00000100U,
49 CONF_FLAGS_ALLOW_AUTO_CONN = 0x00000200U,
50 CONF_FLAGS_ENCRYPTED = 0x00000400U,
51 CONF_FLAGS_IN_DATABASE = 0x00000800U,
52 CONF_FLAGS_EXEMPTRESV = 0x00001000U,
53 CONF_FLAGS_SSL = 0x00002000U,
54 CONF_FLAGS_WEBIRC = 0x00004000U,
55 CONF_FLAGS_EXEMPTXLINE = 0x00008000U
56 };
57
58 /* Macros for struct MaskItem */
59 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
60 #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
61 #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
62 #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
63 #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
64 #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
65 #define IsConfExemptXline(x) ((x)->flags & CONF_FLAGS_EXEMPTXLINE)
66 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
67 #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
68 #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
69 #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
70 #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
71 #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
72 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
73 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
74 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
75 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
76 #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
77
78
79 /* shared/cluster server entry types
80 * These defines are used for both shared and cluster.
81 */
82 enum
83 {
84 SHARED_KLINE = 0x00000001U,
85 SHARED_UNKLINE = 0x00000002U,
86 SHARED_XLINE = 0x00000004U,
87 SHARED_UNXLINE = 0x00000008U,
88 SHARED_RESV = 0x00000010U,
89 SHARED_UNRESV = 0x00000020U,
90 SHARED_LOCOPS = 0x00000040U,
91 SHARED_DLINE = 0x00000080U,
92 SHARED_UNDLINE = 0x00000100U,
93 SHARED_ALL = 0xFFFFFFFFU
94 };
95
96 enum maskitem_type
97 {
98 CONF_CLIENT = 1 << 0,
99 CONF_SERVER = 1 << 1,
100 CONF_KLINE = 1 << 2,
101 CONF_DLINE = 1 << 3,
102 CONF_EXEMPT = 1 << 4,
103 CONF_CLUSTER = 1 << 5,
104 CONF_XLINE = 1 << 6,
105 CONF_ULINE = 1 << 7,
106 CONF_CRESV = 1 << 8,
107 CONF_NRESV = 1 << 9,
108 CONF_SERVICE = 1 << 10,
109 CONF_OPER = 1 << 11
110 };
111
112 #define IsConfKill(x) ((x)->type == CONF_KLINE)
113 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
114
115 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 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 struct MaskItem
139 {
140 dlink_node node;
141 dlink_list leaf_list;
142 dlink_list hub_list;
143 dlink_list exempt_list;
144 enum maskitem_type type;
145 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 time_t until; /* Hold action until this time (calendar time) */
157 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 char *user; /* user part of user@host */
163 char *host; /* host part of user@host */
164 char *passwd;
165 char *spasswd; /* Password to send. */
166 char *reason;
167 char *certfp;
168 char *whois;
169 char *cipher_list;
170 void *rsa_public_key;
171 };
172
173 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 int country_id;
185 };
186
187 struct CidrItem
188 {
189 dlink_node node;
190 struct irc_ssaddr mask;
191 unsigned int number_on_this_cidr;
192 };
193
194 struct conf_parser_context
195 {
196 unsigned int boot;
197 unsigned int pass;
198 FILE *conf_file;
199 };
200
201 struct config_general_entry
202 {
203 const char *dpath;
204 const char *mpath;
205 const char *spath;
206 const char *configfile;
207 const char *klinefile;
208 const char *xlinefile;
209 const char *dlinefile;
210 const char *resvfile;
211
212 unsigned int dline_min_cidr;
213 unsigned int dline_min_cidr6;
214 unsigned int kline_min_cidr;
215 unsigned int kline_min_cidr6;
216 unsigned int dots_in_ident;
217 unsigned int failed_oper_notice;
218 unsigned int anti_spam_exit_message_time;
219 unsigned int max_accept;
220 unsigned int max_watch;
221 unsigned int away_time;
222 unsigned int away_count;
223 unsigned int max_nick_time;
224 unsigned int max_nick_changes;
225 unsigned int ts_max_delta;
226 unsigned int ts_warn_delta;
227 unsigned int anti_nick_flood;
228 unsigned int warn_no_connect_block;
229 unsigned int invisible_on_connect;
230 unsigned int stats_e_disabled;
231 unsigned int stats_i_oper_only;
232 unsigned int stats_k_oper_only;
233 unsigned int stats_m_oper_only;
234 unsigned int stats_o_oper_only;
235 unsigned int stats_P_oper_only;
236 unsigned int stats_u_oper_only;
237 unsigned int short_motd;
238 unsigned int no_oper_flood;
239 unsigned int oper_pass_resv;
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 oper_only_umodes;
246 unsigned int oper_umodes;
247 unsigned int max_targets;
248 unsigned int caller_id_wait;
249 unsigned int min_nonwildcard;
250 unsigned int min_nonwildcard_simple;
251 unsigned int kill_chase_time_limit;
252 unsigned int default_floodcount;
253 unsigned int throttle_count;
254 unsigned int throttle_time;
255 unsigned int ping_cookie;
256 unsigned int disable_auth;
257 unsigned int cycle_on_host_change;
258 };
259
260 struct config_channel_entry
261 {
262 unsigned int disable_fake_channels;
263 unsigned int invite_client_count;
264 unsigned int invite_client_time;
265 unsigned int knock_client_count;
266 unsigned int knock_client_time;
267 unsigned int knock_delay_channel;
268 unsigned int max_bans;
269 unsigned int max_channels;
270 unsigned int default_join_flood_count;
271 unsigned int default_join_flood_time;
272 unsigned int no_create_on_split;
273 unsigned int no_join_on_split;
274 unsigned int default_split_server_count;
275 unsigned int default_split_user_count;
276 };
277
278 struct config_serverhide_entry
279 {
280 char *hidden_name;
281 unsigned int flatten_links;
282 unsigned int disable_remote_commands;
283 unsigned int hide_servers;
284 unsigned int hide_services;
285 unsigned int links_delay;
286 unsigned int links_disabled;
287 unsigned int hidden;
288 unsigned int hide_server_ips;
289 };
290
291 struct config_serverinfo_entry
292 {
293 #ifdef HAVE_LIBCRYPTO
294 const EVP_MD *message_digest_algorithm;
295 #endif
296 char *sid;
297 char *name;
298 char *description;
299 char *network_name;
300 char *network_desc;
301 char *rsa_private_key_file;
302 void *rsa_private_key;
303 void *server_ctx;
304 void *client_ctx;
305 unsigned int hub;
306 unsigned int default_max_clients;
307 unsigned int max_nick_length;
308 unsigned int max_topic_length;
309 unsigned int specific_ipv4_vhost;
310 unsigned int specific_ipv6_vhost;
311 struct irc_ssaddr ip;
312 struct irc_ssaddr ip6;
313 };
314
315 struct config_admin_entry
316 {
317 char *name;
318 char *description;
319 char *email;
320 };
321
322 struct config_log_entry
323 {
324 unsigned int use_logging;
325 };
326
327 extern dlink_list flatten_links;
328 extern dlink_list server_items;
329 extern dlink_list cluster_items;
330 extern dlink_list xconf_items;
331 extern dlink_list uconf_items;
332 extern dlink_list oconf_items;
333 extern dlink_list service_items;
334 extern dlink_list nresv_items;
335 extern dlink_list cresv_items;
336 extern struct conf_parser_context conf_parser_ctx;
337 extern struct config_log_entry ConfigLog;
338 extern struct config_general_entry ConfigGeneral;
339 extern struct config_channel_entry ConfigChannel;
340 extern struct config_serverhide_entry ConfigServerHide;
341 extern struct config_serverinfo_entry ConfigServerInfo;
342 extern struct config_admin_entry ConfigAdminInfo;
343
344 extern int valid_wild_card_simple(const char *);
345 extern int valid_wild_card(struct Client *, int, ...);
346 /* End GLOBAL section */
347
348 extern struct MaskItem *conf_make(enum maskitem_type);
349 extern void read_conf_files(int);
350 extern int attach_conf(struct Client *, struct MaskItem *);
351 extern int attach_connect_block(struct Client *, const char *, const char *);
352 extern int check_client(struct Client *);
353
354
355 extern void detach_conf(struct Client *, enum maskitem_type);
356 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
357 extern int conf_connect_allowed(struct irc_ssaddr *, int);
358 extern const char *oper_privs_as_string(const unsigned int);
359 extern void split_nuh(struct split_nuh_item *);
360 extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
361 const char *, const char *, unsigned int);
362 extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
363 const char *, const char *);
364 extern void conf_free(struct MaskItem *);
365 extern void yyerror(const char *);
366 extern void conf_error_report(const char *);
367 extern void cleanup_tklines(void *);
368 extern void conf_rehash(int);
369 extern void lookup_confhost(struct MaskItem *);
370 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
371
372 extern const char *get_oper_name(const struct Client *);
373
374 /* XXX should the parse_aline stuff go into another file ?? */
375 #define AWILD 0x1 /* check wild cards */
376 extern int parse_aline(const char *, struct Client *, int, char **,
377 int, char **, char **, time_t *, char **, char **);
378
379 #define TK_SECONDS 0
380 #define TK_MINUTES 1
381 extern time_t valid_tkline(const char *, const int);
382 extern int match_conf_password(const char *, const struct MaskItem *);
383
384 enum { CLEANUP_TKLINES_TIME = 60 };
385
386 extern void cluster_a_line(struct Client *, const char *, unsigned int, unsigned int, const char *,...);
387 #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