ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 7403
Committed: Sun Mar 6 16:33:12 2016 UTC (9 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 10685 byte(s)
Log Message:
- Remove useless parameters from operator_find()

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2016 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 away_time;
182 unsigned int away_count;
183 unsigned int max_nick_time;
184 unsigned int max_nick_changes;
185 unsigned int ts_max_delta;
186 unsigned int ts_warn_delta;
187 unsigned int anti_nick_flood;
188 unsigned int warn_no_connect_block;
189 unsigned int invisible_on_connect;
190 unsigned int stats_e_disabled;
191 unsigned int stats_i_oper_only;
192 unsigned int stats_k_oper_only;
193 unsigned int stats_m_oper_only;
194 unsigned int stats_o_oper_only;
195 unsigned int stats_P_oper_only;
196 unsigned int stats_u_oper_only;
197 unsigned int short_motd;
198 unsigned int no_oper_flood;
199 unsigned int tkline_expire_notices;
200 unsigned int opers_bypass_callerid;
201 unsigned int ignore_bogus_ts;
202 unsigned int pace_wait;
203 unsigned int pace_wait_simple;
204 unsigned int oper_only_umodes;
205 unsigned int oper_umodes;
206 unsigned int max_targets;
207 unsigned int caller_id_wait;
208 unsigned int min_nonwildcard;
209 unsigned int min_nonwildcard_simple;
210 unsigned int kill_chase_time_limit;
211 unsigned int default_floodcount;
212 unsigned int throttle_count;
213 unsigned int throttle_time;
214 unsigned int ping_cookie;
215 unsigned int disable_auth;
216 unsigned int cycle_on_host_change;
217 };
218
219 struct config_channel_entry
220 {
221 unsigned int disable_fake_channels;
222 unsigned int invite_client_count;
223 unsigned int invite_client_time;
224 unsigned int invite_delay_channel;
225 unsigned int knock_client_count;
226 unsigned int knock_client_time;
227 unsigned int knock_delay_channel;
228 unsigned int max_bans;
229 unsigned int max_channels;
230 unsigned int default_join_flood_count;
231 unsigned int default_join_flood_time;
232 };
233
234 struct config_serverhide_entry
235 {
236 char *hidden_name;
237 char *flatten_links_file;
238 unsigned int flatten_links;
239 unsigned int flatten_links_delay;
240 unsigned int disable_remote_commands;
241 unsigned int hide_servers;
242 unsigned int hide_services;
243 unsigned int hidden;
244 unsigned int hide_server_ips;
245 };
246
247 struct config_serverinfo_entry
248 {
249 char *sid;
250 char *name;
251 char *description;
252 char *network_name;
253 char *network_desc;
254 char *libgeoip_ipv4_database_file;
255 char *libgeoip_ipv6_database_file;
256 char *rsa_private_key_file;
257 char *ssl_certificate_file;
258 char *ssl_dh_param_file;
259 char *ssl_dh_elliptic_curve;
260 char *ssl_cipher_list;
261 char *ssl_message_digest_algorithm;
262 tls_context_t tls_ctx;
263 tls_md_t message_digest_algorithm;
264 unsigned int hub;
265 unsigned int default_max_clients;
266 unsigned int max_nick_length;
267 unsigned int max_topic_length;
268 unsigned int libgeoip_database_options;
269 unsigned int specific_ipv4_vhost;
270 unsigned int specific_ipv6_vhost;
271 struct irc_ssaddr ip;
272 struct irc_ssaddr ip6;
273 };
274
275 struct config_admin_entry
276 {
277 char *name;
278 char *description;
279 char *email;
280 };
281
282 struct config_log_entry
283 {
284 unsigned int use_logging;
285 };
286
287 extern dlink_list flatten_links;
288 extern dlink_list connect_items;
289 extern dlink_list operator_items;
290 extern struct conf_parser_context conf_parser_ctx;
291 extern struct config_log_entry ConfigLog;
292 extern struct config_general_entry ConfigGeneral;
293 extern struct config_channel_entry ConfigChannel;
294 extern struct config_serverhide_entry ConfigServerHide;
295 extern struct config_serverinfo_entry ConfigServerInfo;
296 extern struct config_admin_entry ConfigAdminInfo;
297
298 extern int valid_wild_card_simple(const char *);
299 extern int valid_wild_card(struct Client *, int, ...);
300 /* End GLOBAL section */
301
302 extern struct MaskItem *conf_make(enum maskitem_type);
303 extern void read_conf_files(int);
304 extern int attach_conf(struct Client *, struct MaskItem *);
305 extern int attach_connect_block(struct Client *, const char *, const char *);
306 extern int check_client(struct Client *);
307
308
309 extern void detach_conf(struct Client *, enum maskitem_type);
310 extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
311 extern int conf_connect_allowed(struct irc_ssaddr *, int);
312 extern const char *oper_privs_as_string(const unsigned int);
313 extern void split_nuh(struct split_nuh_item *);
314 extern struct MaskItem *operator_find(const struct Client *, const char *);
315 extern struct MaskItem *connect_find(const char *, const char *, int (*)(const char *, const char *));
316 extern void conf_free(struct MaskItem *);
317 extern void yyerror(const char *);
318 extern void conf_error_report(const char *);
319 extern void cleanup_tklines(void *);
320 extern void conf_rehash(int);
321 extern void lookup_confhost(struct MaskItem *);
322 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
323
324 extern const char *get_oper_name(const struct Client *);
325
326 /* XXX should the parse_aline stuff go into another file ?? */
327 #define AWILD 0x1 /* check wild cards */
328 extern int parse_aline(const char *, struct Client *, int, char **,
329 int, 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
338 extern void cluster_a_line(struct Client *, const char *, unsigned int, unsigned int, const char *,...);
339 #endif /* INCLUDED_s_conf_h */

Properties

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