]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
New configuration option "SyslogFacility"
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
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  * Configuration management (header)
12  */
13
14
15 #ifndef __conf_h__
16 #define __conf_h__
17
18 #include <time.h>
19
20 #include "defines.h"
21 #include "array.h"
22 #include "portab.h"
23 #include "tool.h"
24 #include "ng_ipaddr.h"
25 #include "proc.h"
26 #include "conf-ssl.h"
27
28
29 struct Conf_Oper {
30         char name[CLIENT_PASS_LEN];     /* Name (ID) of IRC operator */
31         char pwd[CLIENT_PASS_LEN];      /* Password */
32         char *mask;                     /* allowed host mask */
33 };
34
35 typedef struct _Conf_Server
36 {
37         char host[HOST_LEN];            /* Hostname */
38         char name[CLIENT_ID_LEN];       /* IRC-Client-ID */
39         char pwd_in[CLIENT_PASS_LEN];   /* Password which must be received */
40         char pwd_out[CLIENT_PASS_LEN];  /* Password to send to peer */
41         UINT16 port;                    /* Server port */
42         int group;                      /* Group of server */
43         time_t lasttry;                 /* Last connect attempt */
44         PROC_STAT res_stat;             /* Status of the resolver */
45         int flags;                      /* Flags */
46         CONN_ID conn_id;                /* ID of server connection or NONE */
47         ng_ipaddr_t bind_addr;          /* source address to use for outgoing
48                                            connections */
49         ng_ipaddr_t dst_addr[2];        /* list of addresses to connect to */
50 #ifdef SSL_SUPPORT
51         bool SSLConnect;                /* connect() using SSL? */
52 #endif
53         char svs_mask[CLIENT_ID_LEN];   /* Mask of nick names that are
54                                            services */
55 } CONF_SERVER;
56
57
58 #ifdef SSL_SUPPORT
59 struct SSLOptions {
60         char *KeyFile;
61         char *CertFile;
62         char *DHFile;
63         array ListenPorts;
64         array KeyFilePassword;
65 };
66 #endif
67
68
69 struct Conf_Channel {
70         char name[CHANNEL_NAME_LEN];    /* Name of the channel */
71         char modes[CHANNEL_MODE_LEN];   /* Initial channel modes */
72         char key[CLIENT_PASS_LEN];      /* Channel key ("password", mode "k" ) */
73         char topic[COMMAND_LEN];        /* Initial topic */
74         char keyfile[512];              /* Path and name of channel key file */
75         unsigned long maxusers;         /* maximum usercount for this channel, mode "l" */
76 };
77
78
79 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
80 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
81
82
83 /* Name ("Nick") of the servers */
84 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
85
86 /* Server info text */
87 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
88
89 /* Global server passwort */
90 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
91
92 /* Administrative information */
93 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
94 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
95 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
96
97 /* Message of the Day */
98 GLOBAL array Conf_Motd;
99
100 /* Ports the server should listen on */
101 GLOBAL array Conf_ListenPorts;
102
103 /* Address to which the socket should be bound or empty (=all) */
104 GLOBAL char *Conf_ListenAddress;
105
106 /* User and group ID the server should run with */
107 GLOBAL uid_t Conf_UID;
108 GLOBAL gid_t Conf_GID;
109
110 /* A directory to chroot() in */
111 GLOBAL char Conf_Chroot[FNAME_LEN];
112
113 /* File with PID of daemon */
114 GLOBAL char Conf_PidFile[FNAME_LEN];
115
116 /* Timeouts for PING and PONG */
117 GLOBAL int Conf_PingTimeout;
118 GLOBAL int Conf_PongTimeout;
119
120 /* Seconds between connect attempts to other servers */
121 GLOBAL int Conf_ConnectRetry;
122
123 /* Operators */
124 GLOBAL array Conf_Opers;
125
126 /* Servers */
127 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
128
129 /* Pre-defined channels */
130 GLOBAL array Conf_Channels;
131
132 /* Pre-defined channels only */
133 GLOBAL bool Conf_PredefChannelsOnly;
134
135 /* Are IRC operators allowed to always use MODE? */
136 GLOBAL bool Conf_OperCanMode;
137
138 /* If an IRC op gives chanop privileges without being a chanop,
139  * ircd2 will ignore the command. This enables a workaround:
140  * It masks the command as coming from the server */
141 GLOBAL bool Conf_OperServerMode;
142
143 /* Are remote IRC operators allowed to manage this server? */
144 GLOBAL bool Conf_AllowRemoteOper;
145
146 /* Disable all DNS functions? */
147 GLOBAL bool Conf_NoDNS;
148
149 /* Disable IDENT lookups, even when compiled with support for it */
150 GLOBAL bool Conf_NoIdent;
151
152 /* Disable all usage of PAM, even when compiled with support for it */
153 GLOBAL bool Conf_NoPAM;
154
155 /*
156  * try to connect to remote systems using the ipv6 protocol,
157  * if they have an ipv6 address? (default yes)
158  */
159 GLOBAL bool Conf_ConnectIPv6;
160
161 /* same as above, but for ipv4 hosts, default: yes  */
162 GLOBAL bool Conf_ConnectIPv4;
163
164 /* Maximum number of connections to this server */
165 GLOBAL long Conf_MaxConnections;
166
167 /* Maximum number of channels a user can join */
168 GLOBAL int Conf_MaxJoins;
169
170 /* Maximum number of connections per IP address */
171 GLOBAL int Conf_MaxConnectionsIP;
172
173 /* Maximum length of a nick name */
174 GLOBAL unsigned int Conf_MaxNickLength;
175
176 #ifdef SYSLOG
177
178 /* Syslog "facility" */
179 GLOBAL int Conf_SyslogFacility;
180
181 #endif
182
183 GLOBAL void Conf_Init PARAMS((void));
184 GLOBAL bool Conf_Rehash PARAMS((void));
185 GLOBAL int Conf_Test PARAMS((void));
186
187 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
188 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
189 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
190
191 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
192 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
193 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
194 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
195
196 GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
197
198 /* Password required by WEBIRC command */
199 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
200
201 #ifdef DEBUG
202 GLOBAL void Conf_DebugDump PARAMS((void));
203 #endif
204
205
206 #endif
207
208
209 /* -eof- */