module.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. /*
  2. * module.h
  3. *
  4. * $Id: module.h,v 1.25 2000/01/08 22:38:19 per Exp $
  5. */
  6. /*
  7. * Copyright (C) 1997 Robey Pointer
  8. * Copyright (C) 1999, 2000 Eggheads
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. */
  24. #ifndef _EGG_MOD_MODULE_H
  25. #define _EGG_MOD_MODULE_H
  26. /* just include *all* the include files...it's slower but EASIER */
  27. #ifdef HAVE_CONFIG_H
  28. # include "../../config.h"
  29. #endif
  30. #include "../main.h"
  31. #include "modvals.h"
  32. #include "../tandem.h"
  33. /*
  34. * this file contains all the orrible stuff required to do the lookup
  35. * table for symbols, rather than getting the OS to do it, since most OS's
  36. * require all symbols resolved, this can cause a problem with some modules
  37. * this is intimately related to the table in modules.c
  38. * don't change the files unless you have flamable underwear
  39. * do not read this file whilst unless heavily sedated, I will not be held
  40. * responsible for mental break-downs caused by this file <G>
  41. */
  42. #undef nmalloc
  43. #undef nfree
  44. #undef nrealloc
  45. #undef feof
  46. #undef user_malloc
  47. #undef dprintf
  48. #undef get_data_ptr
  49. #undef wild_match
  50. #undef user_realloc
  51. #undef Context
  52. #undef ContextNote
  53. #undef Assert
  54. /* Version checks for modules. */
  55. #define EGG_IS_MIN_VER(ver) ((ver) <= EGG_VERSION)
  56. #define EGG_IS_MAX_VER(ver) ((ver) >= EGG_VERSION)
  57. /* redefine for module-relevance */
  58. /* 0 - 3 */
  59. #define nmalloc(x) ((void *)(global[0]((x),MODULE_NAME,__FILE__,__LINE__)))
  60. #define nfree(x) (global[1]((x),MODULE_NAME,__FILE__,__LINE__))
  61. #ifdef DEBUG_CONTEXT
  62. # define Context (global[2](__FILE__, __LINE__, MODULE_NAME))
  63. #else
  64. # define Context {}
  65. #endif
  66. #define module_rename ((int (*)(char *, char *))global[3])
  67. /* 4 - 7 */
  68. #define module_register ((int (*)(char *, Function *, int, int))global[4])
  69. #define module_find ((module_entry * (*)(char *,int,int))global[5])
  70. #define module_depend ((Function *(*)(char *,char *,int,int))global[6])
  71. #define module_undepend ((int(*)(char *))global[7])
  72. /* 8 - 11 */
  73. #define add_bind_table ((p_tcl_bind_list(*)(char *,int,Function))global[8])
  74. #define del_bind_table ((void (*) (p_tcl_bind_list))global[9])
  75. #define find_bind_table ((p_tcl_bind_list(*)(char *))global[10])
  76. #define check_tcl_bind ((int (*) (p_tcl_bind_list,char *,struct flag_record *,char *, int))global[11])
  77. /* 12 - 15 */
  78. #define add_builtins ((int (*) (p_tcl_bind_list, cmd_t *))global[12])
  79. #define rem_builtins ((int (*) (p_tcl_bind_list, cmd_t *))global[13])
  80. #define add_tcl_commands ((void (*) (tcl_cmds *))global[14])
  81. #define rem_tcl_commands ((void (*) (tcl_cmds *))global[15])
  82. /* 16 - 19 */
  83. #define add_tcl_ints ((void (*) (tcl_ints *))global[16])
  84. #define rem_tcl_ints ((void (*) (tcl_ints *))global[17])
  85. #define add_tcl_strings ((void (*) (tcl_strings *))global[18])
  86. #define rem_tcl_strings ((void (*) (tcl_strings *))global[19])
  87. /* 20 - 23 */
  88. #define base64_to_int ((int (*) (char *))global[20])
  89. #define int_to_base64 ((char * (*) (int))global[21])
  90. #define int_to_base10 ((char * (*) (int))global[22])
  91. #define simple_sprintf ((int (*)())global[23])
  92. /* 24 - 27 */
  93. #define botnet_send_zapf ((void (*)(int, char *, char *, char *))global[24])
  94. #define botnet_send_zapf_broad ((void (*)(int, char *, char *, char *))global[25])
  95. #define botnet_send_unlinked ((void (*)(int, char *, char *))global[26])
  96. #define botnet_send_bye ((void(*)(void))global[27])
  97. /* 28 - 31 */
  98. #define botnet_send_chat ((void(*)(int,char*,char*))global[28])
  99. #define botnet_send_filereject ((void(*)(int,char*,char*,char*))global[29])
  100. #define botnet_send_filesend ((void(*)(int,char*,char*,char*))global[30])
  101. #define botnet_send_filereq ((void(*)(int,char*,char*,char*))global[31])
  102. /* 32 - 35 */
  103. #define botnet_send_join_idx ((void(*)(int,int))global[32])
  104. #define botnet_send_part_idx ((void(*)(int,char *))global[33])
  105. #define updatebot ((void(*)(int,char*,char,int))global[34])
  106. #define nextbot ((int (*)(char *))global[35])
  107. /* 36 - 39 */
  108. #define zapfbot ((void (*)(int))global[36])
  109. #define n_free ((void (*)(void *,char *, int))global[37])
  110. #define u_pass_match ((int (*)(struct userrec *,char *))global[38])
  111. #define user_malloc(x) ((void *(*)(int,char *,int))global[39])(x,__FILE__,__LINE__)
  112. /* 40 - 43 */
  113. #define get_user ((void *(*)(struct user_entry_type *,struct userrec *))global[40])
  114. #define set_user ((int(*)(struct user_entry_type *,struct userrec *,void *))global[41])
  115. #define add_entry_type ((int (*) ( struct user_entry_type * ))global[42])
  116. #define del_entry_type ((int (*) ( struct user_entry_type * ))global[43])
  117. /* 44 - 47 */
  118. #define get_user_flagrec ((void (*)(struct userrec *, struct flag_record *, char *))global[44])
  119. #define set_user_flagrec ((void (*)(struct userrec *, struct flag_record *, char *))global[45])
  120. #define get_user_by_host ((struct userrec * (*)(char *))global[46])
  121. #define get_user_by_handle ((struct userrec *(*)(struct userrec *,char *))global[47])
  122. /* 48 - 51 */
  123. #define find_entry_type ((struct user_entry_type * (*) ( char * ))global[48])
  124. #define find_user_entry ((struct user_entry * (*)( struct user_entry_type *, struct userrec *))global[49])
  125. #define adduser ((struct userrec *(*)(struct userrec *,char*,char*,char*,int))global[50])
  126. #define deluser ((int (*)(char *))global[51])
  127. /* 52 - 55 */
  128. #define addhost_by_handle ((void (*) (char *, char *))global[52])
  129. #define delhost_by_handle ((int(*)(char *,char *))global[53])
  130. #define readuserfile ((int (*)(char *,struct userrec **))global[54])
  131. #define write_userfile ((void(*)(int))global[55])
  132. /* 56 - 59 */
  133. #define geticon ((char (*) (int))global[56])
  134. #define clear_chanlist ((void (*)(void))global[57])
  135. #define reaffirm_owners ((void (*)(void))global[58])
  136. #define change_handle ((int(*)(struct userrec *,char*))global[59])
  137. /* 60 - 63 */
  138. #define write_user ((int (*)(struct userrec *, FILE *,int))global[60])
  139. #define clear_userlist ((void (*)(struct userrec *))global[61])
  140. #define count_users ((int(*)(struct userrec *))global[62])
  141. #define sanity_check ((int(*)(int))global[63])
  142. /* 64 - 67 */
  143. #define break_down_flags ((void (*)(char *,struct flag_record *,struct flag_record *))global[64])
  144. #define build_flags ((void (*)(char *, struct flag_record *, struct flag_record *))global[65])
  145. #define flagrec_eq ((int(*)(struct flag_record*,struct flag_record *))global[66])
  146. #define flagrec_ok ((int(*)(struct flag_record*,struct flag_record *))global[67])
  147. /* 68 - 71 */
  148. #define shareout (*(Function *)(global[68]))
  149. #define dprintf (global[69])
  150. #define chatout (global[70])
  151. #define chanout_but ((void(*)())global[71])
  152. /* 72 - 75 */
  153. #define check_validity ((int (*) (char *,Function))global[72])
  154. #define list_delete ((int (*)( struct list_type **, struct list_type *))global[73])
  155. #define list_append ((int (*) ( struct list_type **, struct list_type *))global[74])
  156. #define list_contains ((int (*) (struct list_type *, struct list_type *))global[75])
  157. /* 76 - 79 */
  158. #define answer ((int (*) (int,char *,unsigned long *,unsigned short *,int))global[76])
  159. #define getmyip ((IP (*) (void))global[77])
  160. #define neterror ((void (*) (char *))global[78])
  161. #define tputs ((void (*) (int, char *,unsigned int))global[79])
  162. /* 80 - 83 */
  163. #define new_dcc ((int (*) (struct dcc_table *, int))global[80])
  164. #define lostdcc ((void (*) (int))global[81])
  165. #define getsock ((int (*) (int))global[82])
  166. #define killsock ((void (*) (int))global[83])
  167. /* 84 - 87 */
  168. #define open_listen ((int (*) (int *))global[84])
  169. #define open_telnet_dcc ((int (*) (int,char *,char *))global[85])
  170. #define get_data_ptr(x) ((void *(*)(int,char*,int))global[86])(x,__FILE__,__LINE__)
  171. #define open_telnet ((int (*) (char *, int))global[87])
  172. /* 88 - 91 */
  173. #ifndef HAVE_BZERO
  174. #define bzero ((void (*) (void *, int))global[88])
  175. #endif
  176. #define my_memcpy ((void * (*) (void *, const void *, size_t))global[89])
  177. #define my_atoul ((IP(*)(char *))global[90])
  178. #define my_strcpy ((int (*)(char *, const char *))global[91])
  179. /* 92 - 95 */
  180. #define dcc (*(struct dcc_t **)global[92])
  181. #define chanset (*(struct chanset_t **)(global[93]))
  182. #define userlist (*(struct userrec **)global[94])
  183. #define lastuser (*(struct userrec **)(global[95]))
  184. /* 96 - 99 */
  185. #define global_bans (*(maskrec **)(global[96]))
  186. #define global_ign (*(struct igrec **)(global[97]))
  187. #define password_timeout (*(int *)(global[98]))
  188. #define share_greet (*(int *)global[99])
  189. /* 100 - 103 */
  190. #define max_dcc (*(int *)global[100])
  191. #define require_p (*(int *)global[101])
  192. #define use_silence (*(int *)(global[102]))
  193. #define use_console_r (*(int *)(global[103]))
  194. /* 104 - 107 */
  195. #define ignore_time (*(int *)(global[104]))
  196. #define reserved_port (*(int *)(global[105]))
  197. #define debug_output (*(int *)(global[106]))
  198. #define noshare (*(int *)(global[107]))
  199. /* 108 - 111 */
  200. #define gban_total (*(int*)global[108])
  201. #define make_userfile (*(int*)global[109])
  202. #define default_flags (*(int*)global[110])
  203. #define dcc_total (*(int*)global[111])
  204. /* 112 - 115 */
  205. #define tempdir ((char *)(global[112]))
  206. #define natip ((char *)(global[113]))
  207. #define hostname ((char *)(global[114]))
  208. #define origbotname ((char *)(global[115]))
  209. /* 116 - 119 */
  210. #define botuser ((char *)(global[116]))
  211. #define admin ((char *)(global[117]))
  212. #define userfile ((char *)global[118])
  213. #define ver ((char *)global[119])
  214. /* 120 - 123 */
  215. #define notify_new ((char *)global[120])
  216. #define helpdir ((char *)global[121])
  217. #define Version ((char *)global[122])
  218. #define botnetnick ((char *)global[123])
  219. /* 124 - 127 */
  220. #define DCC_CHAT_PASS (*(struct dcc_table *)(global[124]))
  221. #define DCC_BOT (*(struct dcc_table *)(global[125]))
  222. #define DCC_LOST (*(struct dcc_table *)(global[126]))
  223. #define DCC_CHAT (*(struct dcc_table *)(global[127]))
  224. /* 128 - 131 */
  225. #define interp (*(Tcl_Interp **)(global[128]))
  226. #define now (*(time_t*)global[129])
  227. #define findanyidx ((int (*)(int))global[130])
  228. #define findchan ((struct chanset_t *(*)(char *))global[131])
  229. /* 132 - 135 */
  230. #define cmd_die (global[132])
  231. #define days ((void (*)(time_t,time_t,char *))global[133])
  232. #define daysago ((void (*)(time_t,time_t,char *))global[134])
  233. #define daysdur ((void (*)(time_t,time_t,char *))global[135])
  234. /* 136 - 139 */
  235. #define ismember ((memberlist * (*) (struct chanset_t *, char *))global[136])
  236. #define newsplit ((char *(*)(char **))global[137])
  237. #define splitnick ((char *(*)(char **))global[138])
  238. #define splitc ((void (*)(char *,char *,char))global[139])
  239. /* 140 - 143 */
  240. #define addignore ((void (*) (char *, char *, char *,time_t))global[140])
  241. #define match_ignore ((int (*)(char *))global[141])
  242. #define delignore ((int (*)(char *))global[142])
  243. #define fatal (global[143])
  244. /* 144 - 147 */
  245. #define xtra_kill ((void (*)(struct user_entry *))global[144])
  246. #define xtra_unpack ((void (*)(struct userrec *, struct user_entry *))global[145])
  247. #define movefile ((int (*) (char *, char *))global[146])
  248. #define copyfile ((int (*) (char *, char *))global[147])
  249. /* 148 - 151 */
  250. #define do_tcl ((void (*)(char *,char*))global[148])
  251. #define readtclprog ((int (*)(char *))global[149])
  252. #define get_language ((char *(*)(int))global[150])
  253. #define def_get ((void *(*)(struct userrec *, struct user_entry *))global[151])
  254. /* 152 - 155 */
  255. #define makepass ((void (*) (char *))global[152])
  256. #define wild_match ((int (*)(const char *, const char *))global[153])
  257. #define maskhost ((void(*)(char *,char*))global[154])
  258. #define show_motd ((void(*)(int))global[155])
  259. /* 156 - 159 */
  260. #define tellhelp ((void(*)(int,char *,struct flag_record *,int))global[156])
  261. #define showhelp ((void(*)(char *,char *,struct flag_record *,int))global[157])
  262. #define add_help_reference ((void(*)(char *))global[158])
  263. #define rem_help_reference ((void(*)(char *))global[159])
  264. /* 160 - 163 */
  265. #define touch_laston ((void (*)(struct userrec *,char *,time_t))global[160])
  266. #define add_mode ((void (*)(struct chanset_t *,char,char,char *))(*(Function**)(global[161])))
  267. #define rmspace ((void (*)(char *))global[162])
  268. #define in_chain ((int (*)(char *))global[163])
  269. /* 164 - 167 */
  270. #define add_note ((int (*)(char *,char*,char*,int,int))global[164])
  271. #define removedcc ((void (*) (int))global[165])
  272. #define detect_dcc_flood ((int (*) (time_t *,struct chat_info *,int))global[166])
  273. #define flush_lines ((void(*)(int,struct chat_info*))global[167])
  274. /* 168 - 171 */
  275. #define expected_memory ((int(*)(void))global[168])
  276. #define tell_mem_status ((void(*)(char *))global[169])
  277. #define do_restart (*(int *)(global[170]))
  278. #define check_tcl_filt ((char *(*)(int, char *))global[171])
  279. /* 172 - 175 */
  280. #define add_hook(a,b) (((void (*) (int, Function))global[172])(a,b))
  281. #define del_hook(a,b) (((void (*) (int, Function))global[173])(a,b))
  282. #define H_dcc (*(p_tcl_bind_list *)(global[174]))
  283. #define H_filt (*(p_tcl_bind_list *)(global[175]))
  284. /* 176 - 179 */
  285. #define H_chon (*(p_tcl_bind_list *)(global[176]))
  286. #define H_chof (*(p_tcl_bind_list *)(global[177]))
  287. #define H_load (*(p_tcl_bind_list *)(global[178]))
  288. #define H_unld (*(p_tcl_bind_list *)(global[179]))
  289. /* 180 - 183 */
  290. #define H_chat (*(p_tcl_bind_list *)(global[180]))
  291. #define H_act (*(p_tcl_bind_list *)(global[181]))
  292. #define H_bcst (*(p_tcl_bind_list *)(global[182]))
  293. #define H_bot (*(p_tcl_bind_list *)(global[183]))
  294. /* 184 - 187 */
  295. #define H_link (*(p_tcl_bind_list *)(global[184]))
  296. #define H_disc (*(p_tcl_bind_list *)(global[185]))
  297. #define H_away (*(p_tcl_bind_list *)(global[186]))
  298. #define H_nkch (*(p_tcl_bind_list *)(global[187]))
  299. /* 188 - 191 */
  300. #define USERENTRY_BOTADDR (*(struct user_entry_type *)(global[188]))
  301. #define USERENTRY_BOTFL (*(struct user_entry_type *)(global[189]))
  302. #define USERENTRY_HOSTS (*(struct user_entry_type *)(global[190]))
  303. #define USERENTRY_PASS (*(struct user_entry_type *)(global[191]))
  304. /* 192 - 195 */
  305. #define USERENTRY_XTRA (*(struct user_entry_type *)(global[192]))
  306. #define user_del_chan ((void(*)(char *))(global[193]))
  307. #define USERENTRY_INFO (*(struct user_entry_type *)(global[194]))
  308. #define USERENTRY_COMMENT (*(struct user_entry_type *)(global[195]))
  309. /* 196 - 199 */
  310. #define USERENTRY_LASTON (*(struct user_entry_type *)(global[196]))
  311. #define putlog (global[197])
  312. #define botnet_send_chan ((void(*)(int,char*,char*,int,char*))global[198])
  313. #define list_type_kill ((void(*)(struct list_type *))global[199])
  314. /* 200 - 203 */
  315. #define logmodes ((int(*)(char *))global[200])
  316. #define masktype ((const char *(*)(int))global[201])
  317. #define stripmodes ((int(*)(char *))global[202])
  318. #define stripmasktype ((const char *(*)(int))global[203])
  319. /* 204 - 207 */
  320. #define sub_lang ((void(*)(int,char *))global[204])
  321. #define online_since (*(int *)(global[205]))
  322. #define cmd_loadlanguage ((int (*)(struct userrec *,int,char *))global[206])
  323. #define check_dcc_attrs ((int (*)(struct userrec *,int))global[207])
  324. /* 208 - 211 */
  325. #define check_dcc_chanattrs ((int (*)(struct userrec *,char *,int,int))global[208])
  326. #define add_tcl_coups ((void (*) (tcl_coups *))global[209])
  327. #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
  328. #define botname ((char *)(global[211]))
  329. /* 212 - 215 */
  330. #define remove_gunk ((void(*)(char *))global[212])
  331. #define check_tcl_chjn ((void (*) (char *,char *,int,char,int,char *))global[213])
  332. #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
  333. #define isowner ((int (*)(char *))global[215])
  334. /* 216 - 219 */
  335. #define min_dcc_port (*(int *)(global[216])) /* dcc-portrange dw/guppy */
  336. #define max_dcc_port (*(int *)(global[217]))
  337. #define rfc_casecmp ((int(*)(char *, char *))(*(Function**)(global[218])))
  338. #define rfc_ncasecmp ((int(*)(char *, char *, int *))(*(Function**)(global[219])))
  339. /* 220 - 223 */
  340. #define global_exempts (*(maskrec **)(global[220]))
  341. #define global_invites (*(maskrec **)(global[221]))
  342. #define ginvite_total (*(int*)global[222])
  343. #define gexempt_total (*(int*)global[223])
  344. /* 224 - 227 */
  345. #define H_event (*(p_tcl_bind_list *)(global[224]))
  346. #define use_exempts (*(int *)(global[225])) /* drummer/Jason */
  347. #define use_invites (*(int *)(global[226])) /* drummer/Jason */
  348. #define force_expire (*(int *)(global[227])) /* Rufus */
  349. /* 228 - 231 */
  350. #define add_lang_section ((void(*)(char *))global[228])
  351. #define user_realloc(x,y) ((void *(*)(void *,int,char *,int))global[229])((x),(y),__FILE__,__LINE__)
  352. #define nrealloc(x,y) ((void *)(global[230]((x),(y),MODULE_NAME,__FILE__,__LINE__)))
  353. #define xtra_set ((int(*)(struct userrec *,struct user_entry *, void *))global[231])
  354. /* 232 - 235 */
  355. #ifdef DEBUG_CONTEXT
  356. # define ContextNote(note) (global[232](__FILE__, __LINE__, MODULE_NAME, note))
  357. #else
  358. # define ContextNote(note) {}
  359. #endif
  360. #ifdef DEBUG_ASSERT
  361. # define Assert(expr) (global[233](__FILE__, __LINE__, MODULE_NAME, (int)(expr)))
  362. #else
  363. # define Assert(expr) {}
  364. #endif
  365. #define protect_readonly (*(int *)(global[234]))
  366. #define del_lang_section ((int(*)(char *))global[235])
  367. /* 236 - 239 */
  368. /* this is for blowfish module, couldnt be bothereed making a whole new .h
  369. * file for it ;) */
  370. #ifndef MAKING_BLOWFISH
  371. #define encrypt_string(a,b) (((char *(*)(char *,char*))blowfish_funcs[4])(a,b))
  372. #define decrypt_string(a,b) (((char *(*)(char *,char*))blowfish_funcs[5])(a,b))
  373. #endif
  374. #endif /* _EGG_MOD_MODULE_H */