]> jfr.im git - irc/rqf/shadowircd.git/blame - include/s_newconf.h
Fix various compiler warnings.
[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"
212380e3 39
40#ifdef HAVE_LIBCRYPTO
41#include <openssl/rsa.h>
42#endif
43
44struct ConfItem;
45
08d11e34
WP
46extern rb_dlink_list cluster_conf_list;
47extern rb_dlink_list shared_conf_list;
48extern rb_dlink_list oper_conf_list;
49extern rb_dlink_list hubleaf_conf_list;
50extern rb_dlink_list server_conf_list;
51extern rb_dlink_list xline_conf_list;
52extern rb_dlink_list resv_conf_list;
53extern rb_dlink_list nd_list;
54extern rb_dlink_list tgchange_list;
212380e3 55
aa65834c 56extern struct _rb_patricia_tree_t *tgchange_tree;
212380e3 57
58extern void init_s_newconf(void);
59extern void clear_s_newconf(void);
60extern void clear_s_newconf_bans(void);
61
62#define FREE_TARGET(x) ((x)->localClient->targinfo[0])
63#define USED_TARGETS(x) ((x)->localClient->targinfo[1])
64
65typedef struct
66{
67 char *ip;
68 time_t expiry;
08d11e34
WP
69 rb_patricia_node_t *pnode;
70 rb_dlink_node node;
212380e3 71} tgchange;
72
73void add_tgchange(const char *host);
74tgchange *find_tgchange(const char *host);
75
76/* shared/cluster/hub/leaf confs */
77struct remote_conf
78{
79 char *username;
80 char *host;
81 char *server;
82 int flags;
08d11e34 83 rb_dlink_node node;
212380e3 84};
85
86/* flags used in shared/cluster */
87#define SHARED_TKLINE 0x0001
88#define SHARED_PKLINE 0x0002
89#define SHARED_UNKLINE 0x0004
90#define SHARED_LOCOPS 0x0008
91#define SHARED_TXLINE 0x0010
92#define SHARED_PXLINE 0x0020
93#define SHARED_UNXLINE 0x0040
f726dd09 94#define SHARED_TRESV 0x0080
212380e3 95#define SHARED_PRESV 0x0100
96#define SHARED_UNRESV 0x0200
97#define SHARED_REHASH 0x0400
45be325c
VY
98#define SHARED_TDLINE 0x0800
99#define SHARED_PDLINE 0x1000
100#define SHARED_UNDLINE 0x2000
212380e3 101
102#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
103 SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
45be325c
VY
104 SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV |\
105 SHARED_TDLINE | SHARED_PDLINE | SHARED_UNDLINE)
212380e3 106#define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS)
107
108/* flags used in hub/leaf */
109#define CONF_HUB 0x0001
110#define CONF_LEAF 0x0002
111
112struct oper_conf
113{
114 char *name;
115 char *username;
116 char *host;
117 char *passwd;
118
119 int flags;
120 int umodes;
121
122 unsigned int snomask;
123
124#ifdef HAVE_LIBCRYPTO
125 char *rsa_pubkey_file;
126 RSA *rsa_pubkey;
127#endif
128};
129
130extern struct remote_conf *make_remote_conf(void);
131extern void free_remote_conf(struct remote_conf *);
132
133extern int find_shared_conf(const char *username, const char *host,
134 const char *server, int flags);
135extern void propagate_generic(struct Client *source_p, const char *command,
136 const char *target, int cap, const char *format, ...);
137extern void cluster_generic(struct Client *, const char *, int cltype,
138 int cap, const char *format, ...);
139
140#define OPER_ENCRYPTED 0x00001
141#define OPER_KLINE 0x00002
142#define OPER_UNKLINE 0x00004
143#define OPER_LOCKILL 0x00008
144#define OPER_GLOBKILL 0x00010
145#define OPER_REMOTE 0x00020
212380e3 146#define OPER_XLINE 0x00080
147#define OPER_RESV 0x00100
148#define OPER_NICKS 0x00200
149#define OPER_REHASH 0x00400
150#define OPER_DIE 0x00800
151#define OPER_ADMIN 0x01000
152#define OPER_HADMIN 0x02000
153#define OPER_OPERWALL 0x04000
154#define OPER_INVIS 0x08000
155#define OPER_SPY 0x10000
156#define OPER_REMOTEBAN 0x20000
c13a2d9a 157#define OPER_MASSNOTICE 0x40000
333d73ff 158/* 0x400000 and above are in client.h */
212380e3 159
160#define OPER_FLAGS (OPER_KLINE|OPER_UNKLINE|OPER_LOCKILL|OPER_GLOBKILL|\
d5a432fa 161 OPER_REMOTE|OPER_XLINE|OPER_RESV|\
212380e3 162 OPER_NICKS|OPER_REHASH|OPER_DIE|OPER_ADMIN|\
163 OPER_HADMIN|OPER_OPERWALL|OPER_INVIS|OPER_SPY|\
c13a2d9a 164 OPER_REMOTEBAN|OPER_MASSNOTICE)
212380e3 165
166#define IsOperConfEncrypted(x) ((x)->flags & OPER_ENCRYPTED)
167
168#define IsOperGlobalKill(x) ((x)->flags2 & OPER_GLOBKILL)
169#define IsOperLocalKill(x) ((x)->flags2 & OPER_LOCKILL)
170#define IsOperRemote(x) ((x)->flags2 & OPER_REMOTE)
171#define IsOperUnkline(x) ((x)->flags2 & OPER_UNKLINE)
212380e3 172#define IsOperN(x) ((x)->flags2 & OPER_NICKS)
173#define IsOperK(x) ((x)->flags2 & OPER_KLINE)
174#define IsOperXline(x) ((x)->flags2 & OPER_XLINE)
1ebe6ffc 175#define IsOperResv(x) ((x)->flags2 & OPER_RESV)
212380e3 176#define IsOperDie(x) ((x)->flags2 & OPER_DIE)
177#define IsOperRehash(x) ((x)->flags2 & OPER_REHASH)
178#define IsOperHiddenAdmin(x) ((x)->flags2 & OPER_HADMIN)
179#define IsOperAdmin(x) (((x)->flags2 & OPER_ADMIN) || \
180 ((x)->flags2 & OPER_HADMIN))
181#define IsOperOperwall(x) ((x)->flags2 & OPER_OPERWALL)
182#define IsOperSpy(x) ((x)->flags2 & OPER_SPY)
183#define IsOperInvis(x) ((x)->flags2 & OPER_INVIS)
184#define IsOperRemoteBan(x) ((x)->flags2 & OPER_REMOTEBAN)
c13a2d9a 185#define IsOperMassNotice(x) ((x)->flags2 & OPER_MASSNOTICE)
212380e3 186
187extern struct oper_conf *make_oper_conf(void);
188extern void free_oper_conf(struct oper_conf *);
189extern void clear_oper_conf(void);
190
191extern struct oper_conf *find_oper_conf(const char *username, const char *host,
192 const char *locip, const char *oname);
193
194extern const char *get_oper_privs(int flags);
195
196struct server_conf
197{
198 char *name;
199 char *host;
200 char *passwd;
201 char *spasswd;
202 int port;
203 int flags;
204 int servers;
205 time_t hold;
206
207 int aftype;
3ea5fee7 208 struct rb_sockaddr_storage my_ipnum;
212380e3 209
210 char *class_name;
211 struct Class *class;
08d11e34 212 rb_dlink_node node;
212380e3 213};
214
215#define SERVER_ILLEGAL 0x0001
216#define SERVER_VHOSTED 0x0002
217#define SERVER_ENCRYPTED 0x0004
218#define SERVER_COMPRESSED 0x0008
219#define SERVER_TB 0x0010
220#define SERVER_AUTOCONN 0x0020
8db00894 221#define SERVER_SSL 0x0040
212380e3 222
223#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
224#define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED)
225#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
226#define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED)
227#define ServerConfTb(x) ((x)->flags & SERVER_TB)
228#define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN)
8db00894 229#define ServerConfSSL(x) ((x)->flags & SERVER_SSL)
212380e3 230
231extern struct server_conf *make_server_conf(void);
232extern void free_server_conf(struct server_conf *);
233extern void clear_server_conf(void);
234extern void add_server_conf(struct server_conf *);
235
236extern struct server_conf *find_server_conf(const char *name);
237
238extern void attach_server_conf(struct Client *, struct server_conf *);
239extern void detach_server_conf(struct Client *);
240extern void set_server_conf_autoconn(struct Client *source_p, char *name,
241 int newval);
242
243
244extern struct ConfItem *find_xline(const char *, int);
0fdb2570 245extern struct ConfItem *find_xline_mask(const char *);
212380e3 246extern struct ConfItem *find_nick_resv(const char *name);
0fdb2570 247extern struct ConfItem *find_nick_resv_mask(const char *name);
212380e3 248
249extern int valid_wild_card_simple(const char *);
250extern int clean_resv_nick(const char *);
251time_t valid_temp_time(const char *p);
252
58e8319c
VY
253struct nd_entry
254{
255 char name[NICKLEN+1];
256 time_t expire;
257 rb_dlink_node lnode; /* node in ll */
212380e3 258};
259
260extern void add_nd_entry(const char *name);
261extern void free_nd_entry(struct nd_entry *);
262extern unsigned long get_nd_count(void);
263
264#endif
265