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