/[svn]/ircd-hybrid/trunk/include/conf.h
ViewVC logotype

Annotation of /ircd-hybrid/trunk/include/conf.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1702 - (hide annotations)
Thu Dec 20 15:49:20 2012 UTC (7 years, 10 months ago) by michael
File MIME type: text/x-csrc
File size: 12476 byte(s)
- /info now also shows pathnames of g-/x-line database files

1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 michael 1309 * conf.h: A header for the configuration functions.
4 adx 30 *
5     * Copyright (C) 2005 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #ifndef INCLUDED_s_conf_h
26     #define INCLUDED_s_conf_h
27 michael 912 #include "config.h"
28 adx 30 #include "ircd_defs.h"
29     #include "motd.h" /* MessageFile */
30     #include "client.h"
31     #include "hook.h"
32 michael 1632 #include "conf_class.h"
33 adx 30
34 michael 967
35 michael 1646 #define CONF_NOREASON "<No reason supplied>"
36 adx 30
37 michael 967 struct conf_parser_context
38     {
39     unsigned int boot;
40     unsigned int pass;
41 michael 1325 FILE *conf_file;
42 michael 967 };
43    
44     extern struct conf_parser_context conf_parser_ctx;
45    
46 michael 1632 enum maskitem_type
47     {
48     CONF_RESERVED = 1 << 0, /* XXX */
49     CONF_CLIENT = 1 << 1,
50     CONF_SERVER = 1 << 2,
51     CONF_KLINE = 1 << 3,
52     CONF_DLINE = 1 << 4,
53     CONF_EXEMPT = 1 << 5,
54     CONF_CLUSTER = 1 << 6,
55     CONF_RKLINE = 1 << 7,
56     CONF_RXLINE = 1 << 8,
57     CONF_XLINE = 1 << 9,
58     CONF_ULINE = 1 << 10,
59     CONF_GLINE = 1 << 11,
60     CONF_CRESV = 1 << 12,
61     CONF_NRESV = 1 << 13,
62     CONF_SERVICE = 1 << 14,
63     CONF_OPER = 1 << 15,
64     CONF_HUB = 1 << 16, /* XXX There are no separate hub/leaf configs anymore. This is just for /stats h */
65 michael 1644 CONF_CLASS = 1 << 17 /* XXX Same here; just for /stats Y|y */
66 michael 1632 };
67 adx 30
68 michael 593 struct split_nuh_item
69     {
70     dlink_node node;
71    
72     char *nuhmask;
73     char *nickptr;
74     char *userptr;
75     char *hostptr;
76    
77     size_t nicksize;
78     size_t usersize;
79     size_t hostsize;
80     };
81    
82 michael 1632 struct MaskItem
83 adx 30 {
84 michael 1644 struct MaskItem *hnext;
85     dlink_node node;
86     dlink_list leaf_list;
87     dlink_list hub_list;
88 michael 1632 enum maskitem_type type;
89 michael 1644 unsigned int dns_failed;
90     unsigned int dns_pending;
91     unsigned int flags;
92     unsigned int modes;
93     unsigned int port;
94     unsigned int count;
95     unsigned int aftype;
96     unsigned int active;
97     unsigned int htype;
98     unsigned int ref_count; /* Number of *LOCAL* clients using this */
99     int bits;
100 michael 1649 time_t until; /* Hold action until this time (calendar time) */
101 michael 1644 time_t setat;
102     struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
103     struct irc_ssaddr addr; /* ip to connect to */
104     struct ClassItem *class; /* Class of connection */
105     char *name;
106 michael 1649 char *user; /* user part of user@host */
107 michael 1644 char *host; /* host part of user@host */
108     char *passwd;
109     char *spasswd; /* Password to send. */
110     char *reason;
111     char *cipher_list;
112     void *rsa_public_key;
113     void *regexuser;
114     void *regexhost;
115 adx 30 };
116    
117     struct CidrItem
118     {
119 michael 1013 dlink_node node;
120 adx 30 struct irc_ssaddr mask;
121 michael 1644 unsigned int number_on_this_cidr;
122 adx 30 };
123    
124    
125 michael 1636 #define IsConfOperator(x) ((x)->type == CONF_OPER)
126 michael 1632 #define IsConfKill(x) ((x)->type == CONF_KLINE)
127 michael 1636 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
128 michael 1632 #define IsConfGline(x) ((x)->type == CONF_GLINE)
129 adx 30
130 michael 1632 /* MaskItem->flags */
131 adx 30 #define CONF_FLAGS_DO_IDENTD 0x00000001
132     #define CONF_FLAGS_LIMIT_IP 0x00000002
133     #define CONF_FLAGS_NO_TILDE 0x00000004
134     #define CONF_FLAGS_NEED_IDENTD 0x00000008
135 michael 1335 #define CONF_FLAGS_NOMATCH_IP 0x00000010
136     #define CONF_FLAGS_EXEMPTKLINE 0x00000020
137     #define CONF_FLAGS_NOLIMIT 0x00000040
138     #define CONF_FLAGS_SPOOF_IP 0x00000080
139     #define CONF_FLAGS_SPOOF_NOTICE 0x00000100
140     #define CONF_FLAGS_REDIR 0x00000200
141     #define CONF_FLAGS_EXEMPTGLINE 0x00000400
142     #define CONF_FLAGS_CAN_FLOOD 0x00000800
143     #define CONF_FLAGS_NEED_PASSWORD 0x00001000
144     #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00002000
145     #define CONF_FLAGS_ENCRYPTED 0x00004000
146 michael 1628 #define CONF_FLAGS_IN_DATABASE 0x00008000
147 michael 1519 #define CONF_FLAGS_EXEMPTRESV 0x00010000
148     #define CONF_FLAGS_SSL 0x00020000
149 adx 30
150 michael 1632 /* Macros for struct MaskItem */
151 adx 30 #define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP)
152     #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
153     #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
154     #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
155     #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
156     #define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP)
157     #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
158     #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
159     #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
160     #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
161     #define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD)
162     #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
163     #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
164     #define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
165     #define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED)
166     #define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED)
167     #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
168     #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
169     #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
170     #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
171 michael 1303 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
172     #define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL)
173     #define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL)
174 michael 1628 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
175     #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
176 adx 30
177 michael 1628
178 adx 30 /* shared/cluster server entry types
179     * These defines are used for both shared and cluster.
180     */
181     #define SHARED_KLINE 0x0001
182 michael 1301 #define SHARED_UNKLINE 0x0002
183     #define SHARED_XLINE 0x0004
184     #define SHARED_UNXLINE 0x0008
185     #define SHARED_RESV 0x0010
186     #define SHARED_UNRESV 0x0020
187     #define SHARED_LOCOPS 0x0040
188     #define SHARED_DLINE 0x0080
189     #define SHARED_UNDLINE 0x0100
190     #define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\
191     SHARED_XLINE | SHARED_UNXLINE |\
192     SHARED_RESV | SHARED_UNRESV |\
193     SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
194 adx 30
195     struct config_file_entry
196     {
197     const char *dpath; /* DPATH if set from command line */
198     const char *configfile;
199     const char *klinefile;
200 michael 1702 const char *glinefile;
201 adx 30 const char *xlinefile;
202     const char *dlinefile;
203 michael 1702 const char *resvfile;
204 adx 30
205     char *egdpool_path;
206 michael 1157 char *service_name;
207 adx 30
208     MessageFile motd;
209     MessageFile linksfile;
210    
211     int gline_min_cidr;
212     int gline_min_cidr6;
213     int dots_in_ident;
214     int failed_oper_notice;
215     int anti_spam_exit_message_time;
216 michael 950 unsigned int max_accept;
217     unsigned int max_watch;
218 adx 30 int max_nick_time;
219 michael 950 unsigned int max_nick_changes;
220 adx 30 int ts_max_delta;
221     int ts_warn_delta;
222     int anti_nick_flood;
223     int warn_no_nline;
224     int invisible_on_connect;
225 michael 584 int stats_e_disabled;
226 adx 30 int stats_o_oper_only;
227     int stats_k_oper_only;
228     int stats_i_oper_only;
229     int stats_P_oper_only;
230     int short_motd;
231     int no_oper_flood;
232     int true_no_oper_flood;
233     int oper_pass_resv;
234     int glines;
235     int hide_spoof_ips;
236     int tkline_expire_notices;
237     int opers_bypass_callerid;
238     int ignore_bogus_ts;
239     int pace_wait;
240     int pace_wait_simple;
241     int gline_time;
242 michael 1459 int gline_request_time;
243 adx 30 int oper_only_umodes;
244     int oper_umodes;
245     int max_targets;
246     int caller_id_wait;
247     int min_nonwildcard;
248     int min_nonwildcard_simple;
249     int kill_chase_time_limit;
250     int default_floodcount;
251     /* 0 == don't use throttle... */
252     int throttle_time;
253     int use_egd;
254     int ping_cookie;
255     int disable_auth;
256     int disable_remote;
257     };
258    
259     struct config_channel_entry
260     {
261 michael 632 int disable_fake_channels;
262 adx 30 int restrict_channels;
263     int knock_delay;
264     int knock_delay_channel;
265     unsigned int max_bans;
266     unsigned int max_chans_per_user;
267 michael 1432 unsigned int max_chans_per_oper;
268 adx 30 int no_create_on_split;
269     int no_join_on_split;
270     int quiet_on_ban;
271     int default_split_server_count;
272     int default_split_user_count;
273     };
274    
275     struct config_server_hide
276     {
277 michael 1013 char *hidden_name;
278 adx 30 int flatten_links;
279     int hide_servers;
280     int links_delay;
281     int links_disabled;
282     int hidden;
283     int hide_server_ips;
284     };
285    
286     struct server_info
287     {
288 michael 1013 char *sid;
289 adx 30 char *name;
290     char *description;
291     char *network_name;
292     char *network_desc;
293     char *rsa_private_key_file;
294 michael 1644 void *rsa_private_key;
295     void *server_ctx;
296     void *client_ctx;
297 adx 30 int hub;
298     struct irc_ssaddr ip;
299     struct irc_ssaddr ip6;
300 michael 1013 unsigned int max_clients;
301 adx 30 int specific_ipv4_vhost;
302     int specific_ipv6_vhost;
303     struct sockaddr_in dns_host;
304     int can_use_v6;
305     };
306    
307     struct admin_info
308     {
309     char *name;
310     char *description;
311     char *email;
312     };
313    
314     struct logging_entry
315     {
316     unsigned int use_logging;
317     };
318    
319     extern dlink_list server_items;
320     extern dlink_list cluster_items;
321 michael 1622 extern dlink_list xconf_items;
322 adx 30 extern dlink_list rxconf_items;
323     extern dlink_list rkconf_items;
324 michael 1157 extern dlink_list service_items;
325 adx 30 extern struct logging_entry ConfigLoggingEntry;
326     extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/
327     extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/
328     extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
329     extern struct server_info ServerInfo; /* defined in ircd.c */
330     extern struct admin_info AdminInfo; /* defined in ircd.c */
331     extern int valid_wild_card(struct Client *, int, int, ...);
332     /* End GLOBAL section */
333    
334 michael 1632
335    
336    
337 adx 30 extern void init_ip_hash_table(void);
338 michael 948 extern void count_ip_hash(unsigned int *, uint64_t *);
339 adx 30 extern void remove_one_ip(struct irc_ssaddr *);
340 michael 1632 extern struct MaskItem *conf_make(enum maskitem_type);
341 adx 30 extern void read_conf_files(int);
342 michael 1632 extern int attach_conf(struct Client *, struct MaskItem *);
343 adx 30 extern int attach_connect_block(struct Client *, const char *, const char *);
344 michael 1644 extern int check_client(struct Client *);
345 adx 30
346 michael 1644
347 michael 1632 extern void detach_conf(struct Client *, enum maskitem_type);
348     extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
349     extern struct MaskItem *find_kill(struct Client *);
350     extern struct MaskItem *find_gline(struct Client *);
351 adx 30 extern int conf_connect_allowed(struct irc_ssaddr *, int);
352     extern char *oper_privs_as_string(const unsigned int);
353 michael 593 extern void split_nuh(struct split_nuh_item *);
354 michael 1632 extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
355     const char *, const char *, unsigned int);
356     extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
357 adx 30 const char *, const char *);
358 michael 1632 extern void conf_free(struct MaskItem *);
359     extern void report_confitem_types(struct Client *, enum maskitem_type);
360 adx 30 extern void yyerror(const char *);
361     extern void cleanup_tklines(void *);
362     extern int rehash(int);
363 michael 1647 extern void lookup_confhost(struct MaskItem *);
364 michael 1632 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
365 adx 30
366 michael 1364 extern const char *get_oper_name(const struct Client *);
367 adx 30
368     /* XXX should the parse_aline stuff go into another file ?? */
369     #define AWILD 0x1 /* check wild cards */
370     extern int parse_aline(const char *, struct Client *, int, char **,
371     int, char **, char **, time_t *, char **, char **);
372     extern int valid_comment(struct Client *, char *, int);
373    
374    
375     #define TK_SECONDS 0
376     #define TK_MINUTES 1
377 michael 1120 extern time_t valid_tkline(const char *, int);
378 michael 1632 extern int match_conf_password(const char *, const struct MaskItem *);
379 adx 30
380     #define NOT_AUTHORIZED (-1)
381 michael 618 #define I_LINE_FULL (-2)
382     #define TOO_MANY (-3)
383     #define BANNED_CLIENT (-4)
384     #define TOO_FAST (-5)
385 adx 30
386 michael 1370 #define CLEANUP_TKLINES_TIME 60
387 adx 30
388     extern void cluster_a_line(struct Client *,
389     const char *, int, int, const char *,...);
390     #endif /* INCLUDED_s_conf_h */

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28