2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
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.
17 * Configuration management (header)
26 #include "ng_ipaddr.h"
31 * Configured IRC operator.
32 * Please note the the name of the IRC operaor 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.
37 char name[CLIENT_PASS_LEN]; /**< Name (ID) */
38 char pwd[CLIENT_PASS_LEN]; /**< Password */
39 char *mask; /**< Allowed host mask */
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.
47 typedef struct _Conf_Server
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
61 ng_ipaddr_t dst_addr[2]; /**< List of addresses to connect to */
63 bool SSLConnect; /**< Establish connection using SSL? */
65 char svs_mask[CLIENT_ID_LEN]; /**< Mask of nick names that should be
66 treated and counted as services */
71 /** Configuration options required for SSL support */
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 */
82 /** Pre-defined channels */
84 char name[CHANNEL_NAME_LEN]; /**< Name of the channel */
85 char modes[CHANNEL_MODE_LEN]; /**< Initial channel modes */
86 char key[CLIENT_PASS_LEN]; /**< Channel key ("password", mode "k" ) */
87 char topic[COMMAND_LEN]; /**< Initial topic */
88 char keyfile[512]; /**< Path and name of channel key file */
89 unsigned long maxusers; /**< User limit for this channel, mode "l" */
93 #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
94 #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
97 /** Name (ID, "nick") of this server */
98 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
100 /** Server info text */
101 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
103 /** Global server passwort */
104 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
106 /** Administrative information */
107 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
108 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
109 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
111 /** Message of the day (MOTD) of this server */
112 GLOBAL array Conf_Motd;
114 /** Array of ports this server should listen on */
115 GLOBAL array Conf_ListenPorts;
117 /** Address to which sockets should be bound to or empty (=all) */
118 GLOBAL char *Conf_ListenAddress;
120 /** User and group ID this daemon should run with */
121 GLOBAL uid_t Conf_UID;
122 GLOBAL gid_t Conf_GID;
124 /** The directory to chroot() into */
125 GLOBAL char Conf_Chroot[FNAME_LEN];
127 /** Full path and name of a file to which the PID of daemon should be written */
128 GLOBAL char Conf_PidFile[FNAME_LEN];
130 /** Timeout (in seconds) for PING commands */
131 GLOBAL int Conf_PingTimeout;
133 /** Timeout (in seconds) for PONG replies */
134 GLOBAL int Conf_PongTimeout;
136 /** Seconds between connection attempts to other servers */
137 GLOBAL int Conf_ConnectRetry;
139 /** Array of configured IRC operators */
140 GLOBAL array Conf_Opers;
142 /** Array of configured IRC servers */
143 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
145 /** Array of pre-defined channels */
146 GLOBAL array Conf_Channels;
148 /** Flag indicating if only pre-defined channels are allowed (true) or not */
149 GLOBAL bool Conf_PredefChannelsOnly;
151 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
152 GLOBAL bool Conf_OperCanMode;
155 * If true, mask channel MODE commands of IRC operators to the server.
156 * Background: ircd2 will ignore channel MODE commands if an IRC operator
157 * gives channel operator privileges to someone without being a channel operator
158 * himself. This enables a workaround: it masks the MODE command as coming
159 * from the IRC server and not the IRC operator.
161 GLOBAL bool Conf_OperServerMode;
163 /** Flag indicating if remote IRC operators are allowed to manage this server */
164 GLOBAL bool Conf_AllowRemoteOper;
166 /** Cloaked hostname of the clients */
167 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
169 /** Use nick name as user name? */
170 GLOBAL bool Conf_CloakUserToNick;
172 /** Enable all DNS functions? */
173 GLOBAL bool Conf_DNS;
175 /** Enable IDENT lookups, even when compiled with support for it */
176 GLOBAL bool Conf_Ident;
178 /** Enable "more privacy" mode and "censor" some user-related information */
179 GLOBAL bool Conf_MorePrivacy;
181 /** Enable NOTICE AUTH messages on connect */
182 GLOBAL bool Conf_NoticeAuth;
184 /** Enable all usage of PAM, even when compiled with support for it */
185 GLOBAL bool Conf_PAM;
187 /** Don't require all clients to send a password an to be PAM authenticated */
188 GLOBAL bool Conf_PAMIsOptional;
190 /** Disable all CTCP commands except for /me ? */
191 GLOBAL bool Conf_ScrubCTCP;
194 * try to connect to remote systems using the ipv6 protocol,
195 * if they have an ipv6 address? (default yes)
197 GLOBAL bool Conf_ConnectIPv6;
199 /** Try to connect to remote systems using the IPv4 protocol (true) */
200 GLOBAL bool Conf_ConnectIPv4;
202 /** Maximum number of simultaneous connections to this server */
203 GLOBAL long Conf_MaxConnections;
205 /** Maximum number of channels a user can join */
206 GLOBAL int Conf_MaxJoins;
208 /** Maximum number of connections per IP address */
209 GLOBAL int Conf_MaxConnectionsIP;
211 /** Maximum length of a nick name */
212 GLOBAL unsigned int Conf_MaxNickLength;
216 /** Require "AUTH PING-PONG" on login */
217 GLOBAL bool Conf_AuthPing;
223 /* Syslog "facility" */
224 GLOBAL int Conf_SyslogFacility;
228 GLOBAL void Conf_Init PARAMS((void));
229 GLOBAL bool Conf_Rehash PARAMS((void));
230 GLOBAL int Conf_Test PARAMS((void));
232 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
233 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
234 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
236 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
237 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
238 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
239 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
241 GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
243 /* Password required by WEBIRC command */
244 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
247 GLOBAL void Conf_DebugDump PARAMS((void));