ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/include/conf.h
Revision: 8430
Committed: Tue Mar 27 18:48:40 2018 UTC (6 years ago) by michael
Content type: text/x-chdr
File size: 10380 byte(s)
Log Message:
- Stylistic changes

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2018 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_conf_h
28 #define INCLUDED_conf_h
29 #include "config.h"
30 #include "client.h"
31 #include "conf_class.h"
32 #include "tls.h"
33
34
35 enum
36 {
37 TK_SECONDS,
38 TK_MINUTES
39 };
40
41 enum { CLEANUP_TKLINES_TIME = 60 };
42
43 #define CONF_NOREASON "<No reason supplied>"
44
45 /* MaskItem->flags */
46 enum
47 {
48 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 };
65
66 /* Macros for struct MaskItem */
67 #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 #define IsConfExemptXline(x) ((x)->flags & CONF_FLAGS_EXEMPTXLINE)
74 #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 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
81 #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
86
87 enum maskitem_type
88 {
89 CONF_CLIENT = 1 << 0,
90 CONF_SERVER = 1 << 1,
91 CONF_KLINE = 1 << 2,
92 CONF_DLINE = 1 << 3,
93 CONF_EXEMPT = 1 << 4,
94 CONF_OPER = 1 << 5
95 };
96
97 #define IsConfKill(x) ((x)->type == CONF_KLINE)
98 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
99
100 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 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 struct MaskItem
124 {
125 dlink_node node;
126 dlink_list leaf_list;
127 dlink_list hub_list;
128 enum maskitem_type type;
129 unsigned int dns_failed;
130 unsigned int dns_pending;
131 unsigned int flags;
132 unsigned int modes;
133 unsigned int port;
134 unsigned int aftype;
135 unsigned int active;
136 unsigned int htype;
137 unsigned int ref_count; /* Number of *LOCAL* clients using this */
138 int bits;
139 uintmax_t until; /* Hold action until this time (calendar time) */
140 uintmax_t setat;
141 struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
142 struct irc_ssaddr addr; /* ip to connect to */
143 struct ClassItem *class; /* Class of connection */
144 char *name;
145 char *user; /* user part of user@host */
146 char *host; /* host part of user@host */
147 char *passwd;
148 char *spasswd; /* Password to send. */
149 char *reason;
150 char *certfp;
151 char *whois;
152 char *cipher_list;
153 };
154
155 struct CidrItem
156 {
157 dlink_node node;
158 struct irc_ssaddr mask;
159 unsigned int number_on_this_cidr;
160 };
161
162 struct conf_parser_context
163 {
164 unsigned int boot;
165 unsigned int pass;
166 FILE *conf_file;
167 };
168
169 struct config_general_entry
170 {
171 const char *dpath;
172 const char *mpath;
173 const char *spath;
174 const char *configfile;
175 const char *klinefile;
176 const char *xlinefile;
177 const char *dlinefile;
178 const char *resvfile;
179
180 unsigned int dline_min_cidr;
181 unsigned int dline_min_cidr6;
182 unsigned int kline_min_cidr;
183 unsigned int kline_min_cidr6;
184 unsigned int dots_in_ident;
185 unsigned int failed_oper_notice;
186 unsigned int anti_spam_exit_message_time;
187 unsigned int max_accept;
188 unsigned int max_watch;
189 unsigned int whowas_history_length;
190 unsigned int away_time;
191 unsigned int away_count;
192 unsigned int max_nick_time;
193 unsigned int max_nick_changes;
194 unsigned int ts_max_delta;
195 unsigned int ts_warn_delta;
196 unsigned int anti_nick_flood;
197 unsigned int warn_no_connect_block;
198 unsigned int invisible_on_connect;
199 unsigned int stats_e_disabled;
200 unsigned int stats_i_oper_only;
201 unsigned int stats_k_oper_only;
202 unsigned int stats_m_oper_only;
203 unsigned int stats_o_oper_only;
204 unsigned int stats_P_oper_only;
205 unsigned int stats_u_oper_only;
206 unsigned int short_motd;
207 unsigned int no_oper_flood;
208 unsigned int tkline_expire_notices;
209 unsigned int opers_bypass_callerid;
210 unsigned int ignore_bogus_ts;
211 unsigned int pace_wait;
212 unsigned int pace_wait_simple;
213 unsigned int oper_only_umodes;
214 unsigned int oper_umodes;
215 unsigned int max_targets;
216 unsigned int caller_id_wait;
217 unsigned int min_nonwildcard;
218 unsigned int min_nonwildcard_simple;
219 unsigned int kill_chase_time_limit;
220 unsigned int default_floodcount;
221 unsigned int default_floodtime;
222 unsigned int throttle_count;
223 unsigned int throttle_time;
224 unsigned int ping_cookie;
225 unsigned int disable_auth;
226 unsigned int cycle_on_host_change;
227 };
228
229 struct config_channel_entry
230 {
231 unsigned int disable_fake_channels;
232 unsigned int invite_client_count;
233 unsigned int invite_client_time;
234 unsigned int invite_delay_channel;
235 unsigned int invite_expire_time;
236 unsigned int knock_client_count;
237 unsigned int knock_client_time;
238 unsigned int knock_delay_channel;
239 unsigned int max_invites;
240 unsigned int max_bans;
241 unsigned int max_bans_large;
242 unsigned int max_channels;
243 unsigned int default_join_flood_count;
244 unsigned int default_join_flood_time;
245 };
246
247 struct config_serverhide_entry
248 {
249 char *hidden_name;
250 char *flatten_links_file;
251 unsigned int flatten_links;
252 unsigned int flatten_links_delay;
253 unsigned int disable_remote_commands;
254 unsigned int hide_servers;
255 unsigned int hide_services;
256 unsigned int hidden;
257 unsigned int hide_server_ips;
258 };
259
260 struct config_serverinfo_entry
261 {
262 char *sid;
263 char *name;
264 char *description;
265 char *network_name;
266 char *network_desc;
267 char *rsa_private_key_file;
268 char *ssl_certificate_file;
269 char *ssl_dh_param_file;
270 char *ssl_dh_elliptic_curve;
271 char *ssl_cipher_list;
272 char *ssl_message_digest_algorithm;
273 tls_context_t tls_ctx;
274 tls_md_t message_digest_algorithm;
275 unsigned int hub;
276 unsigned int default_max_clients;
277 unsigned int max_nick_length;
278 unsigned int max_topic_length;
279 unsigned int specific_ipv4_vhost;
280 unsigned int specific_ipv6_vhost;
281 struct irc_ssaddr ip;
282 struct irc_ssaddr ip6;
283 };
284
285 struct config_admin_entry
286 {
287 char *name;
288 char *description;
289 char *email;
290 };
291
292 struct config_log_entry
293 {
294 unsigned int use_logging;
295 };
296
297 extern dlink_list flatten_links;
298 extern dlink_list connect_items;
299 extern dlink_list operator_items;
300 extern struct conf_parser_context conf_parser_ctx;
301 extern struct config_log_entry ConfigLog;
302 extern struct config_general_entry ConfigGeneral;
303 extern struct config_channel_entry ConfigChannel;
304 extern struct config_serverhide_entry ConfigServerHide;
305 extern struct config_serverinfo_entry ConfigServerInfo;
306 extern struct config_admin_entry ConfigAdminInfo;
307
308 extern int valid_wild_card_simple(const char *);
309 extern int valid_wild_card(int, ...);
310
311 extern struct MaskItem *conf_make(enum maskitem_type);
312 extern void read_conf_files(int);
313 extern int conf_attach(struct Client *, struct MaskItem *);
314 extern int check_client(struct Client *);
315
316
317 extern void conf_detach(struct Client *, enum maskitem_type);
318 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
319 extern int conf_connect_allowed(struct irc_ssaddr *, int);
320 extern const char *oper_privs_as_string(const unsigned int);
321 extern void split_nuh(struct split_nuh_item *);
322 extern struct MaskItem *operator_find(const struct Client *, const char *);
323 extern struct MaskItem *connect_find(const char *, int (*)(const char *, const char *));
324 extern void conf_free(struct MaskItem *);
325 extern void yyerror(const char *);
326 extern void conf_error_report(const char *);
327 extern void cleanup_tklines(void *);
328 extern void conf_rehash(int);
329 extern void lookup_confhost(struct MaskItem *);
330 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
331
332 extern const char *get_oper_name(const struct Client *);
333
334 /* XXX should the parse_aline stuff go into another file ?? */
335 extern int parse_aline(const char *, struct Client *, int, char **,
336 char **, char **, uintmax_t *, char **, char **);
337
338 extern uintmax_t valid_tkline(const char *, const int);
339 extern int match_conf_password(const char *, const struct MaskItem *);
340 #endif /* INCLUDED_s_conf_h */

Properties

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