ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/global.h
Revision: 1.3
Committed: Tue Aug 28 17:08:06 2007 UTC (16 years, 9 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +103 -100 lines
Log Message:
- changed name
- updated the example config to the new system
- added more documentation
- enhanced documentation generators
- added a link to the pdf to the website
- added an RSS feed generator
- transitioned hooks to c++ callbacks
- did various merges with upstream along the way
- added const where appropriate
- removed the old block allocator
- fixed most memory leaks
- transitioned some dictionaries to std::map
- transitioned some lists to std::vector
- made some free functions members where appropriate
- renamed string to dynstr and added a static string ststr
- use NOW instead of time (NULL) if possible
- completely reworked database backends, crypto handlers and protocol handlers
  to use an object factory
- removed the old module system. ermyth does not do any dynamic loading anymore
- fixed most of the build system
- reworked how protocol commands work

File Contents

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