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

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

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


Revision 1.2 - (show annotations) (download) (as text)
Tue Jul 27 21:49:41 2010 UTC (9 years, 2 months ago) by pseudo
Branch: MAIN
Changes since 1.1: +2 -2 lines
File MIME type: text/x-csrc
Updated documentation to reference 1.8 instead of 1.6.
Changed module dependencies to 1.8.
Changed default handle length to 32.
Changed default make type to 'debug' as it should be in CVS builds.

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: eggdrop.h,v 1.1.1.1 2010/07/26 21:11:06 simple Exp $
8 */
9 /*
10 * Copyright (C) 1997 Robey Pointer
11 * Copyright (C) 1999 - 2010 Eggheads Development Team
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
28 #ifndef _EGG_EGGDROP_H
29 #define _EGG_EGGDROP_H
30
31 /*
32 * If you're *only* going to link to new version bots (1.3.0 or higher)
33 * then you can safely define this.
34 */
35 #undef NO_OLD_BOTNET
36
37 /* DEBUG_CONTEXT is now set in config.h by configure */
38
39 /*
40 * HANDLEN note:
41 * HANDLEN defines the maximum length a handle on the bot can be.
42 * Standard (and minimum) is 9 characters long.
43 *
44 * Beware that using lengths over 9 chars is 'non-standard' and if
45 * you wish to link to other bots, they _must_ both have the same
46 * maximum handle length.
47 *
48 * NICKMAX note:
49 * You should leave this at 32 characters and modify nick-len in the
50 * configuration file instead.
51 */
52 #define HANDLEN 32 /* valid values 9->NICKMAX */
53 #define NICKMAX 32 /* valid values HANDLEN->32 */
54
55
56 /* Handy string lengths */
57 #define UHOSTMAX 291 + NICKMAX /* 32 (ident) + 3 (\0, !, @) + NICKMAX */
58 #define DIRMAX 512 /* paranoia */
59 #define LOGLINEMAX 767 /* for misc.c/putlog() <cybah> */
60
61 /* Invalid characters */
62 #define BADNICKCHARS "-,+*=:!.@#;$%&"
63 #define BADHANDCHARS "-,+*=:!.@#;$%&"
64
65
66 /* Language stuff */
67 #define LANGDIR "./language" /* language file directory */
68 #define BASELANG "english" /* language which always gets loaded before
69 all other languages. You do not want to
70 change this. */
71
72
73 /* The 'configure' script should make this next part automatic, so you
74 * shouldn't need to adjust anything below.
75 */
76 #define NICKLEN NICKMAX + 1
77 #define UHOSTLEN UHOSTMAX + 1
78 #define DIRLEN DIRMAX + 1
79 #define LOGLINELEN LOGLINEMAX + 1
80 #define NOTENAMELEN ((HANDLEN * 2) + 1)
81
82
83 /* We have to generate compiler errors in a weird way since not all compilers
84 * support the #error preprocessor directive. */
85 #ifndef STDC_HEADERS
86 # include "Error: Your system must have standard ANSI C headers."
87 #endif
88
89 #ifndef HAVE_VPRINTF
90 # include "Error: You need vsprintf to compile eggdrop."
91 #endif
92
93 #ifdef HAVE_UNISTD_H
94 # include <unistd.h>
95 #endif
96
97 /* This allows us to make things a lot less messy in modules.c. */
98 #ifndef STATIC
99 # if !defined(MODULES_OK) || (!defined(MOD_USE_DL) && !defined(MOD_USE_SHL) && !defined(MOD_USE_DYLD) && !defined(MOD_USE_RLD) && !defined(MOD_USE_LOADER))
100 # include "Error: You can't compile with module support on this system (try make static)."
101 # else
102 # ifdef MOD_USE_DL
103 # ifndef HAVE_DLOPEN
104 # include "Error: We have detected that dlopen() should be used to load modules on this OS; but it was not found. Please use 'make static'."
105 # endif
106 # undef MOD_USE_SHL
107 # undef MOD_USE_DYLD
108 # undef MOD_USE_RLD
109 # undef MOD_USE_LOADER
110 # endif
111 # ifdef MOD_USE_SHL
112 # ifndef HAVE_SHL_LOAD
113 # include "Error: We have detected that shl_load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
114 # endif
115 # undef MOD_USE_DL
116 # undef MOD_USE_DYLD
117 # undef MOD_USE_RLD
118 # undef MOD_USE_LOADER
119 # endif
120 # ifdef MOD_USE_DYLD
121 # ifndef HAVE_NSLINKMODULE
122 # include "Error: We have detected that NSLinkModule() should be used to load modules on this OS; but it was not found. Please use 'make static'."
123 # endif
124 # undef MOD_USE_DL
125 # undef MOD_USE_SHL
126 # undef MOD_USE_RLD
127 # undef MOD_USE_LOADER
128 # endif
129 # ifdef MOD_USE_RLD
130 # ifndef HAVE_RLD_LOAD
131 # include "Error: We have detected that rld_load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
132 # endif
133 # undef MOD_USE_DL
134 # undef MOD_USE_SHL
135 # undef MOD_USE_DYLD
136 # undef MOD_USE_LOADER
137 # endif
138 # ifdef MOD_USE_LOADER
139 # ifndef HAVE_LOAD
140 # include "Error: We have detected that load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
141 # endif
142 # undef MOD_USE_DL
143 # undef MOD_USE_SHL
144 # undef MOD_USE_DYLD
145 # undef MOD_USE_RLD
146 # endif
147 # endif
148 #endif
149
150 #ifdef EGG_HANDLEN
151 # undef HANDLEN
152 # define HANDLEN EGG_HANDLEN
153 #endif
154
155 #if (NICKMAX < 9) || (NICKMAX > 32)
156 # include "Error: Invalid NICKMAX value."
157 #endif
158
159 #if (HANDLEN < 9) || (HANDLEN > 32)
160 # include "Error: Invalid HANDLEN value."
161 #endif
162
163 #if HANDLEN > NICKMAX
164 # include "Error: HANDLEN must be <= NICKMAX."
165 #endif
166
167 #ifdef HAVE_SYS_PARAM_H
168 # include <sys/param.h>
169 #endif
170
171 /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
172 * Use 255 if we can't find anything else.
173 */
174 #ifndef NAME_MAX
175 # ifdef MAXNAMLEN
176 # define NAME_MAX MAXNAMLEN
177 # else
178 # define NAME_MAX 255
179 # endif
180 #endif
181
182 /* Almost every module needs some sort of time thingy, so... */
183 #ifdef TIME_WITH_SYS_TIME
184 # include <sys/time.h>
185 # include <time.h>
186 #else
187 # ifdef HAVE_SYS_TIME_H
188 # include <sys/time.h>
189 # else
190 # include <time.h>
191 # endif
192 #endif
193
194
195 /* Yikes...who would have thought finding a usable random() would be so much
196 * trouble?
197 * Note: random(), rand(), and lrand48() are *not* thread safe.
198 */
199 #ifdef HAVE_RANDOM
200 /* On systems with random(), RANDOM_MAX may or may not be defined.
201 *
202 * If RANDOM_MAX isn't defined, we use 0x7FFFFFFF (2^31-1), or 2147483647
203 * since this follows the 4.3BSD and POSIX.1-2001 standards. This of course
204 * assumes random() uses a 32 bit long int type per the standards.
205 */
206 # ifndef RANDOM_MAX
207 # define RANDOM_MAX 0x7FFFFFFF /* random() -- 2^31-1 */
208 # endif
209 #else /* !HAVE_RANDOM */
210 /* This shouldn't exist in this case, but just to be safe... */
211 # ifdef RANDOM_MAX
212 # undef RANDOM_MAX
213 # endif
214 /* If we don't have random() it's safe to assume we also don't have
215 * srandom(), and we need both.
216 */
217 # ifdef HAVE_RAND
218 # define random() rand()
219 # define srandom(x) srand(x)
220 /* Depending on the system int size, RAND_MAX can be either 0x7FFFFFFF
221 * (2^31-1), or 2147483647 for a 32 bit int, or 0x7FFF (2^15-1), or
222 * 32767 for a 16 bit int. The standards only state that RAND_MAX must
223 * be _at least_ 32767 but some systems with 16 bit int define it as
224 * 32767. See: SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
225 */
226 # define RANDOM_MAX RAND_MAX /* rand() -- 2^31-1 or 2^15-1 */
227 # else /* !HAVE_RAND */
228 # ifdef HAVE_LRAND48
229 # define random() lrand48()
230 # define srandom(x) srand48(x)
231 /* For lrand48() we define RANDOM_MAX as 0x7FFFFFFF (2^31-1), or
232 * 2147483647 since this is what the SVr4 and POSIX.1-2001 standards
233 * call for. Note: SVID 3 declares these functions as obsolete and
234 * states rand() should be used instead.
235 */
236 # define RANDOM_MAX 0x7FFFFFFF /* lrand48() -- 2^31-1 */
237 # else /* !HAVE_LRAND48 */
238 # include "Error: Must define one of HAVE_RANDOM, HAVE_RAND, or HAVE_LRAND48"
239 # endif /* HAVE_LRAND48 */
240 # endif /* HAVE_RAND */
241 #endif /* HAVE_RANDOM */
242
243
244 /* Use high-order bits for getting the random integer. With a modern
245 * random() implmentation, modulo would probably be sufficient, but on
246 * systems lacking random(), it may just be a macro for an older rand()
247 * fucntion.
248 */
249 #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
250
251
252 #ifndef HAVE_SIGACTION /* old "weird signals" */
253 # define sigaction sigvec
254 # ifndef sa_handler
255 # define sa_handler sv_handler
256 # define sa_mask sv_mask
257 # define sa_flags sv_flags
258 # endif
259 #endif
260
261 #ifndef HAVE_SIGEMPTYSET
262 # define sigemptyset(x) ((*(int *)(x))=0)
263 #endif
264
265 #ifndef HAVE_SOCKLEN_T
266 typedef int socklen_t;
267 #endif
268
269 /*
270 * Handy aliases for memory tracking and core dumps
271 */
272
273 #define nmalloc(x) n_malloc((x),__FILE__,__LINE__)
274 #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
275 #define nfree(x) n_free((x),__FILE__,__LINE__)
276
277 #ifdef DEBUG_CONTEXT
278 # define Context eggContext(__FILE__, __LINE__, NULL)
279 # define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note)
280 #else
281 # define Context do {} while (0)
282 # define ContextNote(note) do {} while (0)
283 #endif
284
285 #ifdef DEBUG_ASSERT
286 # define Assert(expr) do { \
287 if (!(expr)) \
288 eggAssert(__FILE__, __LINE__, NULL); \
289 } while (0)
290 #else
291 # define Assert(expr) do {} while (0)
292 #endif
293
294 #ifndef COMPILING_MEM
295 # undef malloc
296 # define malloc(x) dont_use_old_malloc(x)
297 # undef free
298 # define free(x) dont_use_old_free(x)
299 #endif /* !COMPILING_MEM */
300
301 /* 32 bit type */
302 #if (SIZEOF_INT == 4)
303 typedef unsigned int u_32bit_t;
304 #else
305 # if (SIZEOF_LONG == 4)
306 typedef unsigned long u_32bit_t;
307 # else
308 # include "Error: Can't find 32bit type."
309 # endif
310 #endif
311
312 typedef unsigned short int u_16bit_t;
313 typedef unsigned char u_8bit_t;
314
315 /* IP type */
316 typedef u_32bit_t IP;
317
318 /* Debug logging macros */
319 #define debug0(x) putlog(LOG_DEBUG,"*",x)
320 #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
321 #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
322 #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
323 #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
324
325 /* These apparently are unsafe without recasting. */
326 #define egg_isdigit(x) isdigit((int) (unsigned char) (x))
327 #define egg_isxdigit(x) isxdigit((int) (unsigned char) (x))
328 #define egg_isascii(x) isascii((int) (unsigned char) (x))
329 #define egg_isspace(x) isspace((int) (unsigned char) (x))
330 #define egg_islower(x) islower((int) (unsigned char) (x))
331
332 /***********************************************************************/
333
334 /* It's used in so many places, let's put it here */
335 typedef intptr_t (*Function) ();
336 typedef int (*IntFunc) ();
337
338 /* Public structure for the listening port map */
339 struct portmap {
340 int realport;
341 int mappedto;
342 struct portmap *next;
343 };
344
345 /* Public structure of all the dcc connections */
346 struct dcc_table {
347 char *name;
348 int flags;
349 void (*eof) (int);
350 void (*activity) (int, char *, int);
351 int *timeout_val;
352 void (*timeout) (int);
353 void (*display) (int, char *);
354 int (*expmem) (void *);
355 void (*kill) (int, void *);
356 void (*output) (int, char *, void *);
357 void (*outdone) (int);
358 };
359
360 struct userrec;
361
362 struct dcc_t {
363 long sock; /* This should be a long to keep 64-bit machines sane. */
364 IP addr; /* IP address in host network byte order. */
365 unsigned int port;
366 struct userrec *user;
367 char nick[NICKLEN];
368 char host[UHOSTLEN];
369 struct dcc_table *type;
370 time_t timeval; /* This is used for timeout checking. */
371 unsigned long status; /* A LOT of dcc types have status things; makes it more availabe. */
372 union {
373 struct chat_info *chat;
374 struct file_info *file;
375 struct edit_info *edit;
376 struct xfer_info *xfer;
377 struct bot_info *bot;
378 struct relay_info *relay;
379 struct script_info *script;
380 struct dns_info *dns;
381 struct dupwait_info *dupwait;
382 int ident_sock;
383 void *other;
384 } u; /* Special use depending on type */
385 };
386
387 struct chat_info {
388 char *away; /* non-NULL if user is away */
389 int msgs_per_sec; /* used to stop flooding */
390 int con_flags; /* with console: what to show */
391 int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
392 char con_chan[81]; /* with console: what channel to view */
393 int channel; /* 0=party line, -1=off */
394 struct msgq *buffer; /* a buffer of outgoing lines
395 * (for .page cmd) */
396 int max_line; /* maximum lines at once */
397 int line_count; /* number of lines sent since last page */
398 int current_lines; /* number of lines total stored */
399 char *su_nick;
400 };
401
402 struct file_info {
403 struct chat_info *chat;
404 char dir[161];
405 };
406
407 struct xfer_info {
408 char *filename;
409 char *origname;
410 char dir[DIRLEN]; /* used when uploads go to the current dir */
411 unsigned long length;
412 unsigned long acked;
413 char buf[4]; /* you only need 5 bytes! */
414 unsigned char sofar; /* how much of the byte count received */
415 char from[NICKLEN]; /* [GET] user who offered the file */
416 FILE *f; /* pointer to file being sent/received */
417 unsigned int type; /* xfer connection type, see enum below */
418 unsigned short ack_type; /* type of ack */
419 unsigned long offset; /* offset from beginning of file, during
420 * resend. */
421 unsigned long block_pending; /* bytes of this DCC block which weren't
422 * sent yet. */
423 time_t start_time; /* Time when a xfer was started. */
424 };
425
426 enum { /* transfer connection handling a ... */
427 XFER_SEND, /* ... normal file-send to s.o. */
428 XFER_RESEND, /* ... file-resend to s.o. */
429 XFER_RESEND_PEND, /* ... (as above) and waiting for info */
430 XFER_RESUME, /* ... file-send-resume to s.o. */
431 XFER_RESUME_PEND, /* ... (as above) and waiting for conn */
432 XFER_GET /* ... file-get from s.o. */
433 };
434
435 enum {
436 XFER_ACK_UNKNOWN, /* We don't know how blocks are acked. */
437 XFER_ACK_WITH_OFFSET, /* Skipped data is also counted as
438 * received. */
439 XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack. */
440 };
441
442 struct bot_info {
443 char version[121]; /* channel/version info */
444 char linker[NOTENAMELEN + 1]; /* who requested this link */
445 int numver;
446 int port; /* base port */
447 int uff_flags; /* user file feature flags */
448 };
449
450 struct relay_info {
451 struct chat_info *chat;
452 int sock;
453 int port;
454 int old_status;
455 };
456
457 struct script_info {
458 struct dcc_table *type;
459 union {
460 struct chat_info *chat;
461 struct file_info *file;
462 void *other;
463 } u;
464 char command[121];
465 };
466
467 struct dns_info {
468 void (*dns_success) (int); /* is called if the dns request succeeds */
469 void (*dns_failure) (int); /* is called if it fails */
470 char *host; /* hostname */
471 char *cbuf; /* temporary buffer. Memory will be free'd
472 * as soon as dns_info is free'd */
473 char *cptr; /* temporary pointer */
474 IP ip; /* IP address */
475 int ibuf; /* temporary buffer for one integer */
476 char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
477 struct dcc_table *type; /* type of the dcc table we are making the
478 * lookup for */
479 };
480
481 /* Flags for dns_type. */
482 #define RES_HOSTBYIP 1 /* hostname to IP address */
483 #define RES_IPBYHOST 2 /* IP address to hostname */
484
485 struct dupwait_info {
486 int atr; /* the bots attributes */
487 struct chat_info *chat; /* holds current chat data */
488 };
489
490 /* Flags for dcc types. */
491 #define DCT_CHAT 0x00000001 /* this dcc type receives botnet
492 * chatter */
493 #define DCT_MASTER 0x00000002 /* received master chatter */
494 #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
495 #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
496 #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to
497 * in tcl */
498 #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
499 #define DCT_CANBOOT 0x00000040 /* can be booted */
500 #define DCT_GETNOTES DCT_CHAT /* can receive notes */
501 #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
502 #define DCT_FORKTYPE 0x00000100 /* a forking type */
503 #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
504 #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
505 #define DCT_FILESEND 0x00000800 /* a sending file transfer,
506 * getting = !this */
507 #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
508
509 /* For dcc chat & files. */
510 #define STAT_ECHO 0x00001 /* echo commands back? */
511 #define STAT_DENY 0x00002 /* bad username (ignore password & deny
512 * access) */
513 #define STAT_CHAT 0x00004 /* in file-system but may return */
514 #define STAT_TELNET 0x00008 /* connected via telnet */
515 #define STAT_PARTY 0x00010 /* only on party line via 'p' flag */
516 #define STAT_BOTONLY 0x00020 /* telnet on bots-only connect */
517 #define STAT_USRONLY 0x00040 /* telnet on users-only connect */
518 #define STAT_PAGE 0x00080 /* page output to the user */
519
520 /* For stripping out mIRC codes. */
521 #define STRIP_COLOR 0x00001 /* remove mIRC color codes */
522 #define STRIP_BOLD 0x00002 /* remove bold codes */
523 #define STRIP_REV 0x00004 /* remove reverse video codes */
524 #define STRIP_UNDER 0x00008 /* remove underline codes */
525 #define STRIP_ANSI 0x00010 /* remove ALL ANSI codes */
526 #define STRIP_BELLS 0x00020 /* remove ctrl-g's */
527 #define STRIP_ALL 0x0007F /* remove every damn thing! */
528
529 /* For dcc bot links. */
530 #define STAT_PINGED 0x00001 /* waiting for ping to return */
531 #define STAT_SHARE 0x00002 /* sharing user data with the bot */
532 #define STAT_CALLED 0x00004 /* this bot called me */
533 #define STAT_OFFERED 0x00008 /* offered her the user file */
534 #define STAT_SENDING 0x00010 /* in the process of sending a user list */
535 #define STAT_GETTING 0x00020 /* in the process of getting a user list */
536 #define STAT_WARNED 0x00040 /* warned him about unleaflike behavior */
537 #define STAT_LEAF 0x00080 /* this bot is a leaf only */
538 #define STAT_LINKING 0x00100 /* the bot is currently going through
539 * the linking stage */
540 #define STAT_AGGRESSIVE 0x00200 /* aggressively sharing with this bot */
541
542 /* Flags for listening sockets */
543 #define LSTN_PUBLIC 0x000001 /* No access restrictions */
544
545 /* chan & global */
546 #define FLOOD_PRIVMSG 0
547 #define FLOOD_NOTICE 1
548 #define FLOOD_CTCP 2
549 #define FLOOD_NICK 3
550 #define FLOOD_JOIN 4
551 #define FLOOD_KICK 5
552 #define FLOOD_DEOP 6
553
554 #define FLOOD_CHAN_MAX 7
555 #define FLOOD_GLOBAL_MAX 3
556
557 /* For local console: */
558 #define STDIN 0
559 #define STDOUT 1
560 #define STDERR 2
561
562 /* Structure for internal logs */
563 typedef struct {
564 char *filename;
565 unsigned int mask; /* what to send to this log */
566 char *chname; /* which channel */
567 char szlast[LOGLINELEN]; /* for 'Last message repeated n times'
568 * stuff in misc.c/putlog() <cybah> */
569 int repeats; /* number of times szLast has been repeated */
570 unsigned int flags; /* other flags <rtc> */
571 FILE *f; /* existing file */
572 } log_t;
573
574 /* Logfile display flags
575 */
576 #define LOG_MSGS 0x000001 /* m private msgs/notices/ctcps */
577 #define LOG_PUBLIC 0x000002 /* p public msgs/notices/ctcps */
578 #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
579 #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
580 #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
581 #define LOG_MISC 0x000020 /* o other misc bot things */
582 #define LOG_BOTS 0x000040 /* b bot notices */
583 #define LOG_RAW 0x000080 /* r raw server stuff coming in */
584 #define LOG_FILES 0x000100 /* x file transfer commands and stats */
585 #define LOG_LEV1 0x000200 /* 1 user log level */
586 #define LOG_LEV2 0x000400 /* 2 user log level */
587 #define LOG_LEV3 0x000800 /* 3 user log level */
588 #define LOG_LEV4 0x001000 /* 4 user log level */
589 #define LOG_LEV5 0x002000 /* 5 user log level */
590 #define LOG_LEV6 0x004000 /* 6 user log level */
591 #define LOG_LEV7 0x008000 /* 7 user log level */
592 #define LOG_LEV8 0x010000 /* 8 user log level */
593 #define LOG_SERV 0x020000 /* s server information */
594 #define LOG_DEBUG 0x040000 /* d debug */
595 #define LOG_WALL 0x080000 /* w wallops */
596 #define LOG_SRVOUT 0x100000 /* v server output */
597 #define LOG_BOTNET 0x200000 /* t botnet traffic */
598 #define LOG_BOTSHARE 0x400000 /* h share traffic */
599 #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
600
601 /* Internal logfile flags
602 */
603 #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
604
605 #define FILEDB_HIDE 1
606 #define FILEDB_UNHIDE 2
607 #define FILEDB_SHARE 3
608 #define FILEDB_UNSHARE 4
609
610 /* Socket flags:
611 */
612 #define SOCK_UNUSED 0x0001 /* empty socket */
613 #define SOCK_BINARY 0x0002 /* do not buffer input */
614 #define SOCK_LISTEN 0x0004 /* listening port */
615 #define SOCK_CONNECT 0x0008 /* connection attempt */
616 #define SOCK_NONSOCK 0x0010 /* used for file i/o on debug */
617 #define SOCK_STRONGCONN 0x0020 /* don't report success until sure */
618 #define SOCK_EOFD 0x0040 /* it EOF'd recently during a write */
619 #define SOCK_PROXYWAIT 0x0080 /* waiting for SOCKS traversal */
620 #define SOCK_PASS 0x0100 /* passed on; only notify in case
621 * of traffic */
622 #define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
623 #define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
624 #define SOCK_TCL 0x0800 /* tcl socket, don't do anything on it */
625
626 /* Flags to sock_has_data
627 */
628 enum {
629 SOCK_DATA_OUTGOING, /* Data in out-queue? */
630 SOCK_DATA_INCOMING /* Data in in-queue? */
631 };
632
633 /* Fake idx's for dprintf - these should be ridiculously large +ve nums
634 */
635 #define DP_STDOUT 0x7FF1
636 #define DP_LOG 0x7FF2
637 #define DP_SERVER 0x7FF3
638 #define DP_HELP 0x7FF4
639 #define DP_STDERR 0x7FF5
640 #define DP_MODE 0x7FF6
641 #define DP_MODE_NEXT 0x7FF7
642 #define DP_SERVER_NEXT 0x7FF8
643 #define DP_HELP_NEXT 0x7FF9
644
645 #define NORMAL 0
646 #define QUICK 1
647
648 /* Return codes for add_note */
649 #define NOTE_ERROR 0 /* error */
650 #define NOTE_OK 1 /* success */
651 #define NOTE_STORED 2 /* not online; stored */
652 #define NOTE_FULL 3 /* too many notes stored */
653 #define NOTE_TCL 4 /* tcl binding caught it */
654 #define NOTE_AWAY 5 /* away; stored */
655 #define NOTE_FWD 6 /* away; forwarded */
656 #define NOTE_REJECT 7 /* ignore mask matched */
657
658 #define STR_PROTECT 2
659 #define STR_DIR 1
660
661 #define HELP_DCC 1
662 #define HELP_TEXT 2
663 #define HELP_IRC 16
664
665 /* These are used by the net module to keep track of sockets and what's
666 * queued on them
667 */
668 struct sock_handler {
669 char *inbuf;
670 char *outbuf;
671 unsigned long outbuflen; /* Outbuf could be binary data */
672 unsigned long inbuflen; /* Inbuf could be binary data */
673 };
674
675 struct tclsock_handler {
676 int mask; /* desired events */
677 Tcl_FileProc *proc;
678 ClientData cd;
679 };
680
681 typedef struct sock_list {
682 int sock;
683 short flags;
684 union {
685 struct sock_handler sock;
686 struct tclsock_handler tclsock;
687 } handler;
688 } sock_list;
689
690 enum {
691 EGG_OPTION_SET = 1, /* Set option(s). */
692 EGG_OPTION_UNSET = 2 /* Unset option(s). */
693 };
694
695 /* Telnet codes. See "TELNET Protocol Specification" (RFC 854) and
696 * "TELNET Echo Option" (RFC 875) for details. */
697
698 /* Telnet commands */
699 #define TLN_AYT 246 /* Are You There */
700 #define TLN_WILL 251 /* Will */
701 #define TLN_WILL_C "\373"
702 #define TLN_WONT 252 /* Won't */
703 #define TLN_WONT_C "\374"
704 #define TLN_DO 253 /* Do */
705 #define TLN_DO_C "\375"
706 #define TLN_DONT 254 /* Don't */
707 #define TLN_DONT_C "\376"
708 #define TLN_IAC 255 /* Interpret As Command */
709 #define TLN_IAC_C "\377"
710
711 /* Telnet options */
712 #define TLN_ECHO 1 /* Echo (RFC 875) */
713 #define TLN_ECHO_C "\001"
714 #define TLN_STATUS 5 /* STATUS (RFC 859) */
715 #define TLN_STATUS_C "\005"
716
717 #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23