/[cvs]/eggdrop1.4/src/eggdrop.h
ViewVC logotype

Contents of /eggdrop1.4/src/eggdrop.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (show annotations) (download) (as text)
Wed Dec 15 02:32:58 1999 UTC (20 years ago) by guppy
Branch: MAIN
Changes since 1.15: +26 -13 lines
File MIME type: text/x-csrc
id-header patch, finally, we have id tags for each file

1 /*
2 * eggdrop.h
3 * Eggdrop compile-time settings
4 *
5 * IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
6 *
7 * $Id$
8 */
9 /*
10 * Copyright (C) 1997 Robey Pointer
11 * Copyright (C) 1999 Eggheads
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 */
27 #ifndef _EGG_EGGDROP_H
28 #define _EGG_EGGDROP_H
29
30 /*
31 * If you're *only* going to link to new version bots (1.3.0 or higher)
32 * then you can safely define this.
33 */
34 #undef NO_OLD_BOTNET
35
36 /*
37 * Undefine this to completely disable context debugging.
38 * WARNING: DO NOT send in bug reports if you undefine this!
39 */
40 #define DEBUG_CONTEXT
41
42 /*
43 * define the maximum length a handle on the bot can be.
44 * (standard is 9 characters long)
45 * (DO NOT MAKE THIS VALUE LESS THAN 9 UNLESS YOU WANT TROUBLE!)
46 * (beware that using lengths over 9 chars is 'non-standard' and if you
47 * wish to link to other bots, they _must_ both have the same maximum
48 * handle length)
49 */
50
51 /* handy string lengths */
52
53 #define HANDLEN 9 /* valid values 9->NICKMAX */
54 #define BADHANDCHARS "-,+*=:!.@#;$%&"
55 #define NICKMAX 9 /* valid values HANDLEN->32 */
56 #define UHOSTMAX 160 /* reasonable, i think? */
57 #define DIRMAX 256 /* paranoia */
58 #define MAX_LOG_LINE 767 /* for misc.c/putlog() <cybah> */
59
60 /* language stuff */
61
62 #define LANGDIR "./language" /* language file directory */
63 #define BASELANG "english" /* language which always gets loaded before
64 all other languages. You don't want to
65 change this. */
66
67 /***********************************************************************/
68 /***** the 'configure' script should make this next part automatic *****/
69 /***********************************************************************/
70
71 #define NICKLEN NICKMAX + 1
72 #define UHOSTLEN UHOSTMAX + 1
73 #define DIRLEN DIRMAX + 1
74 #define NOTENAMELEN ((HANDLEN * 2) + 1)
75 #define BADNICKCHARS "-,+*=:!.@#;$%&"
76
77 /* have to use a weird way to make the compiler error out cos not all
78 * compilers support #error or error */
79 #if !HAVE_VSPRINTF
80 #include "error_you_need_vsprintf_to_compile_eggdrop"
81 #endif
82
83 #if HAVE_UNISTD_H
84 #include <unistd.h>
85 #endif
86
87 #ifndef STATIC
88 #if (!defined(MODULES_OK) || !defined(HAVE_DLOPEN)) && !defined(HPUX_HACKS)
89 #include "you_can't_compile_with_module_support_on_this_system_try_make_static"
90 #endif
91 #endif
92
93 #if !defined(STDC_HEADERS)
94 #include "you_need_to_upgrade_your_compiler_to_a_standard_c_one_mate!"
95 #endif
96
97 #if (NICKMAX < 9) || (NICKMAX > 32)
98 #include "invalid NICKMAX value"
99 #endif
100
101 #if (HANDLEN < 9) || (HANDLEN > 32)
102 #include "invalid HANDLEN value"
103 #endif
104
105 #if HANDLEN > NICKMAX
106 #include "HANDLEN MUST BE <= NICKMAX"
107 #endif
108
109 /* almost every module needs some sort of time thingy, so... */
110 #if TIME_WITH_SYS_TIME
111 #include <sys/time.h>
112 #include <time.h>
113 #else
114 #if HAVE_SYS_TIME_H
115 #include <sys/time.h>
116 #else
117 #include <time.h>
118 #endif
119 #endif
120
121 #if !HAVE_SRANDOM
122 #define srandom(x) srand(x)
123 #endif
124
125 #if !HAVE_RANDOM
126 #define random() (rand()/16)
127 #endif
128
129 #if !HAVE_SIGACTION /* old "weird signals" */
130 #define sigaction sigvec
131 #ifndef sa_handler
132 #define sa_handler sv_handler
133 #define sa_mask sv_mask
134 #define sa_flags sv_flags
135 #endif
136 #endif
137
138 #if !HAVE_SIGEMPTYSET
139 /* and they probably won't have sigemptyset, dammit */
140 #define sigemptyset(x) ((*(int *)(x))=0)
141 #endif
142
143 /* handy aliases for memory tracking and core dumps */
144 #define nmalloc(x) n_malloc((x),__FILE__,__LINE__)
145 #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
146 #define nfree(x) n_free((x),__FILE__,__LINE__)
147
148 #ifdef DEBUG_CONTEXT
149 # define Context eggContext(__FILE__, __LINE__, NULL)
150 # define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note)
151 #else
152 # define Context {}
153 # define ContextNote(note) {}
154 #endif
155
156 #ifdef DEBUG_ASSERT
157 # define Assert(expr) eggAssert(__FILE__, __LINE__, NULL, (int)(expr))
158 #else
159 # define Assert(expr) {}
160 #endif
161
162 #undef malloc
163 #define malloc(x) dont_use_old_malloc(x)
164 #undef free
165 #define free(x) dont_use_old_free(x)
166
167 /* 32 bit type */
168 #if (SIZEOF_INT == 4)
169 typedef unsigned int u_32bit_t;
170 #else
171 # if (SIZEOF_LONG == 4)
172 typedef unsigned int u_32bit_t;
173 # else
174 # include "cant/find/32bit/type"
175 # endif
176 #endif
177
178 #if (SIZEOF_SHORT_INT == 2)
179 typedef unsigned short int u_16bit_t;
180 #else
181 # include "cant/find/16bit/type"
182 #endif
183
184 #if (SIZEOF_CHAR == 1)
185 typedef unsigned char u_8bit_t;
186 #else
187 # include "cant/find/8bit/type"
188 #endif
189
190 typedef u_8bit_t byte;
191 typedef u_16bit_t word;
192 typedef u_32bit_t dword;
193
194 /* IP type */
195 typedef u_32bit_t IP;
196
197 #define debug0(x) putlog(LOG_DEBUG,"*",x)
198 #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
199 #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
200 #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
201 #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
202
203 /***********************************************************************/
204
205 /* public structure for the listening port map */
206 struct portmap {
207 int realport;
208 int mappedto;
209 struct portmap *next;
210 };
211
212 /* public structure of all the dcc connections */
213 struct dcc_table {
214 char *name;
215 int flags;
216 void (*eof) (int);
217 void (*activity) (int, char *, int);
218 int *timeout_val;
219 void (*timeout) ();
220 void (*display) (int, char *);
221 int (*expmem) (void *);
222 void (*kill) (int, void *);
223 void (*output) (int, char *, void *);
224 };
225
226 struct userrec;
227
228 struct dcc_t {
229 long sock; /* this should be a long to keep 64-bit
230 * machines sane */
231 IP addr; /* IP address in host byte order */
232 unsigned int port;
233 struct userrec *user;
234 char nick[NICKLEN];
235 char host[UHOSTLEN];
236 struct dcc_table *type;
237 time_t timeval; /* use for any timing stuff
238 * - this is used for timeout checking */
239 unsigned long status; /* A LOT of dcc types have status thingos,
240 * this makes it more avaliabe */
241 union {
242 struct chat_info *chat;
243 struct file_info *file;
244 struct edit_info *edit;
245 struct xfer_info *xfer;
246 struct bot_info *bot;
247 struct relay_info *relay;
248 struct script_info *script;
249 int ident_sock;
250 void *other;
251 } u; /* special use depending on type */
252 };
253
254 struct chat_info {
255 char *away; /* non-NULL if user is away */
256 int msgs_per_sec; /* used to stop flooding */
257 int con_flags; /* with console: what to show */
258 int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
259 char con_chan[81]; /* with console: what channel to view */
260 int channel; /* 0=party line, -1=off */
261 struct msgq *buffer; /* a buffer of outgoing lines (for .page cmd) */
262 int max_line; /* maximum lines at once */
263 int line_count; /* number of lines sent since last page */
264 int current_lines; /* number of lines total stored */
265 char *su_nick;
266 };
267
268 struct file_info {
269 struct chat_info *chat;
270 char dir[161];
271 };
272
273 struct xfer_info {
274 char filename[121];
275 char dir[121]; /* used when uploads go to the current dir */
276 unsigned long length;
277 unsigned long acked;
278 char buf[4]; /* you only need 5 bytes! */
279 unsigned char sofar; /* how much of the byte count received */
280 char from[NICKLEN]; /* [GET] user who offered the file */
281 FILE *f; /* pointer to file being sent/received */
282 };
283
284 struct bot_info {
285 char version[121]; /* channel/version info */
286 char linker[NOTENAMELEN + 1]; /* who requested this link */
287 int numver;
288 int port; /* base port */
289 };
290
291 struct relay_info {
292 struct chat_info *chat;
293 int sock;
294 int port;
295 int old_status;
296 };
297
298 struct script_info {
299 struct dcc_table *type;
300 union {
301 struct chat_info *chat;
302 struct file_info *file;
303 void *other;
304 } u;
305 char command[121];
306 };
307
308 /* flags about dcc types */
309 #define DCT_CHAT 0x00000001 /* this dcc type receives botnet chatter */
310 #define DCT_MASTER 0x00000002 /* received master chatter */
311 #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
312 #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
313 #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to in tcl */
314 #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
315 #define DCT_CANBOOT 0x00000040 /* can be booted */
316 #define DCT_GETNOTES DCT_CHAT /* can receive notes */
317 #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
318 #define DCT_FORKTYPE 0x00000100 /* a forking type */
319 #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
320 #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
321 #define DCT_FILESEND 0x00000800 /* a sending file transfer, getting = !this */
322 #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
323
324 /* for dcc chat & files: */
325 #define STAT_ECHO 1 /* echo commands back? */
326 #define STAT_DENY 2 /* bad username (ignore password & deny access) */
327 /*#define STAT_XFER 4 has 'x' flag on chat line */
328 #define STAT_CHAT 8 /* in file-system but may return */
329 #define STAT_TELNET 16 /* connected via telnet */
330 #define STAT_PARTY 32 /* only on party line via 'p' flag */
331 #define STAT_BOTONLY 64 /* telnet on bots-only connect */
332 #define STAT_USRONLY 128 /* telnet on users-only connect */
333 #define STAT_PAGE 256 /* page output to the user */
334
335 /* for stripping out mIRC codes */
336 #define STRIP_COLOR 1 /* remove mIRC color codes */
337 #define STRIP_BOLD 2 /* remove bold codes */
338 #define STRIP_REV 4 /* remove reverse video codes */
339 #define STRIP_UNDER 8 /* remove underline codes */
340 #define STRIP_ANSI 16 /* remove ALL ansi codes */
341 #define STRIP_BELLS 32 /* remote ctrl-g's */
342 #define STRIP_ALL 63 /* remove every damn thing! */
343
344 /* for dcc bot links: */
345 #define STAT_PINGED 0x01 /* waiting for ping to return */
346 #define STAT_SHARE 0x02 /* sharing user data with the bot */
347 #define STAT_CALLED 0x04 /* this bot called me */
348 #define STAT_OFFERED 0x08 /* offered her the user file */
349 #define STAT_SENDING 0x10 /* in the process of sending a user list */
350 #define STAT_GETTING 0x20 /* in the process of getting a user list */
351 #define STAT_WARNED 0x40 /* warned him about unleaflike behavior */
352 #define STAT_LEAF 0x80 /* this bot is a leaf only */
353 #define STAT_LINKING 0x100 /* the bot is currently going through the
354 * linking stage */
355 #define STAT_AGGRESSIVE 0x200 /* aggressively sharing with this bot */
356
357 /* chan & global */
358 #define FLOOD_PRIVMSG 0
359 #define FLOOD_NOTICE 1
360 #define FLOOD_CTCP 2
361 #define FLOOD_NICK 3
362 #define FLOOD_JOIN 4
363 #define FLOOD_KICK 5
364 #define FLOOD_DEOP 6
365 #define FLOOD_CHAN_MAX 7
366 #define FLOOD_GLOBAL_MAX 3
367
368 /* for local console: */
369 #define STDIN 0
370 #define STDOUT 1
371 #define STDERR 2
372
373 /* structure for internal logs */
374 typedef struct {
375 char *filename;
376 unsigned int mask; /* what to send to this log */
377 char *chname; /* which channel */
378 char szLast[MAX_LOG_LINE + 1]; /* for 'Last message repeated n times'
379 * stuff in misc.c/putlog() <cybah> */
380 int Repeats; /* number of times szLast has been repeated */
381 unsigned int flags; /* other flags <rtc> */
382 FILE *f; /* existing file */
383 } log_t;
384
385 /* logfile display flags */
386 #define LOG_MSGS 0x000001 /* m msgs/notice/ctcps */
387 #define LOG_PUBLIC 0x000002 /* p public msg/notice/ctcps */
388 #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
389 #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
390 #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
391 #define LOG_MISC 0x000020 /* o other misc bot things */
392 #define LOG_BOTS 0x000040 /* b bot notices */
393 #define LOG_RAW 0x000080 /* r raw server stuff coming in */
394 #define LOG_FILES 0x000100 /* x file transfer commands and stats */
395 #define LOG_LEV1 0x000200 /* 1 user log level */
396 #define LOG_LEV2 0x000400 /* 2 user log level */
397 #define LOG_LEV3 0x000800 /* 3 user log level */
398 #define LOG_LEV4 0x001000 /* 4 user log level */
399 #define LOG_LEV5 0x002000 /* 5 user log level */
400 #define LOG_LEV6 0x004000 /* 6 user log level */
401 #define LOG_LEV7 0x008000 /* 7 user log level */
402 #define LOG_LEV8 0x010000 /* 8 user log level */
403 #define LOG_SERV 0x020000 /* s server information */
404 #define LOG_DEBUG 0x040000 /* d debug */
405 #define LOG_WALL 0x080000 /* w wallops */
406 #define LOG_SRVOUT 0x100000 /* v server output */
407 #define LOG_BOTNET 0x200000 /* t botnet traffic */
408 #define LOG_BOTSHARE 0x400000 /* h share traffic */
409 #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
410 /* internal logfile flags */
411 #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
412
413 #define FILEDB_HIDE 1
414 #define FILEDB_UNHIDE 2
415 #define FILEDB_SHARE 3
416 #define FILEDB_UNSHARE 4
417
418 /* socket flags: */
419 #define SOCK_UNUSED 0x001 /* empty socket */
420 #define SOCK_BINARY 0x002 /* do not buffer input */
421 #define SOCK_LISTEN 0x004 /* listening port */
422 #define SOCK_CONNECT 0x008 /* connection attempt */
423 #define SOCK_NONSOCK 0x010 /* used for file i/o on debug */
424 #define SOCK_STRONGCONN 0x020 /* don't report success until sure */
425 #define SOCK_EOFD 0x040 /* it EOF'd recently during a write */
426 #define SOCK_PROXYWAIT 0x080 /* waiting for SOCKS traversal */
427
428 /* fake idx's for dprintf - these should be ridiculously large +ve nums */
429 #define DP_STDOUT 0x7FF1
430 #define DP_LOG 0x7FF2
431 #define DP_SERVER 0x7FF3
432 #define DP_HELP 0x7FF4
433 #define DP_STDERR 0x7FF5
434 #define DP_MODE 0x7FF6
435
436 #define NORMAL 0
437 #define QUICK 1
438
439 /* return codes for add_note */
440 #define NOTE_ERROR 0 /* error */
441 #define NOTE_OK 1 /* success */
442 #define NOTE_STORED 2 /* not online; stored */
443 #define NOTE_FULL 3 /* too many notes stored */
444 #define NOTE_TCL 4 /* tcl binding caught it */
445 #define NOTE_AWAY 5 /* away; stored */
446 #define NOTE_FWD 6 /* away; forwarded */
447 #define NOTE_REJECT 7 /* ignore mask matched */
448
449 #define STR_PROTECT 2
450 #define STR_DIR 1
451
452 #define HELP_DCC 1
453 #define HELP_TEXT 2
454 #define HELP_IRC 16
455
456 /* it's used in so many places, let's put it here */
457 typedef int (*Function) ();
458
459 /* this is used by the net module to keep track of sockets and what's
460 * queued on them */
461 typedef struct {
462 int sock;
463 char flags;
464 char *inbuf;
465 char *outbuf;
466 unsigned long outbuflen; /* outbuf could be binary data */
467 } sock_list;
468
469 #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23