1 /*
2  * proto.h
3  *   prototypes for every function used outside its own module
4  *
5  * $Id: proto.h,v 1.62 (0.9) 2004/01/11 16:13:36 [Xp-AvR] Exp $
6  */
7 
8 #ifndef _EVANGELINE_PROTO_H
9 #define _EVANGELINE_PROTO_H
10 
11 #include "lush.h"
12 
13 #ifdef HAVE_DPRINTF
14 #define dprintf dprintf_evangeline
15 #endif
16 
17 struct chanset_t;               /* keeps the compiler warnings down :) */
18 struct userrec;
19 struct maskrec;
20 struct igrec;
21 struct flag_record;
22 struct list_type;
23 struct tand_t_struct;
24 
25 #if !defined(MAKING_MODS)
26 extern void (*encrypt_pass) (char *, char *);
27 extern char *(*encrypt_string) (char *, char *);
28 extern char *(*decrypt_string) (char *, char *);
29 extern int (*rfc_casecmp) (const char *, const char *);
30 extern int (*rfc_ncasecmp) (const char *, const char *, int);
31 extern int (*rfc_toupper) (int);
32 extern int (*rfc_tolower) (int);
33 extern int (*match_noterej) (struct userrec *, char *);
34 #endif
35 
36 /* botcmd.c */
37 void bot_share(int, char *);
38 int base64_to_int(char *);
39 
40 /* botnet.c */
41 void answer_local_whom(int, int);
42 char *lastbot(char *);
43 int nextbot(char *);
44 int in_chain(char *);
45 void tell_bots(int);
46 void tell_bottree(int, int);
47 int botlink(char *, int, char *);
48 int botunlink(int, char *, char *, char *);
49 void dump_links(int);
50 void addbot(char *, char *, char *, char, int);
51 void updatebot(int, char *, char, int);
52 void rembot(char *);
53 struct tand_t_struct *findbot(char *);
54 void unvia(int, struct tand_t_struct *);
55 void check_botnet_pings();
56 int partysock(char *, char *);
57 int addparty(char *, char *, int, char, int, char *, int *);
58 void remparty(char *, int);
59 void partystat(char *, int, int, int);
60 int partynick(char *, int, char *);
61 int partyidle(char *, char *);
62 void partysetidle(char *, int, int);
63 void partyaway(char *, int, char *);
64 void zapfbot(int);
65 void tandem_relay(int, char *, int);
66 int getparty(char *, int);
67 
68 /* botmsg.c */
69 int add_note(char *, char *, char *, int, int);
70 int simple_sprintf EVANGELINE_VARARGS(char *, arg1);
71 void tandout_but EVANGELINE_VARARGS(int, arg1);
72 char *int_to_base10(int);
73 char *unsigned_int_to_base10(unsigned int);
74 char *int_to_base64(unsigned int);
75 
76 /* chanprog.c */
77 void tell_verbose_uptime(int);
78 void tell_verbose_status(int);
79 void tell_settings(int);
80 int logmodes(char *);
81 int isowner(char *);
82 int isadmin(char *);
83 int isadder(char *);
84 char *masktype(int);
85 char *maskname(int);
86 void reaffirm_owners();
87 void rehash();
88 void reload();
89 void chanprog();
90 void check_timers();
91 void check_utimers();
92 void rmspace(char *s);
93 void check_timers();
94 void set_chanlist(const char *host, struct userrec *rec);
95 void clear_chanlist(void);
96 void clear_chanlist_member(const char *nick);
97 
98 /* cmds.c */
99 int check_dcc_attrs(struct userrec *, int);
100 int check_dcc_chanattrs(struct userrec *, char *, int, int);
101 int stripmodes(char *);
102 char *stripmasktype(int);
103 
104 /* dcc.c */
105 void failed_link(int);
106 void strip_mirc_codes(int, char *);
107 int check_ansi(char *);
108 void dupwait_notify(char *);
109 
110 /* dccutil.c */
111 void dprintf EVANGELINE_VARARGS(int, arg1);
112 void chatout EVANGELINE_VARARGS(char *, arg1);
113 extern void (*shareout) ();
114 extern void (*sharein) (int, char *);
115 void chanout_but EVANGELINE_VARARGS(int, arg1);
116 void dcc_chatter(int);
117 void lostdcc(int);
118 void killtransfer(int);
119 void removedcc(int);
120 void makepass(char *);
121 void tell_dcc(int);
122 void not_away(int);
123 void set_away(int, char *);
124 void *_get_data_ptr(int, char *, int);
125 void dcc_remove_lost(void);
126 
127 #define get_data_ptr(x) _get_data_ptr(x,__FILE__,__LINE__)
128 void flush_lines(int, struct chat_info *);
129 struct dcc_t *find_idx(int);
130 int new_dcc(struct dcc_table *, int);
131 void del_dcc(int);
132 char *add_cr(char *);
133 void changeover_dcc(int, struct dcc_table *, int);
134 
135 /* dns.c */
136 extern void (*dns_hostbyip) (IP);
137 extern void (*dns_ipbyhost) (char *);
138 void block_dns_hostbyip(IP);
139 void block_dns_ipbyhost(char *);
140 void call_hostbyip(IP, char *, int);
141 void call_ipbyhost(char *, IP, int);
142 void dcc_dnshostbyip(IP);
143 void dcc_dnsipbyhost(char *);
144 
145 /* gotdcc.c */
146 void gotdcc(char *, char *, struct userrec *, char *);
147 void do_boot(int, char *, char *);
148 int detect_dcc_flood(time_t *, struct chat_info *, int);
149 
150 /* language.c */
151 char *get_language(int);
152 int cmd_loadlanguage(struct userrec *, int, char *);
153 void add_lang_section(char *);
154 int del_lang_section(char *);
155 int exist_lang_section(char *);
156 
157 /* main.c */
158 void fatal(const char *, int);
159 int expected_memory(void);
160 void patch(const char *);
161 void EvangelineContext(const char *, int, const char *);
162 void EvangelineContextNote(const char *, int, const char *, const char *);
163 void EvangelineAssert(const char *, int, const char *);
164 void backup_userfile(void);
165 
166 /* match.c */
167 int _wild_match(register unsigned char *, register unsigned char *);
168 int _wild_match_per(register unsigned char *, register unsigned char *);
169 int ip_match(register unsigned char *, register unsigned char *);
170 
171 #define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
172 #define wild_match_per(a,b) _wild_match_per((unsigned char *)(a),(unsigned char *)(b))
173 
174 /* mem.c */
175 void *n_malloc(int, const char *, int);
176 void *n_realloc(void *, int, const char *, int);
177 void n_free(void *, const char *, int);
178 void tell_mem_status(char *);
179 void tell_mem_status_dcc(int);
180 void debug_mem_to_dcc(int);
181 
182 /* misc.c */
183 int EvangelineStrcatn(char *dst, const char *src, size_t max);
184 int my_strcpy(char *, char *);
185 void putlog EVANGELINE_VARARGS(int, arg1);
186 void flushlogs();
187 void check_logsize();
188 int copyfile(char *, char *);
189 int movefile(char *, char *);
190 int file_readable(char *);
191 char *stristr(char *, char *);
192 void splitc(char *, char *, char);
193 void splitcn(char *, char *, char, size_t);
194 void remove_crlf(char **);
195 char *newsplit(char **);
196 char *splitnick(char **);
197 void stridx(char *, char *, int);
198 void dumplots(int, const char *, char *);
199 void daysago(time_t, time_t, char *);
200 void days(time_t, time_t, char *);
201 void daysdur(time_t, time_t, char *);
202 void help_subst(char *, char *, struct flag_record *, int, char *);
203 void sub_lang(int, char *);
204 void show_motd(int);
205 void tellhelp(int, char *, struct flag_record *, int);
206 void tellwildhelp(int, char *, struct flag_record *);
207 void tellallhelp(int, char *, struct flag_record *);
208 void showhelp(char *, char *, struct flag_record *, int);
209 void rem_help_reference(char *file);
210 void add_help_reference(char *file);
211 void debug_help(int);
212 void reload_help_data(void);
213 char *extracthostname(char *);
214 void show_banner(int i);
215 void make_rand_str(char *, int);
216 int oatoi(const char *);
217 int is_file(const char *);
218 void logsuffix_change(char *);
219 char *str_escape(const char *, const char, const char);
220 char *strchr_unescape(char *, const char, register const char);
221 void str_unescape(char *, register const char);
222 int str_isdigit(const char *);
223 void kill_bot(char *, char *);
224 
225 void _maskhost(const char *, char *, int);
226 #define maskhost(a,b) _maskhost((a),(b),1)
227 #define maskban(a,b) _maskhost((a),(b),0)
228 
229 /* net.c */
230 IP my_atoul(char *);
231 unsigned long iptolong(IP);
232 IP getmyip();
233 void neterror(char *);
234 void setsock(int, int, int);
235 int allocsock(int, int, int);
236 int getsock(int, int);
237 int getprotocol(char *);
238 char *hostnamefromip(unsigned long);
239 void killsock(int);
240 int answer(int, char *, unsigned long *, unsigned short *, int);
241 inline int open_listen(int *);
242 inline int open_listen_by_af(int *, int);
243 int open_address_listen(IP addr, int *);
244 int open_telnet(char *, int);
245 int open_telnet_dcc(int, char *, char *);
246 int open_telnet_raw(int, char *, int);
247 void tputs(int, char *, unsigned int);
248 void dequeue_sockets();
249 int sockgets(char *, int *);
250 void tell_netdebug(int);
251 int sanitycheck_dcc(char *, char *, char *, char *);
252 int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
253 char *iptostr(IP);
254 int sock_has_data(int, int);
255 int sockoptions(int sock, int operation, int sock_options);
256 int flush_inbuf(int idx);
257 
258 /* tcl.c */
259 void protect_tcl();
260 void unprotect_tcl();
261 void do_tcl(char *, char *);
262 int readtclprog(char *fname);
263 int readConfigFile(char *);
264 int readModuleConfig(char *);
265 int findidx(int);
266 int findanyidx(int);
267 
268 /* userent.c */
269 void list_type_kill(struct list_type *);
270 int list_type_expmem(struct list_type *);
271 int xtra_set();
272 
273 /* userrec.c */
274 struct userrec *adduser(struct userrec *, char *, char *, char *, int);
275 void addhost_by_handle(char *, char *);
276 void clear_masks(struct maskrec *);
277 void clear_userlist(struct userrec *);
278 int u_pass_match(struct userrec *, char *);
279 int delhost_by_handle(char *, char *);
280 int ishost_for_handle(char *, char *);
281 int count_users(struct userrec *);
282 int deluser(char *);
283 void freeuser(struct userrec *);
284 int change_handle(struct userrec *, char *);
285 void correct_handle(char *);
286 int write_user(struct userrec *, FILE *, int, char *);
287 int write_ignores(FILE *f, int, char *);
288 void write_userfile(int, char *);
289 struct userrec *check_dcclist_hand(char *);
290 void touch_laston(struct userrec *, char *, time_t);
291 void user_del_chan(char *);
292 char *fixfrom(char *);
293 
294 /* users.c */
295 void addignore(char *, char *, char *, time_t);
296 int delignore(char *);
297 void tell_ignores(int, char *);
298 int match_ignore(char *);
299 void check_expired_ignores();
300 void autolink_cycle(char *);
301 void tell_file_stats(int, char *);
302 void tell_user_ident(int, char *, int);
303 void tell_users_match(int, char *, int, int, int, char *);
304 int readuserfile(char *, struct userrec **, char *);
305 
306 /* rfc1459.c */
307 int _rfc_casecmp(const char *, const char *);
308 int _rfc_ncasecmp(const char *, const char *, int);
309 int _rfc_toupper(int);
310 int _rfc_tolower(int);
311 
312 #endif /* _EVANGELINE_PROTO_H */
313