ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 8395
Committed: Sun Mar 18 13:14:35 2018 UTC (7 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 10473 byte(s)
Log Message:
- Rename attach_conf() -> conf_attach(), detach_conf() -> conf_detach(); clean up documentation

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 #define CONF_NOREASON "<No reason supplied>"
36
37 /* MaskItem->flags */
38 enum
39 {
40 CONF_FLAGS_NO_TILDE = 0x00000001U,
41 CONF_FLAGS_NEED_IDENTD = 0x00000002U,
42 CONF_FLAGS_EXEMPTKLINE = 0x00000004U,
43 CONF_FLAGS_NOLIMIT = 0x00000008U,
44 CONF_FLAGS_SPOOF_IP = 0x00000010U,
45 CONF_FLAGS_SPOOF_NOTICE = 0x00000020U,
46 CONF_FLAGS_REDIR = 0x00000040U,
47 CONF_FLAGS_CAN_FLOOD = 0x00000080U,
48 CONF_FLAGS_NEED_PASSWORD = 0x00000100U,
49 CONF_FLAGS_ALLOW_AUTO_CONN = 0x00000200U,
50 CONF_FLAGS_ENCRYPTED = 0x00000400U,
51 CONF_FLAGS_IN_DATABASE = 0x00000800U,
52 CONF_FLAGS_EXEMPTRESV = 0x00001000U,
53 CONF_FLAGS_SSL = 0x00002000U,
54 CONF_FLAGS_WEBIRC = 0x00004000U,
55 CONF_FLAGS_EXEMPTXLINE = 0x00008000U
56 };
57
58 /* Macros for struct MaskItem */
59 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
60 #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
61 #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
62 #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
63 #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
64 #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
65 #define IsConfExemptXline(x) ((x)->flags & CONF_FLAGS_EXEMPTXLINE)
66 #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
67 #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
68 #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
69 #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
70 #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
71 #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
72 #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
73 #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
74 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
75 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
76 #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
77
78
79 enum maskitem_type
80 {
81 CONF_CLIENT = 1 << 0,
82 CONF_SERVER = 1 << 1,
83 CONF_KLINE = 1 << 2,
84 CONF_DLINE = 1 << 3,
85 CONF_EXEMPT = 1 << 4,
86 CONF_OPER = 1 << 5
87 };
88
89 #define IsConfKill(x) ((x)->type == CONF_KLINE)
90 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
91
92 enum
93 {
94 NOT_AUTHORIZED = -1,
95 I_LINE_FULL = -2,
96 TOO_MANY = -3,
97 BANNED_CLIENT = -4,
98 TOO_FAST = -5
99 };
100
101 struct split_nuh_item
102 {
103 dlink_node node;
104
105 char *nuhmask;
106 char *nickptr;
107 char *userptr;
108 char *hostptr;
109
110 size_t nicksize;
111 size_t usersize;
112 size_t hostsize;
113 };
114
115 struct MaskItem
116 {
117 dlink_node node;
118 dlink_list leaf_list;
119 dlink_list hub_list;
120 enum maskitem_type type;
121 unsigned int dns_failed;
122 unsigned int dns_pending;
123 unsigned int flags;
124 unsigned int modes;
125 unsigned int port;
126 unsigned int aftype;
127 unsigned int active;
128 unsigned int htype;
129 unsigned int ref_count; /* Number of *LOCAL* clients using this */
130 int bits;
131 uintmax_t until; /* Hold action until this time (calendar time) */
132 uintmax_t setat;
133 struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
134 struct irc_ssaddr addr; /* ip to connect to */
135 struct ClassItem *class; /* Class of connection */
136 char *name;
137 char *user; /* user part of user@host */
138 char *host; /* host part of user@host */
139 char *passwd;
140 char *spasswd; /* Password to send. */
141 char *reason;
142 char *certfp;
143 char *whois;
144 char *cipher_list;
145 };
146
147 struct CidrItem
148 {
149 dlink_node node;
150 struct irc_ssaddr mask;
151 unsigned int number_on_this_cidr;
152 };
153
154 struct conf_parser_context
155 {
156 unsigned int boot;
157 unsigned int pass;
158 FILE *conf_file;
159 };
160
161 struct config_general_entry
162 {
163 const char *dpath;
164 const char *mpath;
165 const char *spath;
166 const char *configfile;
167 const char *klinefile;
168 const char *xlinefile;
169 const char *dlinefile;
170 const char *resvfile;
171
172 unsigned int dline_min_cidr;
173 unsigned int dline_min_cidr6;
174 unsigned int kline_min_cidr;
175 unsigned int kline_min_cidr6;
176 unsigned int dots_in_ident;
177 unsigned int failed_oper_notice;
178 unsigned int anti_spam_exit_message_time;
179 unsigned int max_accept;
180 unsigned int max_watch;
181 unsigned int whowas_history_length;
182 unsigned int away_time;
183 unsigned int away_count;
184 unsigned int max_nick_time;
185 unsigned int max_nick_changes;
186 unsigned int ts_max_delta;
187 unsigned int ts_warn_delta;
188 unsigned int anti_nick_flood;
189 unsigned int warn_no_connect_block;
190 unsigned int invisible_on_connect;
191 unsigned int stats_e_disabled;
192 unsigned int stats_i_oper_only;
193 unsigned int stats_k_oper_only;
194 unsigned int stats_m_oper_only;
195 unsigned int stats_o_oper_only;
196 unsigned int stats_P_oper_only;
197 unsigned int stats_u_oper_only;
198 unsigned int short_motd;
199 unsigned int no_oper_flood;
200 unsigned int tkline_expire_notices;
201 unsigned int opers_bypass_callerid;
202 unsigned int ignore_bogus_ts;
203 unsigned int pace_wait;
204 unsigned int pace_wait_simple;
205 unsigned int oper_only_umodes;
206 unsigned int oper_umodes;
207 unsigned int max_targets;
208 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 unsigned int default_floodtime;
214 unsigned int throttle_count;
215 unsigned int throttle_time;
216 unsigned int ping_cookie;
217 unsigned int disable_auth;
218 unsigned int cycle_on_host_change;
219 };
220
221 struct config_channel_entry
222 {
223 unsigned int disable_fake_channels;
224 unsigned int invite_client_count;
225 unsigned int invite_client_time;
226 unsigned int invite_delay_channel;
227 unsigned int invite_expire_time;
228 unsigned int knock_client_count;
229 unsigned int knock_client_time;
230 unsigned int knock_delay_channel;
231 unsigned int max_invites;
232 unsigned int max_bans;
233 unsigned int max_bans_large;
234 unsigned int max_channels;
235 unsigned int default_join_flood_count;
236 unsigned int default_join_flood_time;
237 };
238
239 struct config_serverhide_entry
240 {
241 char *hidden_name;
242 char *flatten_links_file;
243 unsigned int flatten_links;
244 unsigned int flatten_links_delay;
245 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 };
251
252 struct config_serverinfo_entry
253 {
254 char *sid;
255 char *name;
256 char *description;
257 char *network_name;
258 char *network_desc;
259 char *rsa_private_key_file;
260 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 unsigned int hub;
268 unsigned int default_max_clients;
269 unsigned int max_nick_length;
270 unsigned int max_topic_length;
271 unsigned int specific_ipv4_vhost;
272 unsigned int specific_ipv6_vhost;
273 struct irc_ssaddr ip;
274 struct irc_ssaddr ip6;
275 };
276
277 struct config_admin_entry
278 {
279 char *name;
280 char *description;
281 char *email;
282 };
283
284 struct config_log_entry
285 {
286 unsigned int use_logging;
287 };
288
289 extern dlink_list flatten_links;
290 extern dlink_list connect_items;
291 extern dlink_list operator_items;
292 extern struct conf_parser_context conf_parser_ctx;
293 extern struct config_log_entry ConfigLog;
294 extern struct config_general_entry ConfigGeneral;
295 extern struct config_channel_entry ConfigChannel;
296 extern struct config_serverhide_entry ConfigServerHide;
297 extern struct config_serverinfo_entry ConfigServerInfo;
298 extern struct config_admin_entry ConfigAdminInfo;
299
300 extern int valid_wild_card_simple(const char *);
301 extern int valid_wild_card(int, ...);
302 /* End GLOBAL section */
303
304 extern struct MaskItem *conf_make(enum maskitem_type);
305 extern void read_conf_files(int);
306 extern int conf_attach(struct Client *, struct MaskItem *);
307 extern int check_client(struct Client *);
308
309
310 extern void conf_detach(struct Client *, enum maskitem_type);
311 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
312 extern int conf_connect_allowed(struct irc_ssaddr *, int);
313 extern const char *oper_privs_as_string(const unsigned int);
314 extern void split_nuh(struct split_nuh_item *);
315 extern struct MaskItem *operator_find(const struct Client *, const char *);
316 extern struct MaskItem *connect_find(const char *, int (*)(const char *, const char *));
317 extern void conf_free(struct MaskItem *);
318 extern void yyerror(const char *);
319 extern void conf_error_report(const char *);
320 extern void cleanup_tklines(void *);
321 extern void conf_rehash(int);
322 extern void lookup_confhost(struct MaskItem *);
323 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
324
325 extern const char *get_oper_name(const struct Client *);
326
327 /* XXX should the parse_aline stuff go into another file ?? */
328 extern int parse_aline(const char *, struct Client *, int, char **,
329 char **, char **, uintmax_t *, char **, char **);
330
331 #define TK_SECONDS 0
332 #define TK_MINUTES 1
333 extern uintmax_t valid_tkline(const char *, const int);
334 extern int match_conf_password(const char *, const struct MaskItem *);
335
336 enum { CLEANUP_TKLINES_TIME = 60 };
337 #endif /* INCLUDED_s_conf_h */

Properties

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