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