ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 4565
Committed: Sun Aug 24 10:27:40 2014 UTC (11 years ago) by michael
Content type: text/x-chdr
File size: 12184 byte(s)
Log Message:
- Update GPL 2 license headers

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

Properties

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