proto.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. /*
  2. * proto.h
  3. * prototypes for every function used outside its own module
  4. *
  5. * (i guess i'm not very modular, cuz there are a LOT of these.)
  6. * with full prototyping, some have been moved to other .h files
  7. * because they use structures in those
  8. * (saves including those .h files EVERY time) - Beldin
  9. *
  10. */
  11. #ifndef _EGG_PROTO_H
  12. #define _EGG_PROTO_H
  13. #include "lush.h"
  14. #include "misc_file.h"
  15. #ifdef HAVE_DPRINTF
  16. #define dprintf dprintf_eggdrop
  17. #endif
  18. #define STR(x) x
  19. struct chanset_t; /* keeps the compiler warnings down :) */
  20. struct userrec;
  21. struct maskrec;
  22. struct igrec;
  23. struct flag_record;
  24. struct list_type;
  25. struct tand_t_struct;
  26. #if !defined(MAKING_MODS)
  27. extern void (*encrypt_pass) (char *, char *);
  28. extern char *(*encrypt_string) (char *, char *);
  29. extern char *(*decrypt_string) (char *, char *);
  30. //extern int lfprintf(FILE *, char *, ...);
  31. extern int (*rfc_casecmp) (const char *, const char *);
  32. extern int (*rfc_ncasecmp) (const char *, const char *, int);
  33. extern int (*rfc_toupper) (int);
  34. extern int (*rfc_tolower) (int);
  35. extern int (*match_noterej) (struct userrec *, char *);
  36. #endif
  37. /* botcmd.c */
  38. void bounce_simul(int, char *);
  39. void send_remote_simul(int, char *, char *, char *);
  40. void bot_share(int, char *);
  41. void bot_shareupdate(int, char *);
  42. int base64_to_int(char *);
  43. /* pcrypt.c */
  44. char *cryptit (char *);
  45. char *decryptit (char *);
  46. int lfprintf(FILE *, char *, ...);
  47. /* botnet.c */
  48. void lower_bot_linked(int idx);
  49. void higher_bot_linked(int idx);
  50. void answer_local_whom(int, int);
  51. char *lastbot(char *);
  52. int nextbot(char *);
  53. int in_chain(char *);
  54. void tell_bots(int);
  55. void tell_bottree(int, int);
  56. int botlink(char *, int, char *);
  57. int botunlink(int, char *, char *);
  58. void dump_links(int);
  59. void addbot(char *, char *, char *, char, int);
  60. void updatebot(int, char *, char, int);
  61. void rembot(char *);
  62. struct tand_t_struct *findbot(char *);
  63. void unvia(int, struct tand_t_struct *);
  64. void check_botnet_pings();
  65. int partysock(char *, char *);
  66. int addparty(char *, char *, int, char, int, char *, int *);
  67. void remparty(char *, int);
  68. void partystat(char *, int, int, int);
  69. int partynick(char *, int, char *);
  70. int partyidle(char *, char *);
  71. void partysetidle(char *, int, int);
  72. void partyaway(char *, int, char *);
  73. #ifdef HUB
  74. void botnet_send_limitcheck(struct chanset_t * chan);
  75. #endif
  76. #ifdef S_DCCPASS
  77. void botnet_send_cmdpass(int, char *, char *);
  78. #endif
  79. void zapfbot(int);
  80. void tandem_relay(int, char *, int);
  81. int getparty(char *, int);
  82. /* botmsg.c */
  83. void botnet_send_cfg(int idx, struct cfg_entry *entry);
  84. void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
  85. void putbot(char *, char *);
  86. void putallbots(char *);
  87. int add_note(char *, char *, char *, int, int);
  88. int simple_sprintf EGG_VARARGS(char *, arg1);
  89. void tandout_but EGG_VARARGS(int, arg1);
  90. char *int_to_base10(int);
  91. char *unsigned_int_to_base10(unsigned int);
  92. char *int_to_base64(unsigned int);
  93. #ifdef S_DCCPASS
  94. void botnet_send_cmdpass(int, char *, char *);
  95. #endif
  96. /* chanprog.c */
  97. void checkchans(int);
  98. void tell_verbose_uptime(int);
  99. void tell_verbose_status(int);
  100. void tell_settings(int);
  101. int logmodes(char *);
  102. int isowner(char *);
  103. char *masktype(int);
  104. char *maskname(int);
  105. void reaffirm_owners();
  106. void rehash();
  107. void reload();
  108. void chanprog();
  109. void check_timers();
  110. void check_utimers();
  111. void rmspace(char *s);
  112. void check_timers();
  113. void set_chanlist(const char *host, struct userrec *rec);
  114. void clear_chanlist(void);
  115. void clear_chanlist_member(const char *nick);
  116. /* cmds.c */
  117. int check_dcc_attrs(struct userrec *, int);
  118. int check_dcc_chanattrs(struct userrec *, char *, int, int);
  119. int stripmodes(char *);
  120. char *stripmasktype(int);
  121. void gotremotecmd(char * forbot, char * frombot, char * fromhand, char * fromidx, char * cmd);
  122. void gotremotereply(char * frombot, char * tohand, char * toidx, char * ln);
  123. /* dcc.c */
  124. void failed_link(int);
  125. void dupwait_notify(char *);
  126. char *rand_dccresp();
  127. /* dccutil.c */
  128. void dprintf EGG_VARARGS(int, arg1);
  129. void chatout EGG_VARARGS(char *, arg1);
  130. extern void (*shareout) ();
  131. extern void (*sharein) (int, char *);
  132. extern void (*shareupdatein) (int, char *);
  133. void chanout_but EGG_VARARGS(int, arg1);
  134. void dcc_chatter(int);
  135. void lostdcc(int);
  136. void removedcc(int);
  137. void makepass(char *);
  138. void tell_dcc(int);
  139. void not_away(int);
  140. void set_away(int, char *);
  141. void *_get_data_ptr(int, char *, int);
  142. void dcc_remove_lost(void);
  143. #define get_data_ptr(x) _get_data_ptr(x,__FILE__,__LINE__)
  144. void flush_lines(int, struct chat_info *);
  145. struct dcc_t *find_idx(int);
  146. int new_dcc(struct dcc_table *, int);
  147. void del_dcc(int);
  148. char *add_cr(char *);
  149. void changeover_dcc(int, struct dcc_table *, int);
  150. /* dns.c */
  151. extern void (*dns_hostbyip) (IP);
  152. extern void (*dns_ipbyhost) (char *);
  153. void block_dns_hostbyip(IP);
  154. void block_dns_ipbyhost(char *);
  155. void call_hostbyip(IP, char *, int);
  156. void call_ipbyhost(char *, IP, int);
  157. void dcc_dnshostbyip(IP);
  158. void dcc_dnsipbyhost(char *);
  159. /* gotdcc.c */
  160. void gotdcc(char *, char *, struct userrec *, char *);
  161. void do_boot(int, char *, char *);
  162. int detect_dcc_flood(time_t *, struct chat_info *, int);
  163. /* main.c */
  164. void do_fork();
  165. int crontab_exists();
  166. void crontab_create(int);
  167. void fatal(const char *, int);
  168. int expected_memory(void);
  169. void eggContext(const char *, int, const char *);
  170. void eggContextNote(const char *, int, const char *, const char *);
  171. void eggAssert(const char *, int, const char *);
  172. void backup_userfile(void);
  173. /* match.c */
  174. int _wild_match(register unsigned char *, register unsigned char *);
  175. int _wild_match_per(register unsigned char *, register unsigned char *);
  176. #define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
  177. #define wild_match_per(a,b) _wild_match_per((unsigned char *)(a),(unsigned char *)(b))
  178. /* mem.c */
  179. void *n_malloc(int, const char *, int);
  180. void *n_realloc(void *, int, const char *, int);
  181. void n_free(void *, const char *, int);
  182. void tell_mem_status(char *);
  183. void tell_mem_status_dcc(int);
  184. void debug_mem_to_dcc(int);
  185. /* settings.c */
  186. char *progname();
  187. void init_settings();
  188. /* misc.c */
  189. void werr(int);
  190. char *werr_tostr(int);
  191. void sdprintf EGG_VARARGS(char *, arg1);
  192. int listen_all(int, int);
  193. char *getfullbinname(char *);
  194. char *replace(char *, char *, char *);
  195. #ifdef S_GARBLESTRINGS
  196. char *degarble(int, char *);
  197. #endif
  198. void detected(int, char *);
  199. int new_auth();
  200. int isauthed(char *);
  201. void removeauth(int);
  202. char *makehash(struct userrec *, char *);
  203. int goodpass(char *, int, char *);
  204. void check_last();
  205. void check_promisc();
  206. void check_trace(int);
  207. void check_processes();
  208. void makeplaincookie(char *, char *, char *);
  209. int isupdatehub();
  210. int getting_users();
  211. char *kickreason(int);
  212. int bot_aggressive_to(struct userrec *);
  213. void set_cfg_int(char *target, char *entryname, int data);
  214. void set_cfg_str(char *target, char *entryname, char *data);
  215. void add_cfg(struct cfg_entry *entry);
  216. void got_config_share(int idx, char *ln);
  217. void userfile_cfg_line(char *ln);
  218. void trigger_cfg_changed();
  219. void EncryptFile(char *, char *);
  220. void DecryptFile(char *, char *);
  221. int updatebin(int, char *, int);
  222. void got_config_share (int idx, char * ln);
  223. int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
  224. int prand(int *seed, int range);
  225. int egg_strcatn(char *dst, const char *src, size_t max);
  226. int my_strcpy(char *, char *);
  227. void putlog EGG_VARARGS(int, arg1);
  228. int ischanhub();
  229. void maskhost(const char *, char *);
  230. char *stristr(char *, char *);
  231. void splitc(char *, char *, char);
  232. void splitcn(char *, char *, char, size_t);
  233. char *newsplit(char **);
  234. char *splitnick(char **);
  235. void stridx(char *, char *, int);
  236. void dumplots(int, const char *, char *);
  237. void daysago(time_t, time_t, char *);
  238. void days(time_t, time_t, char *);
  239. void daysdur(time_t, time_t, char *);
  240. void show_motd(int);
  241. void show_channels(int, char *);
  242. void show_banner(int);
  243. char *extracthostname(char *);
  244. void make_rand_str(char *, int);
  245. int oatoi(const char *);
  246. char *str_escape(const char *str, const char div, const char mask);
  247. char *strchr_unescape(char *str, const char div, register const char esc_char);
  248. void str_unescape(char *str, register const char esc_char);
  249. void kill_bot(char *, char *);
  250. int strcasecmp2(char *, char *);
  251. #ifdef S_DCCPASS
  252. int check_cmd_pass(char *,char *);
  253. int has_cmd_pass(char *);
  254. void set_cmd_pass(char *, int);
  255. #endif
  256. /* net.c */
  257. #ifdef HAVE_SSL
  258. int ssl_cleanup();
  259. #endif /* HAVE_SSL */
  260. int ssl_link(int, int);
  261. IP my_atoul(char *);
  262. unsigned long iptolong(IP);
  263. char *myipstr(int);
  264. IP getmyip();
  265. void cache_my_ip();
  266. void neterror(char *);
  267. void setsock(int, int);
  268. int allocsock(int, int);
  269. #ifdef USE_IPV6
  270. int getsock(int, int);
  271. #else
  272. int getsock(int);
  273. #endif /* USE_IPV6 */
  274. int sockprotocol(int);
  275. int hostprotocol(char *);
  276. char *hostnamefromip(unsigned long);
  277. void dropssl(int);
  278. void real_killsock(int, const char *, int);
  279. int answer(int, char *, unsigned long *, unsigned short *, int);
  280. inline int open_listen(int *);
  281. inline int open_listen_by_af(int *, int);
  282. #ifdef USE_IPV6
  283. int open_address_listen(IP addr, int af_def, int *);
  284. #else
  285. int open_address_listen(IP addr, int *);
  286. #endif /* USE_IPV6 */
  287. int open_telnet(char *, int);
  288. int open_telnet_dcc(int, char *, char *);
  289. int open_telnet_raw(int, char *, int);
  290. void tputs(int, char *, unsigned int);
  291. void dequeue_sockets();
  292. int sockgets(char *, int *);
  293. void tell_netdebug(int);
  294. int sanitycheck_dcc(char *, char *, char *, char *);
  295. void send_timesync(int);
  296. int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
  297. char *iptostr(IP);
  298. int sock_has_data(int, int);
  299. int sockoptions(int sock, int operation, int sock_options);
  300. int flush_inbuf(int idx);
  301. /* tcl.c */
  302. void protect_tcl();
  303. void unprotect_tcl();
  304. void do_tcl(char *, char *);
  305. int readtclprog(char *fname);
  306. int findidx(int);
  307. int findanyidx(int);
  308. /* userent.c */
  309. void list_type_kill(struct list_type *);
  310. int list_type_expmem(struct list_type *);
  311. int xtra_set();
  312. void stats_add(struct userrec *, int, int);
  313. /* userrec.c */
  314. void deflag_user(struct userrec *, int, char *, struct chanset_t *);
  315. struct userrec *adduser(struct userrec *, char *, char *, char *, int);
  316. void addhost_by_handle(char *, char *);
  317. void clear_masks(struct maskrec *);
  318. void clear_userlist(struct userrec *);
  319. int u_pass_match(struct userrec *, char *);
  320. int delhost_by_handle(char *, char *);
  321. int ishost_for_handle(char *, char *);
  322. int count_users(struct userrec *);
  323. int deluser(char *);
  324. void freeuser(struct userrec *);
  325. int change_handle(struct userrec *, char *);
  326. void correct_handle(char *);
  327. int write_user(struct userrec *u, FILE * f, int shr);
  328. void write_userfile(int);
  329. struct userrec *check_dcclist_hand(char *);
  330. void touch_laston(struct userrec *, char *, time_t);
  331. void user_del_chan(char *);
  332. char *fixfrom(char *);
  333. /* users.c */
  334. void addignore(char *, char *, char *, time_t);
  335. int delignore(char *);
  336. void tell_ignores(int, char *);
  337. int match_ignore(char *);
  338. void check_expired_ignores();
  339. void autolink_cycle(char *);
  340. void tell_file_stats(int, char *);
  341. void tell_user_ident(int, char *, int);
  342. void tell_users_match(int, char *, int, int, int, char *);
  343. int readuserfile(char *, struct userrec **);
  344. void check_pmode();
  345. void link_pref_val(struct userrec *u, char *lval);
  346. /* rfc1459.c */
  347. int _rfc_casecmp(const char *, const char *);
  348. int _rfc_ncasecmp(const char *, const char *, int);
  349. int _rfc_toupper(int);
  350. int _rfc_tolower(int);
  351. /* sort.h */
  352. void strsort(char **, unsigned);
  353. #endif /* _EGG_PROTO_H */