1
0

proto.h 11 KB

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