]> jfr.im git - irc/rqf/shadowircd.git/blob - include/s_conf.h
Remove silly a2client_p, entirely pointless since User.server removal.
[irc/rqf/shadowircd.git] / include / s_conf.h
1 /*
2 * charybdis: Advanced, scalable Internet Relay Chat.
3 * s_conf.h: A header for the configuration functions.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2004 ircd-ratbox development team
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 *
24 * $Id: s_conf.h 3550 2007-08-09 06:47:26Z nenolod $
25 */
26
27 #ifndef INCLUDED_s_conf_h
28 #define INCLUDED_s_conf_h
29 #include "setup.h"
30
31 #ifdef HAVE_LIBCRYPTO
32 #include <openssl/rsa.h>
33 #endif
34
35 #include "ircd_defs.h"
36 #include "class.h"
37 #include "client.h"
38 #include "common.h"
39 #include "patricia.h"
40
41 struct Client;
42 struct DNSReply;
43 struct hostent;
44
45 /* used by new parser */
46 /* yacc/lex love globals!!! */
47
48 struct ip_value
49 {
50 struct irc_sockaddr_storage ip;
51 int ip_mask;
52 int type;
53 };
54
55 extern FILE *conf_fbfile_in;
56 extern char conf_line_in[256];
57
58 struct ConfItem
59 {
60 struct ConfItem *next; /* list node pointer */
61 unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
62 unsigned int flags;
63 int clients; /* Number of *LOCAL* clients using this */
64 char *name; /* IRC name, nick, server name, or original u@h */
65 char *host; /* host part of user@host */
66 char *passwd; /* doubles as kline reason *ugh* */
67 char *spasswd; /* Password to send. */
68 char *user; /* user part of user@host */
69 int port;
70 time_t hold; /* Hold action until this time (calendar time) */
71 char *className; /* Name of class */
72 struct Class *c_class; /* Class of connection */
73 patricia_node_t *pnode; /* Our patricia node */
74 };
75
76 #define CONF_ILLEGAL 0x80000000
77 #define CONF_CLIENT 0x0002
78 #define CONF_KILL 0x0040
79 #define CONF_XLINE 0x0080
80 #define CONF_RESV_CHANNEL 0x0100
81 #define CONF_RESV_NICK 0x0200
82 #define CONF_RESV (CONF_RESV_CHANNEL | CONF_RESV_NICK)
83
84 #define CONF_GLINE 0x10000
85 #define CONF_DLINE 0x20000
86 #define CONF_EXEMPTDLINE 0x100000
87
88 #define IsIllegal(x) ((x)->status & CONF_ILLEGAL)
89
90 /* aConfItem->flags */
91
92 /* Generic flags... */
93 /* access flags... */
94 #define CONF_FLAGS_NO_TILDE 0x00000004
95 #define CONF_FLAGS_NEED_IDENTD 0x00000008
96 #define CONF_FLAGS_EXEMPTKLINE 0x00000040
97 #define CONF_FLAGS_NOLIMIT 0x00000080
98 #define CONF_FLAGS_SPOOF_IP 0x00000200
99 #define CONF_FLAGS_SPOOF_NOTICE 0x00000400
100 #define CONF_FLAGS_REDIR 0x00000800
101 #define CONF_FLAGS_EXEMPTGLINE 0x00001000
102 #define CONF_FLAGS_EXEMPTRESV 0x00002000 /* exempt from resvs */
103 #define CONF_FLAGS_EXEMPTFLOOD 0x00004000
104 #define CONF_FLAGS_EXEMPTSPAMBOT 0x00008000
105 #define CONF_FLAGS_EXEMPTSHIDE 0x00010000
106 #define CONF_FLAGS_EXEMPTJUPE 0x00020000 /* exempt from resv generating warnings */
107 #define CONF_FLAGS_NEED_SASL 0x00040000
108 /* server flags */
109 #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00080000
110 #define CONF_FLAGS_LAZY_LINK 0x00100000
111 #define CONF_FLAGS_ENCRYPTED 0x00200000
112 #define CONF_FLAGS_COMPRESSED 0x00400000
113 #define CONF_FLAGS_TEMPORARY 0x00800000
114 #define CONF_FLAGS_TB 0x01000000
115 #define CONF_FLAGS_VHOSTED 0x02000000
116 #define CONF_FLAGS_EXEMPTDNSBL 0x04000000
117
118
119 /* Macros for struct ConfItem */
120 #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
121 #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
122 #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
123 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
124 #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
125 #define IsConfExemptFlood(x) ((x)->flags & CONF_FLAGS_EXEMPTFLOOD)
126 #define IsConfExemptSpambot(x) ((x)->flags & CONF_FLAGS_EXEMPTSPAMBOT)
127 #define IsConfExemptShide(x) ((x)->flags & CONF_FLAGS_EXEMPTSHIDE)
128 #define IsConfExemptJupe(x) ((x)->flags & CONF_FLAGS_EXEMPTJUPE)
129 #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
130 #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
131 #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
132 #define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
133 #define IsConfCompressed(x) ((x)->flags & CONF_FLAGS_COMPRESSED)
134 #define IsConfVhosted(x) ((x)->flags & CONF_FLAGS_VHOSTED)
135 #define IsConfTburst(x) ((x)->flags & CONF_FLAGS_TB)
136 #define IsNeedSasl(x) ((x)->flags & CONF_FLAGS_NEED_SASL)
137 #define IsConfExemptDNSBL(x) ((x)->flags & CONF_FLAGS_EXEMPTDNSBL)
138
139 /* flag definitions for opers now in client.h */
140
141 struct config_file_entry
142 {
143 const char *dpath; /* DPATH if set from command line */
144 const char *configfile;
145 const char *klinefile;
146 const char *dlinefile;
147 const char *xlinefile;
148 const char *resvfile;
149
150 char *servlink_path;
151 char *egdpool_path;
152
153 char *default_operstring;
154 char *default_adminstring;
155 char *servicestring;
156 char *kline_reason;
157
158 char *identifyservice;
159 char *identifycommand;
160
161 char *fname_userlog;
162 char *fname_fuserlog;
163 char *fname_operlog;
164 char *fname_foperlog;
165 char *fname_serverlog;
166 char *fname_killlog;
167 char *fname_glinelog;
168 char *fname_klinelog;
169 char *fname_operspylog;
170 char *fname_ioerrorlog;
171
172 unsigned char compression_level;
173 int disable_fake_channels;
174 int dots_in_ident;
175 int failed_oper_notice;
176 int anti_nick_flood;
177 int anti_spam_exit_message_time;
178 int max_accept;
179 int max_monitor;
180 int max_nick_time;
181 int max_nick_changes;
182 int ts_max_delta;
183 int ts_warn_delta;
184 int dline_with_reason;
185 int kline_with_reason;
186 int kline_delay;
187 int warn_no_nline;
188 int nick_delay;
189 int non_redundant_klines;
190 int stats_e_disabled;
191 int stats_c_oper_only;
192 int stats_y_oper_only;
193 int stats_h_oper_only;
194 int stats_o_oper_only;
195 int stats_k_oper_only;
196 int stats_i_oper_only;
197 int stats_P_oper_only;
198 int map_oper_only;
199 int operspy_admin_only;
200 int pace_wait;
201 int pace_wait_simple;
202 int short_motd;
203 int no_oper_flood;
204 int glines;
205 int gline_time;
206 int gline_min_cidr;
207 int gline_min_cidr6;
208 int hide_server;
209 int hide_spoof_ips;
210 int hide_error_messages;
211 int client_exit;
212 int oper_only_umodes;
213 int oper_umodes;
214 int oper_snomask;
215 int max_targets;
216 int caller_id_wait;
217 int min_nonwildcard;
218 int min_nonwildcard_simple;
219 int default_floodcount;
220 int client_flood;
221 int use_egd;
222 int ping_cookie;
223 int tkline_expire_notices;
224 int use_whois_actually;
225 int disable_auth;
226 int connect_timeout;
227 int burst_away;
228 int reject_ban_time;
229 int reject_after_count;
230 int reject_duration;
231 int target_change;
232 int collision_fnc;
233 int default_umodes;
234 int global_snotices;
235 int operspy_dont_care_user_info;
236 int max_unknown_ip;
237 };
238
239 struct config_channel_entry
240 {
241 int use_except;
242 int use_invex;
243 int use_knock;
244 int use_forward;
245 int knock_delay;
246 int knock_delay_channel;
247 int max_bans;
248 int max_bans_large;
249 int max_chans_per_user;
250 int no_create_on_split;
251 int no_join_on_split;
252 int default_split_server_count;
253 int default_split_user_count;
254 int burst_topicwho;
255 int kick_on_split_riding;
256 };
257
258 struct config_server_hide
259 {
260 int flatten_links;
261 int links_delay;
262 int hidden;
263 int disable_hidden;
264 };
265
266 struct server_info
267 {
268 char *name;
269 char sid[3];
270 char *description;
271 char *network_name;
272 char *network_desc;
273 int hub;
274 struct sockaddr_in ip;
275 #ifdef IPV6
276 struct sockaddr_in6 ip6;
277 #endif
278 int specific_ipv4_vhost;
279 #ifdef IPV6
280 int specific_ipv6_vhost;
281 #endif
282
283 int max_clients;
284 };
285
286 struct admin_info
287 {
288 char *name;
289 char *description;
290 char *email;
291 };
292
293 struct alias_entry
294 {
295 char *name;
296 char *target;
297 int flags; /* reserved for later use */
298 int hits;
299 };
300
301 /* All variables are GLOBAL */
302 extern int specific_ipv4_vhost; /* used in s_bsd.c */
303 extern int specific_ipv6_vhost;
304 extern struct config_file_entry ConfigFileEntry; /* defined in ircd.c */
305 extern struct config_channel_entry ConfigChannel; /* defined in channel.c */
306 extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
307 extern struct server_info ServerInfo; /* defined in ircd.c */
308 extern struct admin_info AdminInfo; /* defined in ircd.c */
309 /* End GLOBAL section */
310
311 dlink_list service_list;
312
313 typedef enum temp_list
314 {
315 TEMP_MIN,
316 TEMP_HOUR,
317 TEMP_DAY,
318 TEMP_WEEK,
319 LAST_TEMP_TYPE
320 } temp_list;
321
322 dlink_list temp_klines[LAST_TEMP_TYPE];
323 dlink_list temp_dlines[LAST_TEMP_TYPE];
324
325 extern void init_s_conf(void);
326
327 extern struct ConfItem *make_conf(void);
328 extern void free_conf(struct ConfItem *);
329
330 extern void read_conf_files(int cold);
331
332 extern int attach_conf(struct Client *, struct ConfItem *);
333 extern int check_client(struct Client *client_p, struct Client *source_p, const char *);
334
335 extern int detach_conf(struct Client *);
336
337 extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
338 extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *);
339 extern void get_printable_conf(struct ConfItem *,
340 char **, char **, char **, char **, int *, char **);
341 extern void get_printable_kline(struct Client *, struct ConfItem *,
342 char **, char **, char **, char **);
343
344 extern void yyerror(const char *);
345 extern int conf_yy_fatal_error(const char *);
346 extern int conf_fgets(char *, int, FILE *);
347
348 typedef enum
349 {
350 CONF_TYPE,
351 KLINE_TYPE,
352 DLINE_TYPE,
353 RESV_TYPE
354 }
355 KlineType;
356
357 extern void write_confitem(KlineType, struct Client *, char *, char *,
358 const char *, const char *, const char *, int);
359 extern void add_temp_kline(struct ConfItem *);
360 extern void add_temp_dline(struct ConfItem *);
361 extern void report_temp_klines(struct Client *);
362 extern void show_temp_klines(struct Client *, dlink_list *);
363
364 extern const char *get_conf_name(KlineType);
365 extern int rehash(int);
366 extern void rehash_bans(int);
367
368 extern int conf_add_server(struct ConfItem *, int);
369 extern void conf_add_class_to_conf(struct ConfItem *);
370 extern void conf_add_me(struct ConfItem *);
371 extern void conf_add_class(struct ConfItem *, int);
372 extern void conf_add_d_conf(struct ConfItem *);
373 extern void flush_expired_ips(void *);
374
375
376 /* XXX consider moving these into kdparse.h */
377 extern void parse_k_file(FILE * fb);
378 extern void parse_d_file(FILE * fb);
379 extern void parse_x_file(FILE * fb);
380 extern void parse_resv_file(FILE *);
381 extern char *getfield(char *newline);
382
383 extern char *get_oper_name(struct Client *client_p);
384
385 extern int yylex(void);
386
387 extern unsigned long cidr_to_bitmask[];
388
389 extern char conffilebuf[IRCD_BUFSIZE + 1];
390 extern int lineno;
391
392 #define NOT_AUTHORISED (-1)
393 #define SOCKET_ERROR (-2)
394 #define I_LINE_FULL (-3)
395 #define BANNED_CLIENT (-4)
396 #define TOO_MANY_LOCAL (-6)
397 #define TOO_MANY_GLOBAL (-7)
398 #define TOO_MANY_IDENT (-8)
399
400 #endif /* INCLUDED_s_conf_h */