1 /* 2 * tclhash.h 3 */ 4 /* 5 * Copyright (C) 1997 Robey Pointer 6 * Copyright (C) 1999 - 2021 Eggheads Development Team 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 */ 22 23 #ifndef _EGG_TCLHASH_H 24 #define _EGG_TCLHASH_H 25 26 27 #define TC_DELETED 0x0001 /* This command/trigger was deleted. */ 28 29 typedef struct tcl_cmd_b { 30 struct tcl_cmd_b *next; 31 struct flag_record flags; 32 char *func_name; /* Proc name. */ 33 uint8_t attributes; /* Flags for this entry. TC_* */ 34 unsigned int hits; /* Number of times this proc was triggered. */ 35 } tcl_cmd_t; 36 37 struct threaddata { 38 int (*mainloopfunc)(int); /* main loop function replacing a single 39 * tcl event loop iteration */ 40 sock_list *socklist; /* tcl socket list for threads, else NULL */ 41 struct timeval blocktime; /* maximum time to block in select() */ 42 int mainthread; /* Is this the main thread? */ 43 int MAXSOCKS; 44 }; 45 46 #define TBM_DELETED 0x0001 /* This mask was deleted. */ 47 48 typedef struct tcl_bind_mask_b { 49 struct tcl_bind_mask_b *next; 50 char *mask; 51 uint8_t flags; /* Flags for this entry. TBM_* */ 52 tcl_cmd_t *first; /* List of commands registered for this bind. */ 53 } tcl_bind_mask_t; 54 55 56 #define HT_STACKABLE 0x0001 /* Triggers in this bind list may be stacked. */ 57 #define HT_DELETED 0x0002 /* This bind list was already deleted. Do not 58 * use it anymore. */ 59 60 typedef struct tcl_bind_list_b { 61 struct tcl_bind_list_b *next; 62 char name[16]; /* Name of the bind. */ 63 uint8_t flags; /* Flags for this element. HT_* */ 64 IntFunc func; /* Function used as the Tcl calling interface 65 * for procs actually representing C functions. */ 66 tcl_bind_mask_t *first; /* Pointer to registered binds for this list. */ 67 } tcl_bind_list_t, *p_tcl_bind_list; 68 69 70 #ifndef MAKING_MODS 71 72 void garbage_collect_tclhash(void); 73 74 void init_bind(void); 75 void kill_bind(void); 76 int expmem_tclhash(void); 77 78 tcl_bind_list_t *add_bind_table(const char *nme, int flg, IntFunc func); 79 void del_bind_table(tcl_bind_list_t *tl_which); 80 81 tcl_bind_list_t *find_bind_table(const char *nme); 82 83 int check_tcl_bind(tcl_bind_list_t *, const char *, struct flag_record *, 84 const char *, int); 85 int check_tcl_dcc(const char *, int, const char *); 86 void check_tcl_chjn(const char *, const char *, int, char, int, const char *); 87 void check_tcl_chpt(const char *, const char *, int, int); 88 void check_tcl_bot(const char *, const char *, const char *); 89 void check_tcl_link(const char *, const char *); 90 void check_tcl_disc(const char *); 91 const char *check_tcl_filt(int, const char *); 92 int check_tcl_note(const char *, const char *, const char *); 93 void check_tcl_listen(const char *, int); 94 void check_tcl_time_and_cron(struct tm *); 95 void tell_binds(int, char *); 96 void check_tcl_nkch(const char *, const char *); 97 void check_tcl_away(const char *, int, const char *); 98 void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *); 99 void check_tcl_event(const char *); 100 int check_tcl_signal(const char *); 101 void check_tcl_die(char *); 102 void check_tcl_log(int, char *, char *); 103 #ifdef TLS 104 int check_tcl_tls(int); 105 #endif 106 107 #define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat) 108 #define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act) 109 #define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst) 110 void check_tcl_chonof(char *, int, tcl_bind_list_t *); 111 112 #define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon) 113 #define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof) 114 void check_tcl_loadunld(const char *, tcl_bind_list_t *); 115 116 #define check_tcl_load(a) check_tcl_loadunld(a, H_load) 117 #define check_tcl_unld(a) check_tcl_loadunld(a, H_unld) 118 119 void rem_builtins(tcl_bind_list_t *, cmd_t *); 120 void add_builtins(tcl_bind_list_t *, cmd_t *); 121 122 int check_validity(char *, IntFunc); 123 extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof; 124 extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link; 125 extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event, H_log; 126 127 #endif /* MAKING_MODS */ 128 129 #endif /* _EGG_TCLHASH_H */ 130