1 |
/* General prototypes and external variable declarations. |
2 |
* |
3 |
* IRC Services is copyright (c) 1996-2009 Andrew Church. |
4 |
* E-mail: <achurch@achurch.org> |
5 |
* Parts written by Andrew Kempe and others. |
6 |
* This program is free but copyrighted software; see the file GPL.txt for |
7 |
* details. |
8 |
*/ |
9 |
|
10 |
#ifndef EXTERN_H |
11 |
#define EXTERN_H |
12 |
|
13 |
|
14 |
#define E extern /* This is used in other files as well */ |
15 |
|
16 |
|
17 |
/**** actions.c ****/ |
18 |
|
19 |
E int actions_init(int ac, char **av); |
20 |
E void actions_cleanup(void); |
21 |
E int bad_password(const char *service, User *u, const char *what); |
22 |
E void clear_channel(Channel *chan, int what, const void *param); |
23 |
E const char *set_clear_channel_sender(const char *newsender); |
24 |
E void kill_user(const char *source, const char *user, const char *reason); |
25 |
E void set_topic(const char *source, Channel *c, const char *topic, |
26 |
const char *setter, time_t time); |
27 |
E void set_cmode(const char *sender, Channel *channel, ...); |
28 |
|
29 |
|
30 |
/**** channels.c ****/ |
31 |
|
32 |
E Channel *get_channel(const char *chan); |
33 |
E Channel *first_channel(void); |
34 |
E Channel *next_channel(void); |
35 |
|
36 |
E int channel_init(int ac, char **av); |
37 |
E void channel_cleanup(void); |
38 |
E void get_channel_stats(long *nrec, long *memuse); |
39 |
|
40 |
E Channel *chan_adduser(User *user, const char *chan, int32 modes); |
41 |
E void chan_deluser(User *user, Channel *c); |
42 |
E int chan_has_ban(const char *chan, const char *ban); |
43 |
|
44 |
E void do_cmode(const char *source, int ac, char **av); |
45 |
E void do_topic(const char *source, int ac, char **av); |
46 |
|
47 |
|
48 |
/**** compat.c ****/ |
49 |
|
50 |
#if !HAVE_HSTRERROR |
51 |
# undef hstrerror |
52 |
E const char *hstrerror(int h_errnum); |
53 |
#endif |
54 |
#if !HAVE_SNPRINTF |
55 |
# if BAD_SNPRINTF |
56 |
# define snprintf my_snprintf |
57 |
# endif |
58 |
# define vsnprintf my_vsnprintf |
59 |
E int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); |
60 |
E int snprintf(char *buf, size_t size, const char *fmt, ...); |
61 |
#endif |
62 |
#if !HAVE_STRTOK |
63 |
# undef strtok |
64 |
E char *strtok(char *str, const char *delim); |
65 |
#endif |
66 |
#if !HAVE_STRICMP && !HAVE_STRCASECMP |
67 |
# undef stricmp |
68 |
# undef strnicmp |
69 |
E int stricmp(const char *s1, const char *s2); |
70 |
E int strnicmp(const char *s1, const char *s2, size_t len); |
71 |
#endif |
72 |
#if !HAVE_STRDUP && !MEMCHECKS |
73 |
# undef strdup |
74 |
E char *strdup(const char *s); |
75 |
#endif |
76 |
#if !HAVE_STRSPN |
77 |
# undef strspn |
78 |
# undef strcspn |
79 |
E size_t strspn(const char *s, const char *accept); |
80 |
E size_t strcspn(const char *s, const char *reject); |
81 |
#endif |
82 |
#if !HAVE_STRERROR |
83 |
# undef strerror |
84 |
E char *strerror(int errnum); |
85 |
#endif |
86 |
#if !HAVE_STRSIGNAL |
87 |
# undef strsignal |
88 |
E char *strsignal(int signum); |
89 |
#endif |
90 |
|
91 |
|
92 |
/**** init.c ****/ |
93 |
|
94 |
E char **LoadModules; |
95 |
E int LoadModules_count; |
96 |
E char **LoadLanguageText; |
97 |
E int LoadLanguageText_count; |
98 |
|
99 |
E char * RemoteServer; |
100 |
E int32 RemotePort; |
101 |
E char * RemotePassword; |
102 |
E char * LocalHost; |
103 |
E int32 LocalPort; |
104 |
|
105 |
E char * ServerName; |
106 |
E char * ServerDesc; |
107 |
E char * ServiceUser; |
108 |
E char * ServiceHost; |
109 |
|
110 |
E char * LogFilename; |
111 |
E char PIDFilename[PATH_MAX+1]; |
112 |
E char * MOTDFilename; |
113 |
E char * LockFilename; |
114 |
|
115 |
E int16 DefTimeZone; |
116 |
|
117 |
E int NoBouncyModes; |
118 |
E int NoSplitRecovery; |
119 |
E int StrictPasswords; |
120 |
E int NoAdminPasswordCheck; |
121 |
E int32 BadPassLimit; |
122 |
E time_t BadPassTimeout; |
123 |
E int32 BadPassWarning; |
124 |
E int32 IgnoreDecay; |
125 |
E double IgnoreThreshold; |
126 |
E time_t UpdateTimeout; |
127 |
E time_t WarningTimeout; |
128 |
E int32 ReadTimeout; |
129 |
E int32 TimeoutCheck; |
130 |
E time_t PingFrequency; |
131 |
E int32 MergeChannelModes; |
132 |
E int32 TotalNetBufferSize; |
133 |
E int32 NetBufferSize; |
134 |
E int32 NetBufferLimitInactive; |
135 |
E int32 NetBufferLimitIgnore; |
136 |
|
137 |
E char * EncryptionType; |
138 |
E char * GuestNickPrefix; |
139 |
E char **RejectEmail; |
140 |
E int RejectEmail_count; |
141 |
E int32 ListMax; |
142 |
E int LogMaxUsers; |
143 |
E int EnableGetpass; |
144 |
E int WallAdminPrivs; |
145 |
|
146 |
E int introduce_user(const char *user); |
147 |
E int init(int ac, char **av); |
148 |
E int reconfigure(void); |
149 |
E void cleanup(void); |
150 |
|
151 |
|
152 |
/**** ignore.c ****/ |
153 |
|
154 |
E void ignore_init(User *u); |
155 |
E void ignore_update(User *u, uint32 msec); |
156 |
|
157 |
|
158 |
/**** main.c ****/ |
159 |
|
160 |
E const char *services_dir; |
161 |
E int debug; |
162 |
E int readonly; |
163 |
E int nofork; |
164 |
E int noexpire; |
165 |
E int noakill; |
166 |
E int forceload; |
167 |
E int encrypt_all; |
168 |
|
169 |
E int linked; |
170 |
E int quitting; |
171 |
E int delayed_quit; |
172 |
E int restart; |
173 |
E char quitmsg[BUFSIZE]; |
174 |
E char inbuf[BUFSIZE]; |
175 |
E Socket *servsock; |
176 |
E int save_data; |
177 |
E time_t start_time; |
178 |
E int openlog_failed, openlog_errno; |
179 |
E int cb_connect; |
180 |
E int cb_save_complete; |
181 |
|
182 |
E void connect_callback(Socket *s, void *param_unused); |
183 |
E void disconnect_callback(Socket *s, void *param); |
184 |
E void readfirstline_callback(Socket *s, void *param_unused); |
185 |
E void readline_callback(Socket *s, void *param_unused); |
186 |
|
187 |
E int lock_data(void); |
188 |
E int is_data_locked(void); |
189 |
E int unlock_data(void); |
190 |
E void save_data_now(void); |
191 |
|
192 |
|
193 |
/**** messages.c ****/ |
194 |
|
195 |
E int allow_ignore; |
196 |
/* rest is in messages.h */ |
197 |
|
198 |
|
199 |
/**** misc.c ****/ |
200 |
|
201 |
E unsigned char irc_lowertable[256]; |
202 |
E unsigned char irc_tolower(char c); |
203 |
#define irc_tolower(c) (irc_lowertable[(uint8)(c)]) /* for speed */ |
204 |
E int irc_stricmp(const char *s1, const char *s2); |
205 |
E int irc_strnicmp(const char *s1, const char *s2, int max); |
206 |
E char *strscpy(char *d, const char *s, size_t len); |
207 |
E char *strmove(char *d, const char *s); |
208 |
E char *stristr(const char *s1, const char *s2); |
209 |
E char *strupper(char *s); |
210 |
E char *strlower(char *s); |
211 |
E char *strnrepl(char *s, int32 size, const char *old, const char *new); |
212 |
E char *strtok_remaining(void); |
213 |
/* strbcpy(): strscpy() for a char array destination; uses sizeof(d) as |
214 |
* the size to copy */ |
215 |
#define strbcpy(d,s) strscpy((d), (s), sizeof(d)) |
216 |
|
217 |
E char *merge_args(int argc, char **argv); |
218 |
|
219 |
E int match_wild(const char *pattern, const char *str); |
220 |
E int match_wild_nocase(const char *pattern, const char *str); |
221 |
|
222 |
E unsigned char valid_nick_table[0x10000]; |
223 |
E unsigned char valid_chan_table[0x10000]; |
224 |
E int valid_nick(const char *str); |
225 |
E int valid_chan(const char *str); |
226 |
E int valid_domain(const char *str); |
227 |
E int valid_email(const char *str); |
228 |
E int valid_url(const char *str); |
229 |
E int rejected_email(const char *email); |
230 |
|
231 |
E uint32 time_msec(void); |
232 |
E time_t strtotime(const char *str, char **endptr); |
233 |
E int dotime(const char *s); |
234 |
|
235 |
E uint8 *pack_ip(const char *ipaddr); |
236 |
E char *unpack_ip(const uint8 *ip); |
237 |
E uint8 *pack_ip6(const char *ipaddr); |
238 |
E char *unpack_ip6(const uint8 *ip); |
239 |
|
240 |
E int encode_base64(const void *in, int insize, char *out, int outsize); |
241 |
E int decode_base64(const char *in, void *out, int outsize); |
242 |
|
243 |
typedef int (*range_callback_t)(int num, va_list args); |
244 |
E int process_numlist(const char *numstr, int *count_ret, |
245 |
range_callback_t callback, ...); |
246 |
|
247 |
E long atolsafe(const char *s, long min, long max); |
248 |
|
249 |
|
250 |
/**** process.c ****/ |
251 |
|
252 |
E int split_buf(char *buf, char ***argv, int colon_special); |
253 |
E int process_init(int ac, char **av); |
254 |
E void process_cleanup(void); |
255 |
E void process(void); |
256 |
|
257 |
|
258 |
/**** servers.c ****/ |
259 |
|
260 |
E Server *get_server(const char *servername); |
261 |
E Server *first_server(void); |
262 |
E Server *next_server(void); |
263 |
|
264 |
E int server_init(int ac, char **av); |
265 |
E void server_cleanup(void); |
266 |
E void get_server_stats(long *nservers, long *memuse); |
267 |
E void do_server(const char *source, int ac, char **av); |
268 |
E void do_squit(const char *source, int ac, char **av); |
269 |
|
270 |
|
271 |
/**** signals.c ****/ |
272 |
|
273 |
E void init_signals(void); |
274 |
E void do_sigsetjmp(void *bufptr); /* actually a sigjmp_buf * */ |
275 |
E void enable_signals(void); |
276 |
E void disable_signals(void); |
277 |
|
278 |
|
279 |
/**** users.c ****/ |
280 |
|
281 |
E int32 usercnt, opcnt; |
282 |
|
283 |
E User *get_user(const char *nick); |
284 |
E User *first_user(void); |
285 |
E User *next_user(void); |
286 |
|
287 |
E void quit_user(User *user, const char *quitmsg, int is_kill); |
288 |
E int user_init(int ac, char **av); |
289 |
E void user_cleanup(void); |
290 |
E void get_user_stats(long *nusers, long *memuse); |
291 |
|
292 |
E int do_nick(const char *source, int ac, char **av); |
293 |
E void do_join(const char *source, int ac, char **av); |
294 |
E void do_part(const char *source, int ac, char **av); |
295 |
E void do_kick(const char *source, int ac, char **av); |
296 |
E void do_umode(const char *source, int ac, char **av); |
297 |
E void do_quit(const char *source, int ac, char **av); |
298 |
E void do_kill(const char *source, int ac, char **av); |
299 |
|
300 |
E Channel *join_channel(User *user, const char *channel, int32 modes); |
301 |
E int part_channel(User *user, const char *channel, int callback, |
302 |
const char *param, const char *source); |
303 |
E void part_all_channels(User *user); |
304 |
|
305 |
E int is_oper(const User *user); |
306 |
E Channel *is_on_chan(const User *user, const char *chan); |
307 |
E int is_chanop(const User *user, const char *chan); |
308 |
E int is_voiced(const User *user, const char *chan); |
309 |
|
310 |
E int match_usermask(const char *mask, const User *user); |
311 |
E void split_usermask(const char *mask, char **nick, char **user, char **host); |
312 |
E char *create_mask(const User *user, int use_fakehost); |
313 |
|
314 |
E char *make_guest_nick(void); |
315 |
E int is_guest_nick(const char *nick); |
316 |
|
317 |
|
318 |
|
319 |
#endif /* EXTERN_H */ |
320 |
|
321 |
/* |
322 |
* Local variables: |
323 |
* c-file-style: "stroustrup" |
324 |
* c-file-offsets: ((case-label . *) (statement-case-intro . *)) |
325 |
* indent-tabs-mode: nil |
326 |
* End: |
327 |
* |
328 |
* vim: expandtab shiftwidth=4: |
329 |
*/ |