00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _EGG_PROTO_H
00032 #define _EGG_PROTO_H
00033
00034 #include "lush.h"
00035 #include "misc_file.h"
00036
00037 #define dprintf dprintf_eggdrop
00038
00039 struct chanset_t;
00040 struct userrec;
00041 struct maskrec;
00042 struct igrec;
00043 struct flag_record;
00044 struct list_type;
00045 struct tand_t_struct;
00046
00047 #ifndef MAKING_MODS
00048 extern void (*encrypt_pass) (char *, char *);
00049 extern char *(*encrypt_string) (char *, char *);
00050 extern char *(*decrypt_string) (char *, char *);
00051 extern int (*rfc_casecmp) (const char *, const char *);
00052 extern int (*rfc_ncasecmp) (const char *, const char *, int);
00053 extern int (*rfc_toupper) (int);
00054 extern int (*rfc_tolower) (int);
00055 extern int (*match_noterej) (struct userrec *, char *);
00056 #endif
00057
00058
00059 void bot_share(int, char *);
00060 int base64_to_int(char *);
00061
00062
00063 void answer_local_whom(int, int);
00064 char *lastbot(char *);
00065 int nextbot(char *);
00066 int in_chain(char *);
00067 void tell_bots(int);
00068 void tell_bottree(int, int);
00069 int botlink(char *, int, char *);
00070 int botunlink(int, char *, char *, char *);
00071 void dump_links(int);
00072 void addbot(char *, char *, char *, char, int);
00073 void updatebot(int, char *, char, int);
00074 void rembot(char *);
00075 struct tand_t_struct *findbot(char *);
00076 void unvia(int, struct tand_t_struct *);
00077 void check_botnet_pings();
00078 int partysock(char *, char *);
00079 int addparty(char *, char *, int, char, int, char *, int *);
00080 void remparty(char *, int);
00081 void partystat(char *, int, int, int);
00082 int partynick(char *, int, char *);
00083 int partyidle(char *, char *);
00084 void partysetidle(char *, int, int);
00085 void partyaway(char *, int, char *);
00086 void zapfbot(int);
00087 void tandem_relay(int, char *, int);
00088 int getparty(char *, int);
00089
00090
00091 int add_note(char *, char *, char *, int, int);
00092 int simple_sprintf EGG_VARARGS(char *, arg1);
00093 void tandout_but EGG_VARARGS(int, arg1);
00094 char *int_to_base10(int);
00095 char *unsigned_int_to_base10(unsigned int);
00096 char *int_to_base64(unsigned int);
00097
00098
00099 void tell_verbose_uptime(int);
00100 void tell_verbose_status(int);
00101 void tell_settings(int);
00102 int logmodes(char *);
00103 int isowner(char *);
00104 char *masktype(int);
00105 char *maskname(int);
00106 void reaffirm_owners();
00107 void rehash();
00108 void reload();
00109 void chanprog();
00110 void check_timers();
00111 void check_utimers();
00112 void rmspace(char *s);
00113 void check_timers();
00114 void set_chanlist(const char *host, struct userrec *rec);
00115 void clear_chanlist(void);
00116 void clear_chanlist_member(const char *nick);
00117
00118
00119 int check_dcc_attrs(struct userrec *, int);
00120 int check_dcc_chanattrs(struct userrec *, char *, int, int);
00121 int stripmodes(char *);
00122 char *stripmasktype(int);
00123
00124
00125 void failed_link(int);
00126 void strip_mirc_codes(int, char *);
00127 int check_ansi(char *);
00128 void dupwait_notify(char *);
00129
00130
00131 int increase_socks_max();
00132 int findidx(int);
00133 int findanyidx(int);
00134 char *add_cr(char *);
00135 void dprintf EGG_VARARGS(int, arg1);
00136 void chatout EGG_VARARGS(char *, arg1);
00137 extern void (*shareout) ();
00138 extern void (*sharein) (int, char *);
00139 void chanout_but EGG_VARARGS(int, arg1);
00140 void dcc_chatter(int);
00141 void lostdcc(int);
00142 void killtransfer(int);
00143 void removedcc(int);
00144 void makepass(char *);
00145 void tell_dcc(int);
00146 void not_away(int);
00147 void set_away(int, char *);
00148 void *_get_data_ptr(int, char *, int);
00149 void dcc_remove_lost(void);
00150 void do_boot(int, char *, char *);
00151 int detect_dcc_flood(time_t *, struct chat_info *, int);
00152
00153 #define get_data_ptr(x) _get_data_ptr(x,__FILE__,__LINE__)
00154 void flush_lines(int, struct chat_info *);
00155 struct dcc_t *find_idx(int);
00156 int new_dcc(struct dcc_table *, int);
00157 void del_dcc(int);
00158 void changeover_dcc(int, struct dcc_table *, int);
00159
00160
00161 extern void (*dns_hostbyip) (IP);
00162 extern void (*dns_ipbyhost) (char *);
00163 void block_dns_hostbyip(IP);
00164 void block_dns_ipbyhost(char *);
00165 void call_hostbyip(IP, char *, int);
00166 void call_ipbyhost(char *, IP, int);
00167 void dcc_dnshostbyip(IP);
00168 void dcc_dnsipbyhost(char *);
00169
00170
00171 char *get_language(int);
00172 int cmd_loadlanguage(struct userrec *, int, char *);
00173 void add_lang_section(char *);
00174 int del_lang_section(char *);
00175 int exist_lang_section(char *);
00176
00177
00178 void fatal(const char *, int);
00179 int expected_memory(void);
00180 void eggContext(const char *, int, const char *);
00181 void eggContextNote(const char *, int, const char *, const char *);
00182 void eggAssert(const char *, int, const char *);
00183 void backup_userfile(void);
00184 int mainloop(int);
00185
00186
00187 int casecharcmp(unsigned char, unsigned char);
00188 int charcmp(unsigned char, unsigned char);
00189 int _wild_match(register unsigned char *, register unsigned char *);
00190 int _wild_match_per(register unsigned char *, register unsigned char *,
00191 int (*)(unsigned char, unsigned char),
00192 int (*)(unsigned char, unsigned char),
00193 unsigned char *);
00194 int addr_match(char *, char *, int, int);
00195 int mask_match(char *, char *);
00196 int cidr_match(char *, char *, int);
00197 int cron_match(const char *, const char *);
00198
00199 #define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
00200 #define wild_match_per(a,b) _wild_match_per((unsigned char *)(a), \
00201 (unsigned char *)(b),casecharcmp,NULL,NULL)
00202 #define wild_match_partial_case(a,b) _wild_match_per((unsigned char *)(a), \
00203 (unsigned char *)(b),casecharcmp,charcmp, \
00204 (unsigned char *)strchr((b),' '))
00205 #define match_addr(a,b) addr_match((char *)(a),(char *)(b),0,0)
00206 #define match_useraddr(a,b) addr_match((char *)(a),(char *)(b),1,0)
00207 #define cmp_masks(a,b) addr_match((char *)(a),(char *)(b),0,1)
00208 #define cmp_usermasks(a,b) addr_match((char *)(a),(char *)(b),1,1)
00209
00210
00211 char *n_strdup(const char *, const char *, int);
00212 void *n_malloc(int, const char *, int);
00213 void *n_realloc(void *, int, const char *, int);
00214 void n_free(void *, const char *, int);
00215 void tell_mem_status(char *);
00216 void tell_mem_status_dcc(int);
00217 void debug_mem_to_dcc(int);
00218
00219
00220 int egg_strcatn(char *, const char *, size_t);
00221 int my_strcpy(char *, char *);
00222 void putlog EGG_VARARGS(int, arg1);
00223 void flushlogs();
00224 void check_logsize();
00225 void splitc(char *, char *, char);
00226 void splitcn(char *, char *, char, size_t);
00227 void remove_crlf(char **);
00228 char *newsplit(char **);
00229 char *splitnick(char **);
00230 void stridx(char *, char *, int);
00231 void dumplots(int, const char *, const char *);
00232 void daysago(time_t, time_t, char *);
00233 void days(time_t, time_t, char *);
00234 void daysdur(time_t, time_t, char *);
00235 void help_subst(char *, char *, struct flag_record *, int, char *);
00236 void sub_lang(int, char *);
00237 void show_motd(int);
00238 void tellhelp(int, char *, struct flag_record *, int);
00239 void tellwildhelp(int, char *, struct flag_record *);
00240 void tellallhelp(int, char *, struct flag_record *);
00241 void showhelp(char *, char *, struct flag_record *, int);
00242 void rem_help_reference(char *);
00243 void add_help_reference(char *);
00244 void debug_help(int);
00245 void reload_help_data(void);
00246 char *extracthostname(char *);
00247 void show_banner(int i);
00248 void make_rand_str(char *, int);
00249 int oatoi(const char *);
00250 int is_file(const char *);
00251 void logsuffix_change(char *);
00252 char *str_escape(const char *, const char, const char);
00253 char *strchr_unescape(char *, const char, register const char);
00254 void str_unescape(char *, register const char);
00255 int str_isdigit(const char *);
00256 void kill_bot(char *, char *);
00257
00258 void maskaddr(const char *, char *, int);
00259 #define maskhost(a,b) maskaddr((a),(b),3)
00260 #define maskban(a,b) maskaddr((a),(b),3)
00261
00262
00263 IP my_atoul(char *);
00264 unsigned long iptolong(IP);
00265 IP getmyip();
00266 void neterror(char *);
00267 void setsock(int, int);
00268 int allocsock(int, int);
00269 int alloctclsock(int, int, Tcl_FileProc *, ClientData);
00270 int getsock(int);
00271 void killsock(int);
00272 void killtclsock(int);
00273 int answer(int, char *, unsigned long *, unsigned short *, int);
00274 inline int open_listen(int *);
00275 int open_address_listen(IP addr, int *);
00276 int open_telnet(char *, int);
00277 int open_telnet_dcc(int, char *, char *);
00278 int open_telnet_raw(int, char *, int);
00279 void tputs(int, char *, unsigned int);
00280 void dequeue_sockets();
00281 int preparefdset(fd_set *, sock_list *, int, int, int);
00282 int sockread(char *, int *, sock_list *, int, int);
00283 int sockgets(char *, int *);
00284 void tell_netdebug(int);
00285 int sanitycheck_dcc(char *, char *, char *, char *);
00286 int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
00287 char *iptostr(IP);
00288 int sock_has_data(int, int);
00289 int sockoptions(int sock, int operation, int sock_options);
00290 int flush_inbuf(int idx);
00291
00292
00293 struct threaddata *threaddata();
00294 int init_threaddata(int);
00295 void protect_tcl();
00296 void unprotect_tcl();
00297 void do_tcl(char *, char *);
00298 int readtclprog(char *fname);
00299
00300
00301 void list_type_kill(struct list_type *);
00302 int list_type_expmem(struct list_type *);
00303 int xtra_set();
00304
00305
00306 struct userrec *adduser(struct userrec *, char *, char *, char *, int);
00307 void addhost_by_handle(char *, char *);
00308 void clear_masks(struct maskrec *);
00309 void clear_userlist(struct userrec *);
00310 int u_pass_match(struct userrec *, char *);
00311 int delhost_by_handle(char *, char *);
00312 int ishost_for_handle(char *, char *);
00313 int count_users(struct userrec *);
00314 int deluser(char *);
00315 void freeuser(struct userrec *);
00316 int change_handle(struct userrec *, char *);
00317 void correct_handle(char *);
00318 int write_user(struct userrec *, FILE *, int);
00319 int write_ignores(FILE *f, int);
00320 void write_userfile(int);
00321 struct userrec *check_dcclist_hand(char *);
00322 void touch_laston(struct userrec *, char *, time_t);
00323 void user_del_chan(char *);
00324 char *fixfrom(char *);
00325 int check_conflags(struct flag_record *fr, int md);
00326
00327
00328 void addignore(char *, char *, char *, time_t);
00329 int delignore(char *);
00330 void tell_ignores(int, char *);
00331 int match_ignore(char *);
00332 void check_expired_ignores();
00333 void autolink_cycle(char *);
00334 void tell_file_stats(int, char *);
00335 void tell_user_ident(int, char *, int);
00336 void tell_users_match(int, char *, int, int, int, char *);
00337 int readuserfile(char *, struct userrec **);
00338
00339
00340 int _rfc_casecmp(const char *, const char *);
00341 int _rfc_ncasecmp(const char *, const char *, int);
00342 int _rfc_toupper(int);
00343 int _rfc_tolower(int);
00344
00345 #endif