proto.h 11 KB

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