1 /*
2  * Copyright (C) 2003-2004 E. Will et al.
3  * Copyright (C) 2005-2006 Atheme Development Group
4  * Rights to this code are as documented in doc/LICENSE.
5  *
6  * Global data
7  *
8  */
9 
10 #ifndef ATHEME_GLOBAL_H
11 #define ATHEME_GLOBAL_H
12 
13 /* me, a struct containing basic configuration options and some dynamic
14  * information about our uplink and program state */
15 typedef struct me me_t;
16 
17 /* S T R U C T U R E S */
18 struct me
19 {
20   char *name;                   /* server's name on IRC               */
21   char *desc;                   /* server's description               */
22   char *actual;                 /* the reported name of the uplink    */
23   char *vhost;                  /* IP we bind outgoing stuff to       */
24   unsigned int recontime;           /* time between reconnection attempts */
25   unsigned int restarttime;         /* time before restarting             */
26   char *netname;                /* IRC network name                   */
27   char *hidehostsuffix;         /* host suffix for P10 +x etc         */
28   char *adminname;              /* SRA's name (for ADMIN)             */
29   char *adminemail;             /* SRA's email (for ADMIN             */
30   char *mta;                    /* path to mta program                */
31   char *numeric;		/* server numeric		      */
32 
33   int maxfd;                    /* how many fds do we have?           */
34   unsigned int mdlimit;		/* metadata entry limit		      */
35   time_t start;                 /* starting time                      */
36   server_t *me;                 /* pointer to our server struct       */
37   bool connected;          /* are we connected?                  */
38   bool bursting;           /* are we bursting?                   */
39   bool recvsvr;		/* received server peer               */
40 
41   unsigned int maxlogins;           /* maximum logins per username        */
42   unsigned int maxusers;            /* maximum usernames from one email   */
43   unsigned int maxmemos;
44   unsigned int auth;                /* registration auth type             */
45   unsigned int emaillimit;          /* maximum number of emails sent      */
46   unsigned int emailtime;           /* ... in this amount of time         */
47 
48   unsigned long kline_id;	/* unique ID for AKILLs			*/
49   unsigned long xline_id;	/* unique ID for AKILLs			*/
50   unsigned long qline_id;	/* unique ID for AKILLs			*/
51 
52   time_t uplinkpong;            /* when the uplink last sent a PONG   */
53 
54   char *execname;		/* executable name                    */
55 
56   char *language_name;		/* language file name		      */
57   char *language_translator;	/* translator name		      */
58 
59   char *register_email;         /* from address on e-mails            */
60 
61   bool hidden;			/* whether or not we should hide ourselves in /links (if the ircd supports it) */
62 };
63 
64 E me_t me;
65 
66 /* values for me.auth */
67 #define AUTH_NONE  0
68 #define AUTH_EMAIL 1
69 
70 /* config_options, a struct containing other global configuration options */
71 struct ConfOption
72 {
73   char *helpchan;		/* official help channel    */
74   char *helpurl;		/* official help URL	    */
75 
76   unsigned int flood_msgs;          /* messages determining flood */
77   unsigned int flood_time;          /* time determining flood     */
78   unsigned int ratelimit_uses;	    /* uses of a ratelimited command */
79   unsigned int ratelimit_period;    /* period in which ratelimit_uses are done */
80   unsigned int kline_time;          /* default expire for klines  */
81   unsigned int clone_time;          /* default expire for clone exemptions */
82   unsigned int commit_interval;     /* interval between commits   */
83 
84   bool silent;               /* stop sending WALLOPS?      */
85   bool join_chans;           /* join registered channels?  */
86   bool leave_chans;          /* leave channels when empty? */
87   bool secure;               /* require /msg <service>@host? */
88   bool kline_with_ident;     /* kline ident@host instead of *@host on automated bans? */
89   bool kline_verified_ident; /* Don't kline ident@host if first char of ident is ~ ? */
90 
91   unsigned int defuflags;           /* default username flags     */
92   unsigned int defcflags;           /* default channel flags      */
93 
94   bool raw;                /* enable raw/inject?         */
95 
96   char *global;                 /* nick for global noticer    */
97   char *languagefile;		/* path to language file (if any) */
98 
99   bool verbose_wallops;	/* verbose wallops? :)        */
100 
101   unsigned int default_clone_allowed;  /* default clone kill */
102   unsigned int default_clone_warn;  /* default clone warn */
103   bool clone_increase;  /* If the clone limit will increase based on # of identified clones */
104 
105   unsigned int uplink_sendq_limit;
106 
107   char *language;		/* default language */
108 
109   mowgli_list_t exempts;		/* List of masks never to automatically kline */
110 
111   bool allow_taint;		/* allow tainted operation */
112 
113   unsigned int immune_level;	/* what flag is required for kick immunity */
114 
115   bool show_entity_id;		/* do not require user:auspex to see entity IDs */
116 };
117 
118 E struct ConfOption config_options;
119 
120 /* keep track of how many of what we have */
121 struct cnt
122 {
123   unsigned int event;
124   unsigned int soper;
125   unsigned int svsignore;
126   unsigned int tld;
127   unsigned int kline;
128   unsigned int xline;
129   unsigned int qline;
130   unsigned int server;
131   unsigned int user;
132   unsigned int chan;
133   unsigned int chanuser;
134   unsigned int myuser;
135   unsigned int mynick;
136   unsigned int mychan;
137   unsigned int chanacs;
138   unsigned int node;
139   unsigned int bin;
140   unsigned int bout;
141   unsigned int uplink;
142   unsigned int operclass;
143   unsigned int myuser_access;
144   unsigned int myuser_name;
145 };
146 
147 E struct cnt cnt;
148 
149 typedef struct claro_state_ {
150 	unsigned int node;
151 	unsigned int event;
152 	time_t currtime;
153 	int maxfd;
154 } claro_state_t;
155 
156 E claro_state_t claro_state;
157 
158 #define CURRTIME claro_state.currtime
159 
160 /* run flags */
161 E int runflags;
162 
163 #define RF_LIVE         0x00000001      /* don't fork  */
164 #define RF_SHUTDOWN     0x00000002      /* shut down   */
165 #define RF_STARTING     0x00000004      /* starting up */
166 #define RF_RESTART      0x00000008      /* restart     */
167 #define RF_REHASHING    0x00000010      /* rehashing   */
168 
169 /* node.c */
170 E void init_nodes(void);
171 /* The following currently only do uplinks -- jilles */
172 E void mark_all_illegal(void);
173 E void unmark_all_illegal(void);
174 E void remove_illegals(void);
175 
176 /* atheme.c */
177 E mowgli_eventloop_t *base_eventloop;
178 E bool cold_start;
179 E bool readonly;
180 E bool offline_mode;
181 E bool permissive_mode;
182 E char *config_file;
183 E char *datadir;
184 
185 /* conf.c */
186 E const char *get_conf_opts(void);
187 
188 /* version.c */
189 E const char *creation;
190 E const char *platform;
191 E const char *version;
192 E const char *revision;
193 E const char *osinfo;
194 E const char *infotext[];
195 
196 /* signal.c */
197 E void check_signals(void);
198 E void childproc_add(pid_t pid, const char *desc, void (*cb)(pid_t pid, int status, void *data), void *data);
199 E void childproc_delete_all(void (*cb)(pid_t pid, int status, void *data));
200 
201 #endif
202 
203 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
204  * vim:ts=8
205  * vim:sw=8
206  * vim:noexpandtab
207  */
208