ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 9101
Committed: Wed Jan 1 09:58:45 2020 UTC (5 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 10072 byte(s)
Log Message:
- Bump copyright years everywhere

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2865 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 9101 * Copyright (c) 1997-2020 ircd-hybrid development team
5 adx 30 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2865 /*! \file conf.h
23     * \brief A header for the configuration functions.
24     * \version $Id$
25     */
26    
27 michael 6345 #ifndef INCLUDED_conf_h
28     #define INCLUDED_conf_h
29 michael 912 #include "config.h"
30 adx 30 #include "client.h"
31 michael 1632 #include "conf_class.h"
32 michael 7105 #include "tls.h"
33 adx 30
34 michael 967
35 michael 8431 enum
36     {
37     TK_SECONDS,
38     TK_MINUTES
39     };
40    
41     enum { CLEANUP_TKLINES_TIME = 60 };
42    
43 michael 1646 #define CONF_NOREASON "<No reason supplied>"
44 adx 30
45 michael 1798 /* MaskItem->flags */
46 michael 6315 enum
47     {
48 michael 8431 CONF_FLAGS_NO_TILDE = 1 << 0,
49     CONF_FLAGS_NEED_IDENTD = 1 << 1,
50     CONF_FLAGS_EXEMPTKLINE = 1 << 2,
51     CONF_FLAGS_NOLIMIT = 1 << 3,
52     CONF_FLAGS_SPOOF_IP = 1 << 4,
53     CONF_FLAGS_SPOOF_NOTICE = 1 << 5,
54     CONF_FLAGS_REDIR = 1 << 6,
55     CONF_FLAGS_CAN_FLOOD = 1 << 7,
56     CONF_FLAGS_NEED_PASSWORD = 1 << 8,
57     CONF_FLAGS_ALLOW_AUTO_CONN = 1 << 9,
58     CONF_FLAGS_ENCRYPTED = 1 << 10,
59     CONF_FLAGS_IN_DATABASE = 1 << 11,
60     CONF_FLAGS_EXEMPTRESV = 1 << 12,
61     CONF_FLAGS_SSL = 1 << 13,
62     CONF_FLAGS_WEBIRC = 1 << 14,
63     CONF_FLAGS_EXEMPTXLINE = 1 << 15
64 michael 6315 };
65 michael 967
66 michael 1798 /* Macros for struct MaskItem */
67 michael 4340 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
68     #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
69     #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
70     #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
71     #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
72     #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
73 michael 5985 #define IsConfExemptXline(x) ((x)->flags & CONF_FLAGS_EXEMPTXLINE)
74 michael 4340 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
75     #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
76     #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
77     #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
78     #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
79     #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
80 michael 1798 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
81 michael 4340 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
82     #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
83     #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
84     #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
85 michael 1798
86    
87 michael 1632 enum maskitem_type
88     {
89 michael 8437 CONF_CLIENT = 1,
90     CONF_SERVER,
91     CONF_KLINE,
92     CONF_DLINE,
93     CONF_EXEMPT,
94     CONF_OPER
95 michael 1632 };
96 adx 30
97 michael 6315 #define IsConfKill(x) ((x)->type == CONF_KLINE)
98     #define IsConfClient(x) ((x)->type == CONF_CLIENT)
99    
100 michael 3093 enum
101     {
102     NOT_AUTHORIZED = -1,
103     I_LINE_FULL = -2,
104     TOO_MANY = -3,
105     BANNED_CLIENT = -4,
106     TOO_FAST = -5
107     };
108    
109 michael 593 struct split_nuh_item
110     {
111     dlink_node node;
112    
113     char *nuhmask;
114     char *nickptr;
115     char *userptr;
116     char *hostptr;
117    
118     size_t nicksize;
119     size_t usersize;
120     size_t hostsize;
121     };
122    
123 michael 1632 struct MaskItem
124 adx 30 {
125 michael 1644 dlink_node node;
126     dlink_list leaf_list;
127     dlink_list hub_list;
128 michael 1632 enum maskitem_type type;
129 michael 8658 bool active;
130     bool dns_failed;
131     bool dns_pending;
132 michael 1644 unsigned int flags;
133     unsigned int modes;
134     unsigned int port;
135     unsigned int aftype;
136     unsigned int htype;
137     unsigned int ref_count; /* Number of *LOCAL* clients using this */
138     int bits;
139 michael 7330 uintmax_t until; /* Hold action until this time (calendar time) */
140     uintmax_t setat;
141 michael 9096 uintmax_t timeout;
142 michael 8872 struct irc_ssaddr *bind; /* ip to bind to for outgoing connect */
143     struct irc_ssaddr *addr; /* ip to connect to */
144 michael 1644 struct ClassItem *class; /* Class of connection */
145     char *name;
146 michael 1649 char *user; /* user part of user@host */
147 michael 1644 char *host; /* host part of user@host */
148     char *passwd;
149     char *spasswd; /* Password to send. */
150     char *reason;
151 michael 2228 char *certfp;
152 michael 5556 char *whois;
153 michael 1644 char *cipher_list;
154 adx 30 };
155    
156 michael 5602 struct conf_parser_context
157 adx 30 {
158 michael 4080 unsigned int boot;
159     unsigned int pass;
160     FILE *conf_file;
161 michael 5602 };
162 michael 4080
163 michael 5602 struct config_general_entry
164 michael 4080 {
165 michael 4340 const char *dpath;
166 michael 3239 const char *mpath;
167     const char *spath;
168 adx 30 const char *configfile;
169     const char *klinefile;
170     const char *xlinefile;
171     const char *dlinefile;
172 michael 1702 const char *resvfile;
173 adx 30
174 michael 5805 unsigned int dline_min_cidr;
175     unsigned int dline_min_cidr6;
176     unsigned int kline_min_cidr;
177     unsigned int kline_min_cidr6;
178 michael 3870 unsigned int dots_in_ident;
179     unsigned int failed_oper_notice;
180     unsigned int anti_spam_exit_message_time;
181 michael 950 unsigned int max_accept;
182     unsigned int max_watch;
183 michael 7437 unsigned int whowas_history_length;
184 michael 4313 unsigned int away_time;
185     unsigned int away_count;
186 michael 3870 unsigned int max_nick_time;
187 michael 950 unsigned int max_nick_changes;
188 michael 3870 unsigned int ts_max_delta;
189     unsigned int ts_warn_delta;
190     unsigned int anti_nick_flood;
191     unsigned int warn_no_connect_block;
192     unsigned int invisible_on_connect;
193     unsigned int stats_e_disabled;
194 michael 5025 unsigned int stats_i_oper_only;
195     unsigned int stats_k_oper_only;
196     unsigned int stats_m_oper_only;
197 michael 3870 unsigned int stats_o_oper_only;
198     unsigned int stats_P_oper_only;
199     unsigned int stats_u_oper_only;
200     unsigned int short_motd;
201     unsigned int no_oper_flood;
202     unsigned int opers_bypass_callerid;
203     unsigned int pace_wait;
204     unsigned int pace_wait_simple;
205 michael 3674 unsigned int oper_only_umodes;
206     unsigned int oper_umodes;
207 michael 3283 unsigned int max_targets;
208 michael 3870 unsigned int caller_id_wait;
209     unsigned int min_nonwildcard;
210     unsigned int min_nonwildcard_simple;
211     unsigned int kill_chase_time_limit;
212     unsigned int default_floodcount;
213 michael 7858 unsigned int default_floodtime;
214 michael 3877 unsigned int throttle_count;
215 michael 3870 unsigned int throttle_time;
216     unsigned int ping_cookie;
217     unsigned int disable_auth;
218     unsigned int cycle_on_host_change;
219 michael 5602 };
220 adx 30
221 michael 5602 struct config_channel_entry
222 adx 30 {
223 michael 3870 unsigned int disable_fake_channels;
224 michael 3860 unsigned int invite_client_count;
225     unsigned int invite_client_time;
226 michael 6792 unsigned int invite_delay_channel;
227 michael 7793 unsigned int invite_expire_time;
228 michael 3860 unsigned int knock_client_count;
229     unsigned int knock_client_time;
230 michael 3870 unsigned int knock_delay_channel;
231 michael 7766 unsigned int max_invites;
232 adx 30 unsigned int max_bans;
233 michael 8046 unsigned int max_bans_large;
234 michael 3933 unsigned int max_channels;
235 michael 5489 unsigned int default_join_flood_count;
236     unsigned int default_join_flood_time;
237 michael 5602 };
238 adx 30
239 michael 5644 struct config_serverhide_entry
240 adx 30 {
241 michael 1013 char *hidden_name;
242 michael 6599 char *flatten_links_file;
243 michael 3870 unsigned int flatten_links;
244 michael 6597 unsigned int flatten_links_delay;
245 michael 3870 unsigned int disable_remote_commands;
246     unsigned int hide_servers;
247     unsigned int hide_services;
248     unsigned int hidden;
249     unsigned int hide_server_ips;
250 michael 5602 };
251 adx 30
252 michael 5644 struct config_serverinfo_entry
253 adx 30 {
254 michael 1013 char *sid;
255 adx 30 char *name;
256     char *description;
257     char *network_name;
258     char *network_desc;
259     char *rsa_private_key_file;
260 michael 7105 char *ssl_certificate_file;
261     char *ssl_dh_param_file;
262     char *ssl_dh_elliptic_curve;
263     char *ssl_cipher_list;
264     char *ssl_message_digest_algorithm;
265     tls_context_t tls_ctx;
266     tls_md_t message_digest_algorithm;
267 michael 3870 unsigned int hub;
268 michael 5489 unsigned int default_max_clients;
269 michael 1751 unsigned int max_nick_length;
270     unsigned int max_topic_length;
271 michael 5602 };
272 adx 30
273 michael 5644 struct config_admin_entry
274 adx 30 {
275     char *name;
276     char *description;
277     char *email;
278 michael 5602 };
279 adx 30
280 michael 5644 struct config_log_entry
281 adx 30 {
282     unsigned int use_logging;
283 michael 5602 };
284 adx 30
285 michael 8670 struct aline_ctx
286     {
287     bool add;
288 michael 8680 bool simple_mask;
289     char *mask;
290 michael 8670 char *user;
291     char *host;
292     char *reason;
293     char *server;
294     uintmax_t duration;
295     };
296    
297 michael 2156 extern dlink_list flatten_links;
298 michael 7401 extern dlink_list connect_items;
299 michael 6628 extern dlink_list operator_items;
300 michael 5602 extern struct conf_parser_context conf_parser_ctx;
301 michael 5644 extern struct config_log_entry ConfigLog;
302 michael 5602 extern struct config_general_entry ConfigGeneral;
303     extern struct config_channel_entry ConfigChannel;
304 michael 5644 extern struct config_serverhide_entry ConfigServerHide;
305     extern struct config_serverinfo_entry ConfigServerInfo;
306     extern struct config_admin_entry ConfigAdminInfo;
307 michael 3493
308 michael 8660 extern bool valid_wild_card_simple(const char *);
309     extern bool valid_wild_card(int, ...);
310 adx 30
311 michael 1632 extern struct MaskItem *conf_make(enum maskitem_type);
312 michael 8656 extern void read_conf_files(bool);
313 michael 8395 extern int conf_attach(struct Client *, struct MaskItem *);
314 michael 1644 extern int check_client(struct Client *);
315 adx 30
316 michael 1644
317 michael 8395 extern void conf_detach(struct Client *, enum maskitem_type);
318 michael 1632 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
319 michael 8829 extern int conf_connect_allowed(struct irc_ssaddr *);
320 michael 593 extern void split_nuh(struct split_nuh_item *);
321 michael 7403 extern struct MaskItem *operator_find(const struct Client *, const char *);
322 michael 8391 extern struct MaskItem *connect_find(const char *, int (*)(const char *, const char *));
323 michael 1632 extern void conf_free(struct MaskItem *);
324 adx 30 extern void yyerror(const char *);
325 michael 1751 extern void conf_error_report(const char *);
326 adx 30 extern void cleanup_tklines(void *);
327 michael 8658 extern void conf_rehash(bool);
328 michael 1647 extern void lookup_confhost(struct MaskItem *);
329 michael 1632 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
330 adx 30
331 michael 1364 extern const char *get_oper_name(const struct Client *);
332 adx 30
333     /* XXX should the parse_aline stuff go into another file ?? */
334 michael 8670 extern bool parse_aline(const char *, struct Client *, int, char **, struct aline_ctx *);
335 adx 30
336 michael 7330 extern uintmax_t valid_tkline(const char *, const int);
337 michael 8660 extern bool match_conf_password(const char *, const struct MaskItem *);
338 michael 8479 #endif /* INCLUDED_conf_h */

Properties

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