1 | /* |
1 | /* |
2 | * Copyright © 2003-2004 E. Will et al. |
2 | * Copyright © 2003-2004 E. Will et al. |
3 | * Copyright © 2005-2006 Atheme Development Group |
3 | * Copyright © 2005-2006 Atheme Development Group |
4 | * Rights to this code are as documented in doc/pod/license.pod. |
4 | * Rights to this code are as documented in doc/pod/license.pod. |
5 | * |
5 | * |
6 | * Global data |
6 | * Global data |
7 | * |
7 | * |
8 | * $Id: global.h,v 1.2 2007/07/21 01:29:07 pippijn Exp $ |
8 | * $Id: global.h,v 1.3 2007/08/28 17:08:06 pippijn Exp $ |
9 | */ |
9 | */ |
10 | |
10 | |
11 | #ifndef _GLOBAL_H |
11 | #ifndef _GLOBAL_H |
12 | #define _GLOBAL_H |
12 | #define _GLOBAL_H |
13 | |
13 | |
14 | /* me, a struct containing basic configuration options and some dynamic |
14 | /* me, a struct containing basic configuration options and some dynamic |
15 | * information about our uplink and program state */ |
15 | * information about our uplink and program state */ |
16 | struct me_t |
16 | struct me_t |
17 | { |
17 | { |
18 | char *name; /* server's name on IRC */ |
18 | char *name; /* server's name on IRC */ |
19 | char *desc; /* server's description */ |
19 | char *desc; /* server's description */ |
20 | char *actual; /* the reported name of the uplink */ |
20 | char *actual; /* the reported name of the uplink */ |
21 | char *vhost; /* IP we bind outgoing stuff to */ |
21 | char *vhost; /* IP we bind outgoing stuff to */ |
22 | unsigned int recontime; /* time between reconnection attempts */ |
22 | unsigned recontime; /* time between reconnection attempts */ |
23 | unsigned int restarttime; /* time before restarting */ |
23 | unsigned restarttime; /* time before restarting */ |
24 | char *netname; /* IRC network name */ |
24 | char *netname; /* IRC network name */ |
25 | char *hidehostsuffix; /* host suffix for P10 +x etc */ |
25 | char *hidehostsuffix; /* host suffix for P10 +x etc */ |
26 | char *adminname; /* SRA's name (for ADMIN) */ |
26 | char *adminname; /* SRA's name (for ADMIN) */ |
27 | char *adminemail; /* SRA's email (for ADMIN */ |
27 | char *adminemail; /* SRA's email (for ADMIN */ |
28 | char *mta; /* path to mta program */ |
28 | char *mta; /* path to mta program */ |
29 | char *numeric; /* server numeric */ |
29 | char *numeric; /* server numeric */ |
30 | |
30 | |
31 | int maxfd; /* how many fds do we have? */ |
31 | int maxfd; /* how many fds do we have? */ |
32 | unsigned int mdlimit; /* metadata entry limit */ |
32 | unsigned mdlimit; /* metadata entry limit */ |
33 | time_t start; /* starting time */ |
33 | time_t start; /* starting time */ |
34 | server_t *me; /* pointer to our server struct */ |
34 | server_t *me; /* pointer to our server struct */ |
35 | bool connected; /* are we connected? */ |
35 | bool connected; /* are we connected? */ |
36 | bool bursting; /* are we bursting? */ |
36 | bool bursting; /* are we bursting? */ |
37 | bool recvsvr; /* received server peer */ |
37 | bool recvsvr; /* received server peer */ |
38 | |
38 | |
39 | unsigned int maxlogins; /* maximum logins per username */ |
39 | unsigned maxlogins; /* maximum logins per username */ |
40 | unsigned int maxusers; /* maximum usernames from one email */ |
40 | unsigned maxusers; /* maximum usernames from one email */ |
41 | unsigned int maxnicks; /* maximum nicks from one username */ |
41 | unsigned maxnicks; /* maximum nicks from one username */ |
42 | unsigned int maxchans; /* maximum chans from one username */ |
42 | unsigned maxchans; /* maximum chans from one username */ |
43 | unsigned int auth; /* registration auth type */ |
43 | unsigned auth; /* registration auth type */ |
44 | unsigned int emaillimit; /* maximum number of emails sent */ |
44 | unsigned emaillimit; /* maximum number of emails sent */ |
45 | time_t emailtime; /* ... in this amount of time */ |
45 | time_t emailtime; /* ... in this amount of time */ |
46 | |
46 | |
47 | time_t uplinkpong; /* when the uplink last sent a PONG */ |
47 | time_t uplinkpong; /* when the uplink last sent a PONG */ |
48 | |
48 | |
49 | char *execname; /* executable name */ |
49 | char *execname; /* executable name */ |
50 | |
|
|
51 | char *language_name; /* language file name */ |
|
|
52 | char *language_translator; /* translator name */ |
|
|
53 | |
50 | |
54 | int argc; |
51 | int argc; |
55 | char **argv; |
52 | char **argv; |
56 | |
53 | |
|
|
54 | void init (); |
|
|
55 | void fini (); |
|
|
56 | |
57 | me_t &operator = (const me_t &rhs); |
57 | me_t &operator = (const me_t &rhs); |
58 | ~me_t (); |
58 | ~me_t () |
59 | |
59 | { |
60 | void destroy (); |
60 | fini (); |
|
|
61 | } |
61 | }; |
62 | }; |
62 | |
63 | |
63 | E me_t me; |
64 | E me_t me; |
64 | |
65 | |
65 | /* values for me.auth */ |
66 | /* values for me.auth */ |
66 | #define AUTH_NONE 0 |
67 | #define AUTH_NONE 0 |
67 | #define AUTH_EMAIL 1 |
68 | #define AUTH_EMAIL 1 |
68 | |
69 | |
69 | /* config_options, a struct containing other global configuration options */ |
70 | /* config_options, a struct containing other global configuration options */ |
70 | struct ConfOption |
71 | struct conf_option_t |
71 | { |
72 | { |
72 | char *chan; /* channel we join/msg */ |
73 | char *chan; /* channel we join/msg */ |
73 | |
74 | |
74 | unsigned int flood_msgs; /* messages determining flood */ |
75 | unsigned flood_msgs; /* messages determining flood */ |
75 | time_t flood_time; /* time determining flood */ |
76 | time_t flood_time; /* time determining flood */ |
76 | time_t kline_time; /* default expire for klines */ |
77 | time_t kline_time; /* default expire for klines */ |
77 | unsigned int commit_interval; /* interval between commits */ |
78 | unsigned commit_interval; /* interval between commits */ |
78 | |
79 | |
79 | bool silent; /* stop sending WALLOPS? */ |
80 | bool silent; /* stop sending WALLOPS? */ |
80 | bool join_chans; /* join registered channels? */ |
81 | bool join_chans; /* join registered channels? */ |
81 | bool leave_chans; /* leave channels when empty? */ |
82 | bool leave_chans; /* leave channels when empty? */ |
82 | bool secure; /* require /msg <service>@host? */ |
83 | bool secure; /* require /msg <service>@host? */ |
83 | |
84 | |
84 | unsigned int defuflags; /* default username flags */ |
85 | unsigned defuflags; /* default username flags */ |
85 | unsigned int defcflags; /* default channel flags */ |
86 | unsigned defcflags; /* default channel flags */ |
86 | |
87 | |
87 | bool raw; /* enable raw/inject? */ |
88 | bool raw; /* enable raw/inject? */ |
88 | |
89 | |
89 | char *global; /* nick for global noticer */ |
90 | char *global; /* nick for global noticer */ |
90 | char *languagefile; /* path to language file (if any) */ |
91 | char *languagefile; /* path to language file (if any) */ |
91 | |
92 | |
92 | bool verbose_wallops; /* verbose wallops? :) */ |
93 | bool verbose_wallops; /* verbose wallops? :) */ |
93 | bool use_privmsg; /* use privmsg instead of notice */ |
94 | bool use_privmsg; /* use privmsg instead of notice */ |
|
|
95 | |
|
|
96 | unsigned default_clone_limit; /* default clone limit */ |
94 | }; |
97 | }; |
95 | |
98 | |
96 | struct Database |
99 | struct database_t |
97 | { |
100 | { |
98 | char *user; |
101 | char *user; |
99 | char *pass; |
102 | char *pass; |
100 | char *database; |
103 | char *database; |
101 | char *host; |
104 | char *host; |
102 | unsigned int port; |
105 | unsigned port; |
103 | }; |
106 | }; |
104 | |
107 | |
105 | /* keep track of how many of what we have */ |
108 | /* keep track of how many of what we have */ |
106 | struct cnt |
109 | struct cnt_t |
107 | { |
110 | { |
108 | unsigned int event; |
111 | unsigned event; |
109 | unsigned int soper; |
112 | unsigned soper; |
110 | unsigned int svsignore; |
113 | unsigned svsignore; |
111 | unsigned int tld; |
114 | unsigned tld; |
112 | unsigned int kline; |
115 | unsigned kline; |
113 | unsigned int server; |
116 | unsigned server; |
114 | unsigned int user; |
117 | unsigned user; |
115 | unsigned int chan; |
118 | unsigned chan; |
116 | unsigned int chanuser; |
119 | unsigned chanuser; |
117 | unsigned int myuser; |
120 | unsigned myuser; |
118 | unsigned int mynick; |
121 | unsigned mynick; |
119 | unsigned int mychan; |
122 | unsigned mychan; |
120 | unsigned int chanacs; |
123 | unsigned chanacs; |
121 | unsigned int node; |
124 | unsigned node; |
122 | unsigned int bin; |
125 | unsigned bin; |
123 | unsigned int bout; |
126 | unsigned bout; |
124 | unsigned int uplink; |
127 | unsigned uplink; |
125 | unsigned int operclass; |
128 | unsigned operclass; |
126 | unsigned int myuser_access; |
129 | unsigned myuser_access; |
127 | }; |
130 | }; |
128 | |
131 | |
129 | struct claro_state_t |
132 | struct system_state_t |
130 | { |
133 | { |
131 | unsigned int node; |
134 | unsigned node; |
132 | unsigned int event; |
135 | unsigned event; |
133 | time_t currtime; |
136 | time_t currtime; |
134 | unsigned int maxfd; |
137 | unsigned maxfd; |
135 | }; |
138 | }; |
136 | |
139 | |
137 | E claro_state_t claro_state; |
140 | E system_state_t system_state; |
138 | E struct cnt cnt; |
141 | E cnt_t cnt; |
139 | E Database database_options; |
142 | E database_t database_options; |
140 | E ConfOption config_options; |
143 | E conf_option_t config_options; |
141 | |
144 | |
142 | #define NOW claro_state.currtime |
145 | #define NOW system_state.currtime |
143 | |
146 | |
144 | /* run flags */ |
147 | /* run flags */ |
145 | E int runflags; |
148 | E int runflags; |
146 | |
149 | |
147 | #define RF_LIVE 0x00000001 /* don't fork */ |
150 | #define RF_LIVE 0x00000001 /* don't fork */ |
148 | #define RF_SHUTDOWN 0x00000002 /* shut down */ |
151 | #define RF_SHUTDOWN 0x00000002 /* shut down */ |
149 | #define RF_STARTING 0x00000004 /* starting up */ |
152 | #define RF_STARTING 0x00000004 /* starting up */ |
150 | #define RF_RESTART 0x00000008 /* restart */ |
153 | #define RF_RESTART 0x00000008 /* restart */ |
151 | #define RF_REHASHING 0x00000010 /* rehashing */ |
154 | #define RF_REHASHING 0x00000010 /* rehashing */ |
152 | |
155 | |
153 | /* conf.c */ |
156 | /* conf.c */ |
154 | E bool conf_parse (char *); |
157 | E bool conf_parse (char *); |
155 | E void conf_init (void); |
158 | E void conf_init (void); |
156 | E bool conf_rehash (void); |
159 | E bool conf_rehash (void); |
157 | E bool conf_check (void); |
160 | E bool conf_check (void); |
158 | |
161 | |
159 | /* confp.c */ |
162 | /* confparse.c */ |
160 | E void config_free (config_file_t *cfptr); |
163 | E void config_free (config_file_t *cfptr); |
161 | E config_file_t *config_load (char *filename); |
164 | E config_file_t *config_load (char *filename); |
162 | E config_entry_t *config_find (config_entry_t *ceptr, char *name); |
165 | E config_entry_t *config_find (config_entry_t *ceptr, char *name); |
163 | |
166 | |
164 | /* node.c */ |
167 | /* node.c */ |
… | |
… | |
171 | /* atheme.c */ |
174 | /* atheme.c */ |
172 | E bool cold_start; |
175 | E bool cold_start; |
173 | E char *config_file; |
176 | E char *config_file; |
174 | |
177 | |
175 | /* version.c */ |
178 | /* version.c */ |
176 | E const char *generation; |
179 | E char const generation[]; |
177 | E const char *creation; |
180 | E char const creation[]; |
178 | E const char *platform; |
181 | E char const platform[]; |
179 | E const char *version; |
182 | E char const version[]; |
180 | E const char *revision; |
183 | E char const revision[]; |
181 | E const char *osinfo; |
184 | E char const osinfo[]; |
182 | E const char *infotext[]; |
185 | E char const * const infotext[]; |
183 | |
186 | |
184 | #endif |
187 | #endif |