]> jfr.im git - irc/rqf/shadowircd.git/blame - include/s_newconf.h
Added m_cycle and added it to all the appropriate locations.
[irc/rqf/shadowircd.git] / include / s_newconf.h
CommitLineData
212380e3 1/*
2 * ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
3 * s_newconf.h: code for dealing with conf stuff
4 *
5 * Copyright (C) 2004 Lee Hardy <lee@leeh.co.uk>
6 * Copyright (C) 2004 ircd-ratbox development team
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * 1.Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * 2.Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3.The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $Id: s_newconf.h 1747 2006-07-25 21:22:45Z jilles $
33 */
34
35#ifndef INCLUDED_s_newconf_h
36#define INCLUDED_s_newconf_h
37
38#include "setup.h"
120b37f9 39#include "privilege.h"
212380e3 40
41#ifdef HAVE_LIBCRYPTO
42#include <openssl/rsa.h>
43#endif
44
45struct ConfItem;
46
08d11e34
WP
47extern rb_dlink_list cluster_conf_list;
48extern rb_dlink_list shared_conf_list;
49extern rb_dlink_list oper_conf_list;
50extern rb_dlink_list hubleaf_conf_list;
51extern rb_dlink_list server_conf_list;
52extern rb_dlink_list xline_conf_list;
53extern rb_dlink_list resv_conf_list;
54extern rb_dlink_list nd_list;
55extern rb_dlink_list tgchange_list;
212380e3 56
aa65834c 57extern struct _rb_patricia_tree_t *tgchange_tree;
212380e3 58
59extern void init_s_newconf(void);
60extern void clear_s_newconf(void);
61extern void clear_s_newconf_bans(void);
62
212380e3 63typedef struct
64{
65 char *ip;
66 time_t expiry;
08d11e34
WP
67 rb_patricia_node_t *pnode;
68 rb_dlink_node node;
212380e3 69} tgchange;
70
71void add_tgchange(const char *host);
72tgchange *find_tgchange(const char *host);
73
74/* shared/cluster/hub/leaf confs */
75struct remote_conf
76{
77 char *username;
78 char *host;
79 char *server;
80 int flags;
08d11e34 81 rb_dlink_node node;
212380e3 82};
83
84/* flags used in shared/cluster */
85#define SHARED_TKLINE 0x0001
86#define SHARED_PKLINE 0x0002
87#define SHARED_UNKLINE 0x0004
88#define SHARED_LOCOPS 0x0008
89#define SHARED_TXLINE 0x0010
90#define SHARED_PXLINE 0x0020
91#define SHARED_UNXLINE 0x0040
f726dd09 92#define SHARED_TRESV 0x0080
212380e3 93#define SHARED_PRESV 0x0100
94#define SHARED_UNRESV 0x0200
95#define SHARED_REHASH 0x0400
45be325c
VY
96#define SHARED_TDLINE 0x0800
97#define SHARED_PDLINE 0x1000
98#define SHARED_UNDLINE 0x2000
212380e3 99
100#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
101 SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
ceb3eb1d 102 SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV | SHARED_REHASH)
212380e3 103#define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS)
104
105/* flags used in hub/leaf */
106#define CONF_HUB 0x0001
107#define CONF_LEAF 0x0002
108
109struct oper_conf
110{
111 char *name;
112 char *username;
113 char *host;
114 char *passwd;
d8a023ed 115 char *certfp;
212380e3 116
117 int flags;
118 int umodes;
119
120 unsigned int snomask;
121
08e35f66 122 char *vhost;
e787d3a2
G
123 char *swhois;
124 char *operstring;
08e35f66 125
120b37f9
WP
126 struct PrivilegeSet *privset;
127
212380e3 128#ifdef HAVE_LIBCRYPTO
129 char *rsa_pubkey_file;
130 RSA *rsa_pubkey;
131#endif
132};
133
134extern struct remote_conf *make_remote_conf(void);
135extern void free_remote_conf(struct remote_conf *);
136
137extern int find_shared_conf(const char *username, const char *host,
138 const char *server, int flags);
139extern void propagate_generic(struct Client *source_p, const char *command,
140 const char *target, int cap, const char *format, ...);
141extern void cluster_generic(struct Client *, const char *, int cltype,
142 int cap, const char *format, ...);
143
144#define OPER_ENCRYPTED 0x00001
663bbb28 145#define OPER_NEEDSSL 0x80000
333d73ff 146/* 0x400000 and above are in client.h */
212380e3 147
850b23f3 148#define OPER_FLAGS 0 /* no oper privs in Client.flags2/oper_conf.flags currently */
212380e3 149
150#define IsOperConfEncrypted(x) ((x)->flags & OPER_ENCRYPTED)
663bbb28 151#define IsOperConfNeedSSL(x) ((x)->flags & OPER_NEEDSSL)
212380e3 152
4db97a82 153#define HasPrivilege(x, y) ((x)->localClient != NULL && (x)->localClient->privset != NULL && privilegeset_in_set((x)->localClient->privset, (y)))
73a34351
WP
154
155#define IsOperGlobalKill(x) (HasPrivilege((x), "oper:global_kill"))
156#define IsOperLocalKill(x) (HasPrivilege((x), "oper:local_kill"))
157#define IsOperRemote(x) (HasPrivilege((x), "oper:routing"))
158#define IsOperUnkline(x) (HasPrivilege((x), "oper:unkline"))
159#define IsOperN(x) (HasPrivilege((x), "snomask:nick_changes"))
160#define IsOperK(x) (HasPrivilege((x), "oper:kline"))
161#define IsOperXline(x) (HasPrivilege((x), "oper:xline"))
162#define IsOperResv(x) (HasPrivilege((x), "oper:resv"))
163#define IsOperDie(x) (HasPrivilege((x), "oper:die"))
164#define IsOperRehash(x) (HasPrivilege((x), "oper:rehash"))
165#define IsOperHiddenAdmin(x) (HasPrivilege((x), "oper:hidden_admin"))
166#define IsOperAdmin(x) (HasPrivilege((x), "oper:admin") || HasPrivilege((x), "oper:hidden_admin"))
167#define IsOperOperwall(x) (HasPrivilege((x), "oper:operwall"))
168#define IsOperSpy(x) (HasPrivilege((x), "oper:spy"))
0a9c5766 169#define IsOperOverride(x) (HasPrivilege((x), "oper:override"))
73a34351
WP
170#define IsOperInvis(x) (HasPrivilege((x), "oper:hidden"))
171#define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban"))
172#define IsOperMassNotice(x) (HasPrivilege((x), "oper:mass_notice"))
212380e3 173
174extern struct oper_conf *make_oper_conf(void);
175extern void free_oper_conf(struct oper_conf *);
176extern void clear_oper_conf(void);
177
178extern struct oper_conf *find_oper_conf(const char *username, const char *host,
179 const char *locip, const char *oname);
180
181extern const char *get_oper_privs(int flags);
182
183struct server_conf
184{
185 char *name;
186 char *host;
187 char *passwd;
188 char *spasswd;
189 int port;
190 int flags;
191 int servers;
192 time_t hold;
193
194 int aftype;
3ea5fee7 195 struct rb_sockaddr_storage my_ipnum;
212380e3 196
197 char *class_name;
198 struct Class *class;
08d11e34 199 rb_dlink_node node;
212380e3 200};
201
202#define SERVER_ILLEGAL 0x0001
203#define SERVER_VHOSTED 0x0002
204#define SERVER_ENCRYPTED 0x0004
205#define SERVER_COMPRESSED 0x0008
206#define SERVER_TB 0x0010
207#define SERVER_AUTOCONN 0x0020
8db00894 208#define SERVER_SSL 0x0040
212380e3 209
210#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
211#define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED)
212#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
213#define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED)
214#define ServerConfTb(x) ((x)->flags & SERVER_TB)
215#define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN)
8db00894 216#define ServerConfSSL(x) ((x)->flags & SERVER_SSL)
212380e3 217
218extern struct server_conf *make_server_conf(void);
219extern void free_server_conf(struct server_conf *);
220extern void clear_server_conf(void);
221extern void add_server_conf(struct server_conf *);
222
223extern struct server_conf *find_server_conf(const char *name);
224
225extern void attach_server_conf(struct Client *, struct server_conf *);
226extern void detach_server_conf(struct Client *);
6d18bf1a 227extern void set_server_conf_autoconn(struct Client *source_p, const char *name,
212380e3 228 int newval);
6b2cf989 229extern void disable_server_conf_autoconn(const char *name);
212380e3 230
231
232extern struct ConfItem *find_xline(const char *, int);
0fdb2570 233extern struct ConfItem *find_xline_mask(const char *);
212380e3 234extern struct ConfItem *find_nick_resv(const char *name);
0fdb2570 235extern struct ConfItem *find_nick_resv_mask(const char *name);
212380e3 236
237extern int valid_wild_card_simple(const char *);
238extern int clean_resv_nick(const char *);
239time_t valid_temp_time(const char *p);
240
58e8319c
VY
241struct nd_entry
242{
243 char name[NICKLEN+1];
244 time_t expire;
245 rb_dlink_node lnode; /* node in ll */
212380e3 246};
247
248extern void add_nd_entry(const char *name);
249extern void free_nd_entry(struct nd_entry *);
250extern unsigned long get_nd_count(void);
251
252#endif
253