]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
bind ListenAddress for outgoing connections
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 by 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  * $Id: conf.h,v 1.46 2007/11/23 16:26:04 fw Exp $
12  *
13  * Configuration management (header)
14  */
15
16
17 #ifndef __conf_h__
18 #define __conf_h__
19
20 #include <time.h>
21
22 #include "defines.h"
23 #include "array.h"
24 #include "portab.h"
25
26 typedef struct _Conf_Oper
27 {
28         char name[CLIENT_PASS_LEN];     /* Name (ID) of IRC operator */
29         char pwd[CLIENT_PASS_LEN];      /* Password */
30         char *mask;
31 } CONF_OPER;
32
33 typedef struct _Conf_Server
34 {
35         char host[HOST_LEN];            /* Hostname */
36         char ip[16];                    /* IP address (Resolver) */
37         char name[CLIENT_ID_LEN];       /* IRC-Client-ID */
38         char pwd_in[CLIENT_PASS_LEN];   /* Password which must be received */
39         char pwd_out[CLIENT_PASS_LEN];  /* Password to send to peer */
40         UINT16 port;                    /* Server port */
41         int group;                      /* Group of server */
42         time_t lasttry;                 /* Last connect attempt */
43         RES_STAT res_stat;              /* Status of the resolver */
44         int flags;                      /* Flags */
45         CONN_ID conn_id;                /* ID of server connection or NONE */
46         struct in_addr bind_addr;       /* source address to use for outgoing connections */
47 } CONF_SERVER;
48
49 typedef struct _Conf_Channel
50 {
51         char name[CHANNEL_NAME_LEN];    /* Name of the channel */
52         char modes[CHANNEL_MODE_LEN];   /* Initial channel modes */
53         char key[CLIENT_PASS_LEN];      /* Channel key ("password", mode "k" ) */
54         unsigned long maxusers;         /* maximum usercount for this channel, mode "l" */
55         array topic;                    /* Initial topic */
56 } CONF_CHANNEL;
57
58
59 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
60 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
61
62
63 /* Name ("Nick") of the servers */
64 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
65
66 /* Server info text */
67 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
68
69 /* Global server passwort */
70 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
71
72 /* Administrative information */
73 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
74 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
75 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
76
77 /* File with MOTD text */
78 GLOBAL char Conf_MotdFile[FNAME_LEN];
79
80 /* Phrase with MOTD text */
81 GLOBAL char Conf_MotdPhrase[LINE_LEN];
82
83 /* Ports the server should listen on */
84 GLOBAL array Conf_ListenPorts;
85
86 /* Address to which the socket should be bound or empty (=all) */
87 GLOBAL char Conf_ListenAddress[16];
88
89 /* User and group ID the server should run with */
90 GLOBAL uid_t Conf_UID;
91 GLOBAL gid_t Conf_GID;
92
93 /* A directory to chroot() in */
94 GLOBAL char Conf_Chroot[FNAME_LEN];
95
96 /* File with PID of daemon */
97 GLOBAL char Conf_PidFile[FNAME_LEN];
98
99 /* Timeouts for PING and PONG */
100 GLOBAL int Conf_PingTimeout;
101 GLOBAL int Conf_PongTimeout;
102
103 /* Seconds between connect attempts to other servers */
104 GLOBAL int Conf_ConnectRetry;
105
106 /* Operators */
107 GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
108 GLOBAL unsigned int Conf_Oper_Count;
109
110 /* Servers */
111 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
112
113 /* Pre-defined channels */
114 GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
115 GLOBAL unsigned int Conf_Channel_Count;
116 /* Pre-defined channels only */
117 GLOBAL bool Conf_PredefChannelsOnly;
118
119 /* Are IRC operators allowed to always use MODE? */
120 GLOBAL bool Conf_OperCanMode;
121
122 /* Disable all DNS functions? */
123 GLOBAL bool Conf_NoDNS;
124
125 /* If an IRC op gives chanop privileges without being a chanop,
126  * ircd2 will ignore the command. This enables a workaround:
127  * It masks the command as coming from the server */
128 GLOBAL bool Conf_OperServerMode;
129
130 /* Maximum number of connections to this server */
131 GLOBAL long Conf_MaxConnections;
132
133 /* Maximum number of channels a user can join */
134 GLOBAL int Conf_MaxJoins;
135
136 /* Maximum number of connections per IP address */
137 GLOBAL int Conf_MaxConnectionsIP;
138
139 /* Maximum length of a nick name */
140 GLOBAL unsigned int Conf_MaxNickLength;
141
142 GLOBAL void Conf_Init PARAMS((void));
143 GLOBAL void Conf_Rehash PARAMS((void));
144 GLOBAL int Conf_Test PARAMS((void));
145
146 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
147 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
148 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
149
150 GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
151 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
152 GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
153 GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
154
155
156 #endif
157
158
159 /* -eof- */