proto.h 11 KB

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