ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/global.h
Revision: 1.4
Committed: Sun Sep 9 20:05:51 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -1 lines
Log Message:
- changed configurations to the c++ stdlib
- more #defines to enum
- removed getopt.h and link.h from the system as they were unused
- reworked logstreams
- added an itoa with old syntax
- made klines objects
- moved some global variables into appropriate classes
- fixed boost.foreach's compiler workaround #if's
- allow other files to add exceptions with ADD_EXCEPTION
- changed mynick_t to c++ object
- moved servers.h out of atheme.h
- corrected PING from inspircd 1.2

File Contents

# User Rev Content
1 pippijn 1.1 /*
2 pippijn 1.3 * Copyright © 2003-2004 E. Will et al.
3     * Copyright © 2005-2006 Atheme Development Group
4 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
5 pippijn 1.1 *
6     * Global data
7     *
8 pippijn 1.4 * $Id: global.h,v 1.3 2007-08-28 17:08:06 pippijn Exp $
9 pippijn 1.1 */
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 pippijn 1.3 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 pippijn 1.1
47 pippijn 1.3 time_t uplinkpong; /* when the uplink last sent a PONG */
48 pippijn 1.1
49 pippijn 1.3 char *execname; /* executable name */
50 pippijn 1.1
51     int argc;
52     char **argv;
53    
54 pippijn 1.3 void init ();
55     void fini ();
56    
57 pippijn 1.1 me_t &operator = (const me_t &rhs);
58 pippijn 1.3 ~me_t ()
59     {
60     fini ();
61     }
62 pippijn 1.1 };
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 pippijn 1.3 struct conf_option_t
72 pippijn 1.1 {
73 pippijn 1.3 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 pippijn 1.1
80 pippijn 1.3 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 pippijn 1.1
85 pippijn 1.3 unsigned defuflags; /* default username flags */
86     unsigned defcflags; /* default channel flags */
87 pippijn 1.1
88 pippijn 1.3 bool raw; /* enable raw/inject? */
89 pippijn 1.1
90 pippijn 1.3 char *global; /* nick for global noticer */
91     char *languagefile; /* path to language file (if any) */
92 pippijn 1.1
93 pippijn 1.3 bool verbose_wallops; /* verbose wallops? :) */
94     bool use_privmsg; /* use privmsg instead of notice */
95 pippijn 1.1
96 pippijn 1.3 unsigned default_clone_limit; /* default clone limit */
97 pippijn 1.1 };
98    
99 pippijn 1.3 struct database_t
100 pippijn 1.1 {
101     char *user;
102     char *pass;
103     char *database;
104     char *host;
105 pippijn 1.3 unsigned port;
106 pippijn 1.1 };
107    
108     /* keep track of how many of what we have */
109 pippijn 1.3 struct cnt_t
110 pippijn 1.1 {
111 pippijn 1.3 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 pippijn 1.1 };
131    
132 pippijn 1.3 struct system_state_t
133 pippijn 1.1 {
134 pippijn 1.3 unsigned node;
135     unsigned event;
136 pippijn 1.1 time_t currtime;
137 pippijn 1.3 unsigned maxfd;
138 pippijn 1.1 };
139    
140 pippijn 1.3 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 pippijn 1.1
145 pippijn 1.3 #define NOW system_state.currtime
146 pippijn 1.1
147     /* run flags */
148     E int runflags;
149    
150 pippijn 1.3 #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 pippijn 1.1
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 pippijn 1.3 /* confparse.c */
163 pippijn 1.1 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 pippijn 1.4 E char const website[];
180 pippijn 1.3 E char const generation[];
181     E char const creation[];
182     E char const platform[];
183     E char const version[];
184     E char const revision[];
185     E char const osinfo[];
186     E char const * const infotext[];
187 pippijn 1.1
188     #endif