]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
ngIRCd Release 27
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #ifndef __conf_h__
13 #define __conf_h__
14
15 /**
16  * @file
17  * Configuration management (header)
18  */
19
20 #include <time.h>
21
22 #include "defines.h"
23 #include "array.h"
24 #include "portab.h"
25 #include "tool.h"
26 #include "ng_ipaddr.h"
27 #include "proc.h"
28 #include "conf-ssl.h"
29
30 /**
31  * Configured IRC operator.
32  * Please note that the name of the IRC operator and his nick have nothing to
33  * do with each other! The IRC operator is only identified by the name and
34  * password configured in this structure.
35  */
36 struct Conf_Oper {
37         char name[CLIENT_PASS_LEN];     /**< Name (ID) */
38         char pwd[CLIENT_PASS_LEN];      /**< Password */
39         char *mask;                     /**< Allowed host mask */
40 };
41
42 /**
43  * Configured server.
44  * Peers to which this daemon should establish an outgoing server link must
45  * have set a port number; all other servers are allowed to connect to this one.
46  */
47 typedef struct _Conf_Server
48 {
49         char host[HOST_LEN];            /**< Hostname */
50         char name[CLIENT_ID_LEN];       /**< IRC client ID */
51         char pwd_in[CLIENT_PASS_LEN];   /**< Password which must be received */
52         char pwd_out[CLIENT_PASS_LEN];  /**< Password to send to the peer */
53         UINT16 port;                    /**< Server port to connect to */
54         int group;                      /**< Group ID of this server */
55         time_t lasttry;                 /**< Time of last connection attempt */
56         PROC_STAT res_stat;             /**< Status of the resolver */
57         int flags;                      /**< Server flags */
58         CONN_ID conn_id;                /**< ID of server connection or NONE */
59         ng_ipaddr_t bind_addr;          /**< Source address to use for outgoing
60                                              connections */
61         ng_ipaddr_t dst_addr[2];        /**< List of addresses to connect to */
62 #ifdef SSL_SUPPORT
63         bool SSLConnect;                /**< Establish connection using SSL? */
64 #endif
65         char svs_mask[CLIENT_ID_LEN];   /**< Mask of nicknames that should be
66                                              treated and counted as services */
67 } CONF_SERVER;
68
69
70 #ifdef SSL_SUPPORT
71 /** Configuration options required for SSL support */
72 struct SSLOptions {
73         char *KeyFile;                  /**< SSL key file */
74         char *CertFile;                 /**< SSL certificate file */
75         char *DHFile;                   /**< File containing DH parameters */
76         array ListenPorts;              /**< Array of listening SSL ports */
77         array KeyFilePassword;          /**< Key file password */
78         char *CipherList;               /**< Set SSL cipher list to use */
79 };
80 #endif
81
82
83 /** Pre-defined channels */
84 struct Conf_Channel {
85         char name[CHANNEL_NAME_LEN];    /**< Name of the channel */
86         char *modes[512];               /**< Initial channel modes to evaluate */
87         char key[CLIENT_PASS_LEN];      /**< Channel key ("password", mode "k" ) */
88         char topic[COMMAND_LEN];        /**< Initial topic */
89         char keyfile[512];              /**< Path and name of channel key file */
90         bool autojoin;                  /**< 1 to make all users autojoin this channel */
91         unsigned long maxusers;         /**< User limit for this channel, mode "l" */
92         unsigned int modes_num;         /**< Number of channel modes to evaluate */
93 };
94
95
96 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
97 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
98
99
100 /** Name (ID, "nick") of this server */
101 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
102
103 /** Server info text */
104 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
105
106 /** Global server passwort */
107 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
108
109 /** Administrative information */
110 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
111 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
112 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
113
114 /** Network name (optional, no spaces allowed) */
115 GLOBAL char Conf_Network[CLIENT_INFO_LEN];
116
117 /** Message of the day (MOTD) of this server */
118 GLOBAL array Conf_Motd;
119
120 /** Help text of this server */
121 GLOBAL array Conf_Helptext;
122
123 /** Array of ports this server should listen on */
124 GLOBAL array Conf_ListenPorts;
125
126 /** Address to which sockets should be bound to or empty (=all) */
127 GLOBAL char *Conf_ListenAddress;
128
129 /** User and group ID this daemon should run with */
130 GLOBAL uid_t Conf_UID;
131 GLOBAL gid_t Conf_GID;
132
133 /** The directory to chroot() into */
134 GLOBAL char Conf_Chroot[FNAME_LEN];
135
136 /** Full path and name of a file to which the PID of daemon should be written */
137 GLOBAL char Conf_PidFile[FNAME_LEN];
138
139 /** Timeout (in seconds) for PING commands */
140 GLOBAL int Conf_PingTimeout;
141
142 /** Timeout (in seconds) for PONG replies */
143 GLOBAL int Conf_PongTimeout;
144
145 /** Seconds between connection attempts to other servers */
146 GLOBAL int Conf_ConnectRetry;
147
148 /** Array of configured IRC operators */
149 GLOBAL array Conf_Opers;
150
151 /** Array of configured IRC servers */
152 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
153
154 /** Array of pre-defined channels */
155 GLOBAL array Conf_Channels;
156
157 /** String containing all locally allowed channel prefixes for new channels */
158 GLOBAL char Conf_AllowedChannelTypes[8];
159
160 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
161 GLOBAL bool Conf_OperCanMode;
162
163 /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
164 GLOBAL bool Conf_OperChanPAutoOp;
165
166 /**
167  * If true, mask channel MODE commands of IRC operators to the server.
168  * Background: ircd2 will ignore channel MODE commands if an IRC operator
169  * gives channel operator privileges to someone without being a channel operator
170  * himself. This enables a workaround: it masks the MODE command as coming
171  * from the IRC server and not the IRC operator.
172  */
173 GLOBAL bool Conf_OperServerMode;
174
175 /** Flag indicating if remote IRC operators are allowed to manage this server */
176 GLOBAL bool Conf_AllowRemoteOper;
177
178 /** Cloaked hostname of the clients */
179 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
180
181 /** Cloaked hostname for clients that did +x */
182 GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN];
183
184 /** Salt for hostname hash for cloaked hostnames */
185 GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN];
186
187 /** Use nickname as user name? */
188 GLOBAL bool Conf_CloakUserToNick;
189
190 /** Enable all DNS functions? */
191 GLOBAL bool Conf_DNS;
192
193 /** Enable IDENT lookups, even when compiled with support for it */
194 GLOBAL bool Conf_Ident;
195
196 /** Enable "more privacy" mode and "censor" some user-related information */
197 GLOBAL bool Conf_MorePrivacy;
198
199 /** Enable "NOTICE *" messages on connect */
200 GLOBAL bool Conf_NoticeBeforeRegistration;
201
202 /** Enable all usage of PAM, even when compiled with support for it */
203 GLOBAL bool Conf_PAM;
204
205 /** Don't require all clients to send a password an to be PAM authenticated */
206 GLOBAL bool Conf_PAMIsOptional;
207
208 /** The service name to use for PAM */
209 GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN];
210
211 /** Disable all CTCP commands except for /me ? */
212 GLOBAL bool Conf_ScrubCTCP;
213
214 /** Default user modes for new local clients */
215 GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
216
217 /*
218  * try to connect to remote systems using the ipv6 protocol,
219  * if they have an ipv6 address? (default yes)
220  */
221 GLOBAL bool Conf_ConnectIPv6;
222
223 /** Try to connect to remote systems using the IPv4 protocol (true) */
224 GLOBAL bool Conf_ConnectIPv4;
225
226 /** Idle timeout (seconds), after which the daemon should exit */
227 GLOBAL int Conf_IdleTimeout;
228
229 /** Maximum number of simultaneous connections to this server */
230 GLOBAL int Conf_MaxConnections;
231
232 /** Maximum number of channels a user can join */
233 GLOBAL int Conf_MaxJoins;
234
235 /** Maximum number of connections per IP address */
236 GLOBAL int Conf_MaxConnectionsIP;
237
238 /** Maximum length of a nickname */
239 GLOBAL unsigned int Conf_MaxNickLength;
240
241 /** Maximum number of channels returned to /list */
242 GLOBAL int Conf_MaxListSize;
243
244 /** Maximum seconds to add per "penalty". -1 = unlimited. */
245 GLOBAL time_t Conf_MaxPenaltyTime;
246
247 #ifndef STRICT_RFC
248
249 /** Require "AUTH PING-PONG" on login */
250 GLOBAL bool Conf_AuthPing;
251
252 #endif
253
254 #ifdef SYSLOG
255
256 /* Syslog "facility" */
257 GLOBAL int Conf_SyslogFacility;
258
259 #endif
260
261 GLOBAL void Conf_Init PARAMS((void));
262 GLOBAL bool Conf_Rehash PARAMS((void));
263 GLOBAL int Conf_Test PARAMS((void));
264
265 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
266 GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
267 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
268
269 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
270 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
271 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
272 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
273
274 GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
275 GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
276
277 #ifdef SSL_SUPPORT
278 GLOBAL bool Conf_SSLInUse PARAMS((void));
279 #endif
280
281 /* Password required by WEBIRC command */
282 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
283
284 GLOBAL void Conf_DebugDump PARAMS((void));
285
286
287 #endif
288
289
290 /* -eof- */