]> jfr.im git - solanum.git/blame - include/s_conf.h
Remove various obsolete ConfItem statuses (types) and flags.
[solanum.git] / include / s_conf.h
CommitLineData
212380e3
AC
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
AC
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
41struct Client;
42struct DNSReply;
43struct hostent;
44
45/* used by new parser */
46/* yacc/lex love globals!!! */
47
48struct ip_value
49{
50 struct irc_sockaddr_storage ip;
51 int ip_mask;
52 int type;
53};
54
55extern FILE *conf_fbfile_in;
56extern char conf_line_in[256];
57
58struct 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
212380e3
AC
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
212380e3
AC
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... */
212380e3
AC
94#define CONF_FLAGS_NO_TILDE 0x00000004
95#define CONF_FLAGS_NEED_IDENTD 0x00000008
212380e3
AC
96#define CONF_FLAGS_EXEMPTKLINE 0x00000040
97#define CONF_FLAGS_NOLIMIT 0x00000080
98#define CONF_FLAGS_IDLE_LINED 0x00000100
99#define CONF_FLAGS_SPOOF_IP 0x00000200
100#define CONF_FLAGS_SPOOF_NOTICE 0x00000400
101#define CONF_FLAGS_REDIR 0x00000800
102#define CONF_FLAGS_EXEMPTGLINE 0x00001000
103#define CONF_FLAGS_EXEMPTRESV 0x00002000 /* exempt from resvs */
104#define CONF_FLAGS_EXEMPTFLOOD 0x00004000
105#define CONF_FLAGS_EXEMPTSPAMBOT 0x00008000
106#define CONF_FLAGS_EXEMPTSHIDE 0x00010000
107#define CONF_FLAGS_EXEMPTJUPE 0x00020000 /* exempt from resv generating warnings */
108#define CONF_FLAGS_NEED_SASL 0x00040000
109/* server flags */
110#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00080000
111#define CONF_FLAGS_LAZY_LINK 0x00100000
112#define CONF_FLAGS_ENCRYPTED 0x00200000
113#define CONF_FLAGS_COMPRESSED 0x00400000
114#define CONF_FLAGS_TEMPORARY 0x00800000
115#define CONF_FLAGS_TB 0x01000000
116#define CONF_FLAGS_VHOSTED 0x02000000
117#define CONF_FLAGS_EXEMPTDNSBL 0x04000000
118
119
120/* Macros for struct ConfItem */
212380e3
AC
121#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
122#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
212380e3
AC
123#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
124#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
125#define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
126#define IsConfExemptFlood(x) ((x)->flags & CONF_FLAGS_EXEMPTFLOOD)
127#define IsConfExemptSpambot(x) ((x)->flags & CONF_FLAGS_EXEMPTSPAMBOT)
128#define IsConfExemptShide(x) ((x)->flags & CONF_FLAGS_EXEMPTSHIDE)
129#define IsConfExemptJupe(x) ((x)->flags & CONF_FLAGS_EXEMPTJUPE)
130#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
131#define IsConfIdlelined(x) ((x)->flags & CONF_FLAGS_IDLE_LINED)
212380e3
AC
132#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
133#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
134#define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
135#define IsConfCompressed(x) ((x)->flags & CONF_FLAGS_COMPRESSED)
136#define IsConfVhosted(x) ((x)->flags & CONF_FLAGS_VHOSTED)
137#define IsConfTburst(x) ((x)->flags & CONF_FLAGS_TB)
138#define IsNeedSasl(x) ((x)->flags & CONF_FLAGS_NEED_SASL)
139#define IsConfExemptDNSBL(x) ((x)->flags & CONF_FLAGS_EXEMPTDNSBL)
140
141/* flag definitions for opers now in client.h */
142
143struct config_file_entry
144{
145 const char *dpath; /* DPATH if set from command line */
146 const char *configfile;
147 const char *klinefile;
148 const char *dlinefile;
149 const char *xlinefile;
150 const char *resvfile;
151
152 char *servlink_path;
153 char *egdpool_path;
154
155 char *default_operstring;
156 char *default_adminstring;
157 char *servicestring;
158 char *kline_reason;
159
160 char *identifyservice;
161 char *identifycommand;
162
163 char *fname_userlog;
164 char *fname_fuserlog;
165 char *fname_operlog;
166 char *fname_foperlog;
167 char *fname_serverlog;
168 char *fname_killlog;
169 char *fname_glinelog;
170 char *fname_klinelog;
171 char *fname_operspylog;
172 char *fname_ioerrorlog;
173
174 unsigned char compression_level;
175 int disable_fake_channels;
212380e3
AC
176 int dots_in_ident;
177 int failed_oper_notice;
178 int anti_nick_flood;
179 int anti_spam_exit_message_time;
180 int max_accept;
181 int max_monitor;
182 int max_nick_time;
183 int max_nick_changes;
184 int ts_max_delta;
185 int ts_warn_delta;
186 int dline_with_reason;
187 int kline_with_reason;
188 int kline_delay;
189 int warn_no_nline;
190 int nick_delay;
191 int non_redundant_klines;
192 int stats_e_disabled;
193 int stats_c_oper_only;
194 int stats_y_oper_only;
195 int stats_h_oper_only;
196 int stats_o_oper_only;
197 int stats_k_oper_only;
198 int stats_i_oper_only;
199 int stats_P_oper_only;
200 int map_oper_only;
201 int operspy_admin_only;
202 int pace_wait;
203 int pace_wait_simple;
204 int short_motd;
205 int no_oper_flood;
206 int glines;
207 int gline_time;
208 int gline_min_cidr;
209 int gline_min_cidr6;
210 int idletime;
211 int hide_server;
212 int hide_spoof_ips;
213 int hide_error_messages;
214 int client_exit;
215 int oper_only_umodes;
216 int oper_umodes;
217 int oper_snomask;
218 int max_targets;
219 int caller_id_wait;
220 int min_nonwildcard;
221 int min_nonwildcard_simple;
222 int default_floodcount;
223 int client_flood;
224 int use_egd;
225 int ping_cookie;
226 int tkline_expire_notices;
227 int use_whois_actually;
228 int disable_auth;
229 int connect_timeout;
230 int burst_away;
231 int reject_ban_time;
232 int reject_after_count;
233 int reject_duration;
234 int target_change;
235 int collision_fnc;
236 int default_umodes;
237 int global_snotices;
238 int operspy_dont_care_user_info;
54015b5f 239 int max_unknown_ip;
212380e3
AC
240};
241
242struct config_channel_entry
243{
244 int use_except;
245 int use_invex;
246 int use_knock;
247 int use_forward;
248 int knock_delay;
249 int knock_delay_channel;
250 int max_bans;
251 int max_bans_large;
252 int max_chans_per_user;
253 int no_create_on_split;
254 int no_join_on_split;
255 int default_split_server_count;
256 int default_split_user_count;
257 int burst_topicwho;
212380e3
AC
258 int kick_on_split_riding;
259};
260
261struct config_server_hide
262{
263 int flatten_links;
264 int links_delay;
212380e3
AC
265 int hidden;
266 int disable_hidden;
267};
268
269struct server_info
270{
271 char *name;
272 char sid[3];
273 char *description;
274 char *network_name;
275 char *network_desc;
276 int hub;
212380e3
AC
277 struct sockaddr_in ip;
278#ifdef IPV6
279 struct sockaddr_in6 ip6;
280#endif
281 int specific_ipv4_vhost;
282#ifdef IPV6
283 int specific_ipv6_vhost;
284#endif
c2d96fcb
AC
285
286 int max_clients;
212380e3
AC
287};
288
289struct admin_info
290{
291 char *name;
292 char *description;
293 char *email;
294};
295
296struct alias_entry
297{
298 char *name;
299 char *target;
300 int flags; /* reserved for later use */
301 int hits;
302};
303
304/* All variables are GLOBAL */
305extern int specific_ipv4_vhost; /* used in s_bsd.c */
306extern int specific_ipv6_vhost;
307extern struct config_file_entry ConfigFileEntry; /* defined in ircd.c */
308extern struct config_channel_entry ConfigChannel; /* defined in channel.c */
309extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
310extern struct server_info ServerInfo; /* defined in ircd.c */
311extern struct admin_info AdminInfo; /* defined in ircd.c */
312/* End GLOBAL section */
313
314dlink_list service_list;
315
316typedef enum temp_list
317{
318 TEMP_MIN,
319 TEMP_HOUR,
320 TEMP_DAY,
321 TEMP_WEEK,
322 LAST_TEMP_TYPE
323} temp_list;
324
325dlink_list temp_klines[LAST_TEMP_TYPE];
326dlink_list temp_dlines[LAST_TEMP_TYPE];
327
328extern void init_s_conf(void);
329
330extern struct ConfItem *make_conf(void);
331extern void free_conf(struct ConfItem *);
332
333extern void read_conf_files(int cold);
334
335extern int attach_conf(struct Client *, struct ConfItem *);
336extern int check_client(struct Client *client_p, struct Client *source_p, const char *);
337
338extern int detach_conf(struct Client *);
339
212380e3
AC
340extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
341extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *);
342extern void get_printable_conf(struct ConfItem *,
343 char **, char **, char **, char **, int *, char **);
344extern void get_printable_kline(struct Client *, struct ConfItem *,
345 char **, char **, char **, char **);
346
347extern void yyerror(const char *);
348extern int conf_yy_fatal_error(const char *);
349extern int conf_fgets(char *, int, FILE *);
350
351typedef enum
352{
353 CONF_TYPE,
354 KLINE_TYPE,
355 DLINE_TYPE,
356 RESV_TYPE
357}
358KlineType;
359
360extern void write_confitem(KlineType, struct Client *, char *, char *,
361 const char *, const char *, const char *, int);
362extern void add_temp_kline(struct ConfItem *);
363extern void add_temp_dline(struct ConfItem *);
364extern void report_temp_klines(struct Client *);
365extern void show_temp_klines(struct Client *, dlink_list *);
366
367extern const char *get_conf_name(KlineType);
368extern int rehash(int);
369extern void rehash_bans(int);
370
371extern int conf_add_server(struct ConfItem *, int);
372extern void conf_add_class_to_conf(struct ConfItem *);
373extern void conf_add_me(struct ConfItem *);
374extern void conf_add_class(struct ConfItem *, int);
375extern void conf_add_d_conf(struct ConfItem *);
376extern void flush_expired_ips(void *);
377
378
379/* XXX consider moving these into kdparse.h */
380extern void parse_k_file(FILE * fb);
381extern void parse_d_file(FILE * fb);
382extern void parse_x_file(FILE * fb);
383extern void parse_resv_file(FILE *);
384extern char *getfield(char *newline);
385
386extern char *get_oper_name(struct Client *client_p);
387
388extern int yylex(void);
389
390extern unsigned long cidr_to_bitmask[];
391
392extern char conffilebuf[IRCD_BUFSIZE + 1];
393extern int lineno;
394
395#define NOT_AUTHORISED (-1)
396#define SOCKET_ERROR (-2)
397#define I_LINE_FULL (-3)
398#define BANNED_CLIENT (-4)
399#define TOO_MANY_LOCAL (-6)
400#define TOO_MANY_GLOBAL (-7)
401#define TOO_MANY_IDENT (-8)
402
403#endif /* INCLUDED_s_conf_h */