]> jfr.im git - solanum.git/blame - include/s_newconf.h
Document need_ssl flags in example.conf.
[solanum.git] / include / s_newconf.h
CommitLineData
212380e3
AC
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"
a2e1310c 39#include "privilege.h"
212380e3
AC
40
41#ifdef HAVE_LIBCRYPTO
42#include <openssl/rsa.h>
43#endif
44
45struct ConfItem;
46
5b96d9a6
AC
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
2e819b6b 57extern struct _rb_patricia_tree_t *tgchange_tree;
212380e3
AC
58
59extern void init_s_newconf(void);
60extern void clear_s_newconf(void);
61extern void clear_s_newconf_bans(void);
62
63#define FREE_TARGET(x) ((x)->localClient->targinfo[0])
64#define USED_TARGETS(x) ((x)->localClient->targinfo[1])
65
66typedef struct
67{
68 char *ip;
69 time_t expiry;
5b96d9a6
AC
70 rb_patricia_node_t *pnode;
71 rb_dlink_node node;
212380e3
AC
72} tgchange;
73
74void add_tgchange(const char *host);
75tgchange *find_tgchange(const char *host);
76
77/* shared/cluster/hub/leaf confs */
78struct remote_conf
79{
80 char *username;
81 char *host;
82 char *server;
83 int flags;
5b96d9a6 84 rb_dlink_node node;
212380e3
AC
85};
86
87/* flags used in shared/cluster */
88#define SHARED_TKLINE 0x0001
89#define SHARED_PKLINE 0x0002
90#define SHARED_UNKLINE 0x0004
91#define SHARED_LOCOPS 0x0008
92#define SHARED_TXLINE 0x0010
93#define SHARED_PXLINE 0x0020
94#define SHARED_UNXLINE 0x0040
de82e84f 95#define SHARED_TRESV 0x0080
212380e3
AC
96#define SHARED_PRESV 0x0100
97#define SHARED_UNRESV 0x0200
98#define SHARED_REHASH 0x0400
f5cb68d5
VY
99#define SHARED_TDLINE 0x0800
100#define SHARED_PDLINE 0x1000
101#define SHARED_UNDLINE 0x2000
212380e3
AC
102
103#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
104 SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
c42fb00e 105 SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV)
212380e3
AC
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
a2e1310c
AC
124 struct PrivilegeSet *privset;
125
212380e3
AC
126#ifdef HAVE_LIBCRYPTO
127 char *rsa_pubkey_file;
128 RSA *rsa_pubkey;
129#endif
130};
131
132extern struct remote_conf *make_remote_conf(void);
133extern void free_remote_conf(struct remote_conf *);
134
135extern int find_shared_conf(const char *username, const char *host,
136 const char *server, int flags);
137extern void propagate_generic(struct Client *source_p, const char *command,
138 const char *target, int cap, const char *format, ...);
139extern void cluster_generic(struct Client *, const char *, int cltype,
140 int cap, const char *format, ...);
141
142#define OPER_ENCRYPTED 0x00001
143#define OPER_KLINE 0x00002
144#define OPER_UNKLINE 0x00004
145#define OPER_LOCKILL 0x00008
146#define OPER_GLOBKILL 0x00010
147#define OPER_REMOTE 0x00020
212380e3
AC
148#define OPER_XLINE 0x00080
149#define OPER_RESV 0x00100
150#define OPER_NICKS 0x00200
151#define OPER_REHASH 0x00400
152#define OPER_DIE 0x00800
153#define OPER_ADMIN 0x01000
154#define OPER_HADMIN 0x02000
155#define OPER_OPERWALL 0x04000
156#define OPER_INVIS 0x08000
157#define OPER_SPY 0x10000
158#define OPER_REMOTEBAN 0x20000
a6f4368b 159#define OPER_MASSNOTICE 0x40000
b1594414 160#define OPER_NEEDSSL 0x80000
3fec9477 161/* 0x400000 and above are in client.h */
212380e3
AC
162
163#define OPER_FLAGS (OPER_KLINE|OPER_UNKLINE|OPER_LOCKILL|OPER_GLOBKILL|\
170703fe 164 OPER_REMOTE|OPER_XLINE|OPER_RESV|\
212380e3
AC
165 OPER_NICKS|OPER_REHASH|OPER_DIE|OPER_ADMIN|\
166 OPER_HADMIN|OPER_OPERWALL|OPER_INVIS|OPER_SPY|\
a6f4368b 167 OPER_REMOTEBAN|OPER_MASSNOTICE)
212380e3
AC
168
169#define IsOperConfEncrypted(x) ((x)->flags & OPER_ENCRYPTED)
b1594414 170#define IsOperConfNeedSSL(x) ((x)->flags & OPER_NEEDSSL)
212380e3 171
f37fc938 172#define HasPrivilege(x, y) ((x)->localClient != NULL && (x)->localClient->privset != NULL && privilegeset_in_set((x)->localClient->privset, (y)))
6ac9e53e
AC
173
174#define IsOperGlobalKill(x) (HasPrivilege((x), "oper:global_kill"))
175#define IsOperLocalKill(x) (HasPrivilege((x), "oper:local_kill"))
176#define IsOperRemote(x) (HasPrivilege((x), "oper:routing"))
177#define IsOperUnkline(x) (HasPrivilege((x), "oper:unkline"))
178#define IsOperN(x) (HasPrivilege((x), "snomask:nick_changes"))
179#define IsOperK(x) (HasPrivilege((x), "oper:kline"))
180#define IsOperXline(x) (HasPrivilege((x), "oper:xline"))
181#define IsOperResv(x) (HasPrivilege((x), "oper:resv"))
182#define IsOperDie(x) (HasPrivilege((x), "oper:die"))
183#define IsOperRehash(x) (HasPrivilege((x), "oper:rehash"))
184#define IsOperHiddenAdmin(x) (HasPrivilege((x), "oper:hidden_admin"))
185#define IsOperAdmin(x) (HasPrivilege((x), "oper:admin") || HasPrivilege((x), "oper:hidden_admin"))
186#define IsOperOperwall(x) (HasPrivilege((x), "oper:operwall"))
187#define IsOperSpy(x) (HasPrivilege((x), "oper:spy"))
188#define IsOperInvis(x) (HasPrivilege((x), "oper:hidden"))
189#define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban"))
190#define IsOperMassNotice(x) (HasPrivilege((x), "oper:mass_notice"))
212380e3
AC
191
192extern struct oper_conf *make_oper_conf(void);
193extern void free_oper_conf(struct oper_conf *);
194extern void clear_oper_conf(void);
195
196extern struct oper_conf *find_oper_conf(const char *username, const char *host,
197 const char *locip, const char *oname);
198
199extern const char *get_oper_privs(int flags);
200
201struct server_conf
202{
203 char *name;
204 char *host;
205 char *passwd;
206 char *spasswd;
207 int port;
208 int flags;
209 int servers;
210 time_t hold;
211
212 int aftype;
e7046ee5 213 struct rb_sockaddr_storage my_ipnum;
212380e3
AC
214
215 char *class_name;
216 struct Class *class;
5b96d9a6 217 rb_dlink_node node;
212380e3
AC
218};
219
220#define SERVER_ILLEGAL 0x0001
221#define SERVER_VHOSTED 0x0002
222#define SERVER_ENCRYPTED 0x0004
223#define SERVER_COMPRESSED 0x0008
224#define SERVER_TB 0x0010
225#define SERVER_AUTOCONN 0x0020
c6d72037 226#define SERVER_SSL 0x0040
212380e3
AC
227
228#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
229#define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED)
230#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
231#define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED)
232#define ServerConfTb(x) ((x)->flags & SERVER_TB)
233#define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN)
c6d72037 234#define ServerConfSSL(x) ((x)->flags & SERVER_SSL)
212380e3
AC
235
236extern struct server_conf *make_server_conf(void);
237extern void free_server_conf(struct server_conf *);
238extern void clear_server_conf(void);
239extern void add_server_conf(struct server_conf *);
240
241extern struct server_conf *find_server_conf(const char *name);
242
243extern void attach_server_conf(struct Client *, struct server_conf *);
244extern void detach_server_conf(struct Client *);
a3143c9b 245extern void set_server_conf_autoconn(struct Client *source_p, const char *name,
212380e3
AC
246 int newval);
247
248
249extern struct ConfItem *find_xline(const char *, int);
0fdb2570 250extern struct ConfItem *find_xline_mask(const char *);
212380e3 251extern struct ConfItem *find_nick_resv(const char *name);
0fdb2570 252extern struct ConfItem *find_nick_resv_mask(const char *name);
212380e3
AC
253
254extern int valid_wild_card_simple(const char *);
255extern int clean_resv_nick(const char *);
256time_t valid_temp_time(const char *p);
257
ae78a571
VY
258struct nd_entry
259{
260 char name[NICKLEN+1];
261 time_t expire;
262 rb_dlink_node lnode; /* node in ll */
212380e3
AC
263};
264
265extern void add_nd_entry(const char *name);
266extern void free_nd_entry(struct nd_entry *);
267extern unsigned long get_nd_count(void);
268
269#endif
270