proto.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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 int (*rfc_casecmp) (const char *, const char *);
  28. extern int (*rfc_ncasecmp) (const char *, const char *, int);
  29. extern int (*rfc_toupper) (int);
  30. extern int (*rfc_tolower) (int);
  31. extern int (*storenote)(char *from, char *to, char *msg, int idx, char *who, int bufsize);
  32. #endif /* !MAKING_MODS */
  33. /* bg.c */
  34. void do_fork();
  35. void bg_do_split();
  36. /* botcmd.c */
  37. void bounce_simul(int, char *);
  38. void send_remote_simul(int, char *, char *, char *);
  39. void bot_share(int, char *);
  40. void bot_shareupdate(int, char *);
  41. int base64_to_int(char *);
  42. /* botnet.c */
  43. void lower_bot_linked(int idx);
  44. void higher_bot_linked(int idx);
  45. void answer_local_whom(int, int);
  46. char *lastbot(char *);
  47. int nextbot(char *);
  48. int in_chain(char *);
  49. void tell_bots(int);
  50. void tell_bottree(int, int);
  51. int botlink(char *, int, char *);
  52. int botunlink(int, char *, char *);
  53. void dump_links(int);
  54. void addbot(char *, char *, char *, char, int);
  55. void updatebot(int, char *, char, int);
  56. void rembot(char *);
  57. struct tand_t_struct *findbot(char *);
  58. void unvia(int, struct tand_t_struct *);
  59. void check_botnet_pings();
  60. int partysock(char *, char *);
  61. int addparty(char *, char *, int, char, int, char *, int *);
  62. void remparty(char *, int);
  63. void partystat(char *, int, int, int);
  64. int partynick(char *, int, char *);
  65. int partyidle(char *, char *);
  66. void partysetidle(char *, int, int);
  67. void partyaway(char *, int, char *);
  68. #ifdef S_DCCPASS
  69. void botnet_send_cmdpass(int, char *, char *);
  70. #endif /* S_DCCPASS */
  71. void zapfbot(int);
  72. void tandem_relay(int, char *, int);
  73. int getparty(char *, int);
  74. /* botmsg.c */
  75. void botnet_send_cfg(int idx, struct cfg_entry *entry);
  76. void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
  77. void putbot(char *, char *);
  78. void putallbots(char *);
  79. int add_note(char *, char *, char *, int, int);
  80. int simple_sprintf EGG_VARARGS(char *, arg1);
  81. void tandout_but EGG_VARARGS(int, arg1);
  82. char *int_to_base10(int);
  83. char *unsigned_int_to_base10(unsigned int);
  84. char *int_to_base64(unsigned int);
  85. /* chanprog.c */
  86. void do_chanset(struct chanset_t *, char *, int);
  87. void checkchans(int);
  88. void tell_verbose_uptime(int);
  89. void tell_verbose_status(int);
  90. void tell_settings(int);
  91. int logmodes(char *);
  92. int isowner(char *);
  93. char *masktype(int);
  94. char *maskname(int);
  95. void reaffirm_owners();
  96. void rehash();
  97. void reload();
  98. void chanprog();
  99. void check_timers();
  100. void check_utimers();
  101. void rmspace(char *s);
  102. void set_chanlist(const char *host, struct userrec *rec);
  103. void clear_chanlist(void);
  104. void clear_chanlist_member(const char *nick);
  105. int shouldjoin(struct chanset_t *);
  106. /* cmds.c */
  107. int check_dcc_attrs(struct userrec *, int);
  108. int check_dcc_chanattrs(struct userrec *, char *, int, int);
  109. int stripmodes(char *);
  110. char *stripmasktype(int);
  111. void gotremotecmd(char * forbot, char * frombot, char * fromhand, char * fromidx, char * cmd);
  112. void gotremotereply(char * frombot, char * tohand, char * toidx, char * ln);
  113. /* crypt.c */
  114. char *md5(const char *);
  115. char *encrypt_string(const char *, char *);
  116. char *decrypt_string(const char *, char *);
  117. void encrypt_pass(char *, char *);
  118. char *cryptit (char *);
  119. char *decryptit (char *);
  120. int lfprintf EGG_VARARGS(FILE *, arg1);
  121. void EncryptFile(char *, char *);
  122. void DecryptFile(char *, char *);
  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 makepass(char *);
  137. void tell_dcc(int);
  138. void not_away(int);
  139. void set_away(int, char *);
  140. void dcc_remove_lost(void);
  141. void flush_lines(int, struct chat_info *);
  142. struct dcc_t *find_idx(int);
  143. int new_dcc(struct dcc_table *, int);
  144. void del_dcc(int);
  145. char *add_cr(char *);
  146. void changeover_dcc(int, struct dcc_table *, int);
  147. /* dns.c */
  148. extern void (*dns_hostbyip) (IP);
  149. extern void (*dns_ipbyhost) (char *);
  150. void block_dns_hostbyip(IP);
  151. void block_dns_ipbyhost(char *);
  152. void call_hostbyip(IP, char *, int);
  153. void call_ipbyhost(char *, IP, int);
  154. void dcc_dnshostbyip(IP);
  155. void dcc_dnsipbyhost(char *);
  156. /* debug.c */
  157. void sdprintf EGG_VARARGS(char *, arg1);
  158. void init_signals();
  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. void eggContext(const char *, int, const char *);
  169. void eggContextNote(const char *, int, const char *, const char *);
  170. void eggAssert(const char *, int, const char *);
  171. /* match.c */
  172. int _wild_match(register unsigned char *, register unsigned char *);
  173. int _wild_match_per(register unsigned char *, register unsigned char *);
  174. #define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
  175. #define wild_match_per(a,b) _wild_match_per((unsigned char *)(a),(unsigned char *)(b))
  176. /* mem.c */
  177. void *my_malloc(int);
  178. void *my_realloc(void *, int);
  179. void my_free(void *);
  180. #ifdef S_GARBLESTRINGS
  181. char *degarble(int, char *);
  182. #endif /* S_GARBLESTRINGS */
  183. /* settings.c */
  184. char *progname();
  185. /* auth.c */
  186. int new_auth();
  187. int findauth(char *);
  188. void removeauth(int);
  189. char *makehash(struct userrec *, char *);
  190. /* config.c */
  191. void set_cfg_str(char *target, char *entryname, char *data);
  192. void add_cfg(struct cfg_entry *);
  193. void got_config_share(int idx, char * ln);
  194. void userfile_cfg_line(char *ln);
  195. void trigger_cfg_changed();
  196. #ifdef S_DCCPASS
  197. int check_cmd_pass(char *,char *);
  198. int has_cmd_pass(char *);
  199. void set_cmd_pass(char *, int);
  200. #endif /* S_DCCPASS */
  201. /* misc.c */
  202. char *homedir();
  203. char *my_uname();
  204. char *confdir();
  205. void baduname(char *, char *);
  206. int email(char *, char *, int);
  207. char *color(int, int, int);
  208. void shuffle(char *, char *);
  209. void showhelp(int, struct flag_record *, char *);
  210. char *btoh(const unsigned char *, int);
  211. void local_check_should_lock();
  212. void werr(int);
  213. char *werr_tostr(int);
  214. int listen_all(int, int);
  215. char *getfullbinname(char *);
  216. char *replace(char *, char *, char *);
  217. void detected(int, char *);
  218. int goodpass(char *, int, char *);
  219. void check_last();
  220. void check_promisc();
  221. void check_trace();
  222. void check_processes();
  223. void makeplaincookie(char *, char *, char *);
  224. int isupdatehub();
  225. int getting_users();
  226. char *kickreason(int);
  227. int bot_aggressive_to(struct userrec *);
  228. int updatebin(int, char *, int);
  229. int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
  230. int egg_strcatn(char *dst, const char *src, size_t max);
  231. int my_strcpy(char *, char *);
  232. void putlog EGG_VARARGS(int, arg1);
  233. int ischanhub();
  234. int dovoice(struct chanset_t *);
  235. int dolimit(struct chanset_t *);
  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. void remove_crlf(char **);
  241. char *newsplit(char **);
  242. char *splitnick(char **);
  243. void stridx(char *, char *, int);
  244. void dumplots(int, const char *, char *);
  245. void daysago(time_t, time_t, char *);
  246. void days(time_t, time_t, char *);
  247. void daysdur(time_t, time_t, char *);
  248. void show_motd(int);
  249. void show_channels(int, char *);
  250. void show_banner(int);
  251. char *extracthostname(char *);
  252. void make_rand_str(char *, int);
  253. int oatoi(const char *);
  254. char *str_escape(const char *, const char, const char);
  255. char *strchr_unescape(char *, const char, register const char);
  256. void str_unescape(char *, register const char);
  257. int str_isdigit(const char *);
  258. void kill_bot(char *, char *);
  259. int private(struct flag_record, struct chanset_t *, int);
  260. int chk_op(struct flag_record, struct chanset_t *);
  261. int chk_deop(struct flag_record, struct chanset_t *);
  262. int chk_voice(struct flag_record, struct chanset_t *);
  263. int chk_devoice(struct flag_record, struct chanset_t *);
  264. /* net.c */
  265. #ifdef HAVE_SSL
  266. int ssl_cleanup();
  267. #endif /* HAVE_SSL */
  268. int ssl_link(int, int);
  269. IP my_atoul(char *);
  270. unsigned long iptolong(IP);
  271. char *myipstr(int);
  272. IP getmyip();
  273. void cache_my_ip();
  274. void neterror(char *);
  275. void setsock(int, int);
  276. int allocsock(int, int);
  277. #ifdef USE_IPV6
  278. int getsock(int, int);
  279. #else
  280. int getsock(int);
  281. #endif /* USE_IPV6 */
  282. int sockprotocol(int);
  283. int hostprotocol(char *);
  284. char *hostnamefromip(unsigned long);
  285. void dropssl(int);
  286. void real_killsock(int, const char *, int);
  287. int answer(int, char *, unsigned long *, unsigned short *, int);
  288. inline int open_listen(int *);
  289. inline int open_listen_by_af(int *, int);
  290. #ifdef USE_IPV6
  291. int open_address_listen(IP addr, int af_def, int *);
  292. #else
  293. int open_address_listen(IP addr, int *);
  294. #endif /* USE_IPV6 */
  295. int open_telnet(char *, int);
  296. int open_telnet_dcc(int, char *, char *);
  297. int open_telnet_raw(int, char *, int);
  298. void tputs(int, char *, unsigned int);
  299. void dequeue_sockets();
  300. int sockgets(char *, int *);
  301. void tell_netdebug(int);
  302. int sanitycheck_dcc(char *, char *, char *, char *);
  303. void send_timesync(int);
  304. int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
  305. char *iptostr(IP);
  306. int sock_has_data(int, int);
  307. int sockoptions(int sock, int operation, int sock_options);
  308. int flush_inbuf(int idx);
  309. /* tcl.c */
  310. /* userent.c */
  311. void update_mod(char *, char *, char *, char *);
  312. void list_type_kill(struct list_type *);
  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. int 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. int whois_access(struct userrec *, struct userrec *);
  336. #ifdef HUB
  337. void backup_userfile();
  338. #endif /* HUB */
  339. void addignore(char *, char *, char *, time_t);
  340. int delignore(char *);
  341. void tell_ignores(int, char *);
  342. int match_ignore(char *);
  343. void check_expired_ignores();
  344. void autolink_cycle(char *);
  345. void tell_file_stats(int, char *);
  346. void tell_user_ident(int, char *, int);
  347. void tell_users_match(int, char *, int, int, int, char *);
  348. int readuserfile(char *, struct userrec **);
  349. void check_pmode();
  350. void link_pref_val(struct userrec *u, char *lval);
  351. /* rfc1459.c */
  352. int _rfc_casecmp(const char *, const char *);
  353. int _rfc_ncasecmp(const char *, const char *, int);
  354. int _rfc_toupper(int);
  355. int _rfc_tolower(int);
  356. /* sort.h */
  357. void strsort(char **, unsigned);
  358. #endif /* _EGG_PROTO_H */