/[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.5 - (show annotations) (download) (as text)
Thu Oct 14 09:49:47 2010 UTC (8 years, 9 months ago) by pseudo
Branch: MAIN
Changes since 1.4: +10 -2 lines
File MIME type: text/x-csrc
Fixed dns.mod on QNX6/Mac OS X/Solaris
Rewrote dns.mod's autoconf checks to detect the resolver library properly on Darwin/Solaris.
Added -lsocket to the list of libraries, searched for res_* functions, in order to support QNX6.

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.4 2010/08/05 18:20:34 pseudo 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 * QNX doesn't include random() and srandom() in libc.so, only in libc.a
200 * So we can only use these functions in static builds on QNX.
201 */
202 #if defined QNX_HACKS && defined MAKING_MODS
203 # undef HAVE_RANDOM
204 # undef HAVE_SRANDOM
205 #endif
206
207 #ifdef HAVE_RANDOM
208 /* On systems with random(), RANDOM_MAX may or may not be defined.
209 *
210 * If RANDOM_MAX isn't defined, we use 0x7FFFFFFF (2^31-1), or 2147483647
211 * since this follows the 4.3BSD and POSIX.1-2001 standards. This of course
212 * assumes random() uses a 32 bit long int type per the standards.
213 */
214 # ifndef RANDOM_MAX
215 # define RANDOM_MAX 0x7FFFFFFF /* random() -- 2^31-1 */
216 # endif
217 #else /* !HAVE_RANDOM */
218 /* This shouldn't exist in this case, but just to be safe... */
219 # ifdef RANDOM_MAX
220 # undef RANDOM_MAX
221 # endif
222 /* If we don't have random() it's safe to assume we also don't have
223 * srandom(), and we need both.
224 */
225 # ifdef HAVE_RAND
226 # define random() rand()
227 # define srandom(x) srand(x)
228 /* Depending on the system int size, RAND_MAX can be either 0x7FFFFFFF
229 * (2^31-1), or 2147483647 for a 32 bit int, or 0x7FFF (2^15-1), or
230 * 32767 for a 16 bit int. The standards only state that RAND_MAX must
231 * be _at least_ 32767 but some systems with 16 bit int define it as
232 * 32767. See: SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
233 */
234 # define RANDOM_MAX RAND_MAX /* rand() -- 2^31-1 or 2^15-1 */
235 # else /* !HAVE_RAND */
236 # ifdef HAVE_LRAND48
237 # define random() lrand48()
238 # define srandom(x) srand48(x)
239 /* For lrand48() we define RANDOM_MAX as 0x7FFFFFFF (2^31-1), or
240 * 2147483647 since this is what the SVr4 and POSIX.1-2001 standards
241 * call for. Note: SVID 3 declares these functions as obsolete and
242 * states rand() should be used instead.
243 */
244 # define RANDOM_MAX 0x7FFFFFFF /* lrand48() -- 2^31-1 */
245 # else /* !HAVE_LRAND48 */
246 # include "Error: Must define one of HAVE_RANDOM, HAVE_RAND, or HAVE_LRAND48"
247 # endif /* HAVE_LRAND48 */
248 # endif /* HAVE_RAND */
249 #endif /* HAVE_RANDOM */
250
251
252 /* Use high-order bits for getting the random integer. With a modern
253 * random() implmentation, modulo would probably be sufficient, but on
254 * systems lacking random(), it may just be a macro for an older rand()
255 * function.
256 */
257 #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
258
259
260 #ifndef HAVE_SIGACTION /* old "weird signals" */
261 # define sigaction sigvec
262 # ifndef sa_handler
263 # define sa_handler sv_handler
264 # define sa_mask sv_mask
265 # define sa_flags sv_flags
266 # endif
267 #endif
268
269 #ifndef HAVE_SIGEMPTYSET
270 # define sigemptyset(x) ((*(int *)(x))=0)
271 #endif
272
273 #ifndef HAVE_SOCKLEN_T
274 typedef int socklen_t;
275 #endif
276
277 /*
278 * Handy aliases for memory tracking and core dumps
279 */
280
281 #define nmalloc(x) n_malloc((x),__FILE__,__LINE__)
282 #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
283 #define nfree(x) n_free((x),__FILE__,__LINE__)
284
285 #ifdef DEBUG_CONTEXT
286 # define Context eggContext(__FILE__, __LINE__, NULL)
287 # define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note)
288 #else
289 # define Context do {} while (0)
290 # define ContextNote(note) do {} while (0)
291 #endif
292
293 #ifdef DEBUG_ASSERT
294 # define Assert(expr) do { \
295 if (!(expr)) \
296 eggAssert(__FILE__, __LINE__, NULL); \
297 } while (0)
298 #else
299 # define Assert(expr) do {} while (0)
300 #endif
301
302 #ifndef COMPILING_MEM
303 # undef malloc
304 # define malloc(x) dont_use_old_malloc(x)
305 # undef free
306 # define free(x) dont_use_old_free(x)
307 #endif /* !COMPILING_MEM */
308
309 /* 32 bit type */
310 #if (SIZEOF_INT == 4)
311 typedef unsigned int u_32bit_t;
312 #else
313 # if (SIZEOF_LONG == 4)
314 typedef unsigned long u_32bit_t;
315 # else
316 # include "Error: Can't find 32bit type."
317 # endif
318 #endif
319
320 typedef unsigned short int u_16bit_t;
321 typedef unsigned char u_8bit_t;
322
323 /* IP type */
324 typedef u_32bit_t IP;
325
326 /* Debug logging macros */
327 #define debug0(x) putlog(LOG_DEBUG,"*",x)
328 #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
329 #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
330 #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
331 #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
332
333 /* These apparently are unsafe without recasting. */
334 #define egg_isdigit(x) isdigit((int) (unsigned char) (x))
335 #define egg_isxdigit(x) isxdigit((int) (unsigned char) (x))
336 #define egg_isascii(x) isascii((int) (unsigned char) (x))
337 #define egg_isspace(x) isspace((int) (unsigned char) (x))
338 #define egg_islower(x) islower((int) (unsigned char) (x))
339
340 /***********************************************************************/
341
342 /* It's used in so many places, let's put it here */
343 typedef intptr_t (*Function) ();
344 typedef int (*IntFunc) ();
345
346 #ifdef IPV6
347 #include "compat/in6.h"
348 #endif
349
350 #include <sys/socket.h>
351 #include <netinet/in.h>
352
353 typedef struct {
354 int family;
355 socklen_t addrlen;
356 union {
357 struct sockaddr sa;
358 struct sockaddr_in s4;
359 #ifdef IPV6
360 struct sockaddr_in6 s6;
361 #endif
362 } addr;
363 } sockname_t;
364
365 /* Public structure for the listening port map */
366 struct portmap {
367 int realport;
368 int mappedto;
369 struct portmap *next;
370 };
371
372 /* Public structure of all the dcc connections */
373 struct dcc_table {
374 char *name;
375 int flags;
376 void (*eof) (int);
377 void (*activity) (int, char *, int);
378 int *timeout_val;
379 void (*timeout) (int);
380 void (*display) (int, char *);
381 int (*expmem) (void *);
382 void (*kill) (int, void *);
383 void (*output) (int, char *, void *);
384 void (*outdone) (int);
385 };
386
387 struct userrec;
388
389 struct dcc_t {
390 long sock; /* This should be a long to keep 64-bit machines sane. */
391 IP addr; /* IP address in host network byte order. */
392 sockname_t sockname; /* IPv4/IPv6 sockaddr placeholder */
393 unsigned int port;
394 struct userrec *user;
395 char nick[NICKLEN];
396 char host[UHOSTLEN];
397 struct dcc_table *type;
398 time_t timeval; /* This is used for timeout checking. */
399 unsigned long status; /* A LOT of dcc types have status things; makes it more availabe. */
400 union {
401 struct chat_info *chat;
402 struct file_info *file;
403 struct edit_info *edit;
404 struct xfer_info *xfer;
405 struct bot_info *bot;
406 struct relay_info *relay;
407 struct script_info *script;
408 struct dns_info *dns;
409 struct dupwait_info *dupwait;
410 int ident_sock;
411 void *other;
412 } u; /* Special use depending on type */
413 };
414
415 struct chat_info {
416 char *away; /* non-NULL if user is away */
417 int msgs_per_sec; /* used to stop flooding */
418 int con_flags; /* with console: what to show */
419 int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
420 char con_chan[81]; /* with console: what channel to view */
421 int channel; /* 0=party line, -1=off */
422 struct msgq *buffer; /* a buffer of outgoing lines
423 * (for .page cmd) */
424 int max_line; /* maximum lines at once */
425 int line_count; /* number of lines sent since last page */
426 int current_lines; /* number of lines total stored */
427 char *su_nick;
428 };
429
430 struct file_info {
431 struct chat_info *chat;
432 char dir[161];
433 };
434
435 struct xfer_info {
436 char *filename;
437 char *origname;
438 char dir[DIRLEN]; /* used when uploads go to the current dir */
439 unsigned long length;
440 unsigned long acked;
441 char buf[4]; /* you only need 5 bytes! */
442 unsigned char sofar; /* how much of the byte count received */
443 char from[NICKLEN]; /* [GET] user who offered the file */
444 FILE *f; /* pointer to file being sent/received */
445 unsigned int type; /* xfer connection type, see enum below */
446 unsigned short ack_type; /* type of ack */
447 unsigned long offset; /* offset from beginning of file, during
448 * resend. */
449 unsigned long block_pending; /* bytes of this DCC block which weren't
450 * sent yet. */
451 time_t start_time; /* Time when a xfer was started. */
452 };
453
454 enum { /* transfer connection handling a ... */
455 XFER_SEND, /* ... normal file-send to s.o. */
456 XFER_RESEND, /* ... file-resend to s.o. */
457 XFER_RESEND_PEND, /* ... (as above) and waiting for info */
458 XFER_RESUME, /* ... file-send-resume to s.o. */
459 XFER_RESUME_PEND, /* ... (as above) and waiting for conn */
460 XFER_GET /* ... file-get from s.o. */
461 };
462
463 enum {
464 XFER_ACK_UNKNOWN, /* We don't know how blocks are acked. */
465 XFER_ACK_WITH_OFFSET, /* Skipped data is also counted as
466 * received. */
467 XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack. */
468 };
469
470 struct bot_info {
471 char version[121]; /* channel/version info */
472 char linker[NOTENAMELEN + 1]; /* who requested this link */
473 int numver;
474 int port; /* base port */
475 int uff_flags; /* user file feature flags */
476 };
477
478 struct relay_info {
479 struct chat_info *chat;
480 int sock;
481 int port;
482 int old_status;
483 };
484
485 struct script_info {
486 struct dcc_table *type;
487 union {
488 struct chat_info *chat;
489 struct file_info *file;
490 void *other;
491 } u;
492 char command[121];
493 };
494
495 struct dns_info {
496 void (*dns_success) (int); /* is called if the dns request succeeds */
497 void (*dns_failure) (int); /* is called if it fails */
498 char *host; /* hostname */
499 char *cbuf; /* temporary buffer. Memory will be free'd
500 * as soon as dns_info is free'd */
501 char *cptr; /* temporary pointer */
502 sockname_t *ip; /* pointer to sockname with ipv4/6 address */
503 int ibuf; /* temporary buffer for one integer */
504 char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
505 struct dcc_table *type; /* type of the dcc table we are making the
506 * lookup for */
507 };
508
509 /* Flags for dns_type. */
510 #define RES_HOSTBYIP 1 /* hostname to IP address */
511 #define RES_IPBYHOST 2 /* IP address to hostname */
512
513 struct dupwait_info {
514 int atr; /* the bots attributes */
515 struct chat_info *chat; /* holds current chat data */
516 };
517
518 /* Flags for dcc types. */
519 #define DCT_CHAT 0x00000001 /* this dcc type receives botnet
520 * chatter */
521 #define DCT_MASTER 0x00000002 /* received master chatter */
522 #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
523 #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
524 #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to
525 * in tcl */
526 #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
527 #define DCT_CANBOOT 0x00000040 /* can be booted */
528 #define DCT_GETNOTES DCT_CHAT /* can receive notes */
529 #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
530 #define DCT_FORKTYPE 0x00000100 /* a forking type */
531 #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
532 #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
533 #define DCT_FILESEND 0x00000800 /* a sending file transfer,
534 * getting = !this */
535 #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
536
537 /* For dcc chat & files. */
538 #define STAT_ECHO 0x00001 /* echo commands back? */
539 #define STAT_DENY 0x00002 /* bad username (ignore password & deny
540 * access) */
541 #define STAT_CHAT 0x00004 /* in file-system but may return */
542 #define STAT_TELNET 0x00008 /* connected via telnet */
543 #define STAT_PARTY 0x00010 /* only on party line via 'p' flag */
544 #define STAT_BOTONLY 0x00020 /* telnet on bots-only connect */
545 #define STAT_USRONLY 0x00040 /* telnet on users-only connect */
546 #define STAT_PAGE 0x00080 /* page output to the user */
547
548 /* For stripping out mIRC codes. */
549 #define STRIP_COLOR 0x00001 /* remove mIRC color codes */
550 #define STRIP_BOLD 0x00002 /* remove bold codes */
551 #define STRIP_REV 0x00004 /* remove reverse video codes */
552 #define STRIP_UNDER 0x00008 /* remove underline codes */
553 #define STRIP_ANSI 0x00010 /* remove ALL ANSI codes */
554 #define STRIP_BELLS 0x00020 /* remove ctrl-g's */
555 #define STRIP_ALL 0x0007F /* remove every damn thing! */
556
557 /* For dcc bot links. */
558 #define STAT_PINGED 0x00001 /* waiting for ping to return */
559 #define STAT_SHARE 0x00002 /* sharing user data with the bot */
560 #define STAT_CALLED 0x00004 /* this bot called me */
561 #define STAT_OFFERED 0x00008 /* offered her the user file */
562 #define STAT_SENDING 0x00010 /* in the process of sending a user list */
563 #define STAT_GETTING 0x00020 /* in the process of getting a user list */
564 #define STAT_WARNED 0x00040 /* warned him about unleaflike behavior */
565 #define STAT_LEAF 0x00080 /* this bot is a leaf only */
566 #define STAT_LINKING 0x00100 /* the bot is currently going through
567 * the linking stage */
568 #define STAT_AGGRESSIVE 0x00200 /* aggressively sharing with this bot */
569
570 /* Flags for listening sockets */
571 #define LSTN_PUBLIC 0x000001 /* No access restrictions */
572
573 /* chan & global */
574 #define FLOOD_PRIVMSG 0
575 #define FLOOD_NOTICE 1
576 #define FLOOD_CTCP 2
577 #define FLOOD_NICK 3
578 #define FLOOD_JOIN 4
579 #define FLOOD_KICK 5
580 #define FLOOD_DEOP 6
581
582 #define FLOOD_CHAN_MAX 7
583 #define FLOOD_GLOBAL_MAX 3
584
585 /* For local console: */
586 #define STDIN 0
587 #define STDOUT 1
588 #define STDERR 2
589
590 /* Structure for internal logs */
591 typedef struct {
592 char *filename;
593 unsigned int mask; /* what to send to this log */
594 char *chname; /* which channel */
595 char szlast[LOGLINELEN]; /* for 'Last message repeated n times'
596 * stuff in misc.c/putlog() <cybah> */
597 int repeats; /* number of times szLast has been repeated */
598 unsigned int flags; /* other flags <rtc> */
599 FILE *f; /* existing file */
600 } log_t;
601
602 /* Logfile display flags
603 */
604 #define LOG_MSGS 0x000001 /* m private msgs/notices/ctcps */
605 #define LOG_PUBLIC 0x000002 /* p public msgs/notices/ctcps */
606 #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
607 #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
608 #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
609 #define LOG_MISC 0x000020 /* o other misc bot things */
610 #define LOG_BOTS 0x000040 /* b bot notices */
611 #define LOG_RAW 0x000080 /* r raw server stuff coming in */
612 #define LOG_FILES 0x000100 /* x file transfer commands and stats */
613 #define LOG_LEV1 0x000200 /* 1 user log level */
614 #define LOG_LEV2 0x000400 /* 2 user log level */
615 #define LOG_LEV3 0x000800 /* 3 user log level */
616 #define LOG_LEV4 0x001000 /* 4 user log level */
617 #define LOG_LEV5 0x002000 /* 5 user log level */
618 #define LOG_LEV6 0x004000 /* 6 user log level */
619 #define LOG_LEV7 0x008000 /* 7 user log level */
620 #define LOG_LEV8 0x010000 /* 8 user log level */
621 #define LOG_SERV 0x020000 /* s server information */
622 #define LOG_DEBUG 0x040000 /* d debug */
623 #define LOG_WALL 0x080000 /* w wallops */
624 #define LOG_SRVOUT 0x100000 /* v server output */
625 #define LOG_BOTNET 0x200000 /* t botnet traffic */
626 #define LOG_BOTSHARE 0x400000 /* h share traffic */
627 #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
628
629 /* Internal logfile flags
630 */
631 #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
632
633 #define FILEDB_HIDE 1
634 #define FILEDB_UNHIDE 2
635 #define FILEDB_SHARE 3
636 #define FILEDB_UNSHARE 4
637
638 /* Socket flags:
639 */
640 #define SOCK_UNUSED 0x0001 /* empty socket */
641 #define SOCK_BINARY 0x0002 /* do not buffer input */
642 #define SOCK_LISTEN 0x0004 /* listening port */
643 #define SOCK_CONNECT 0x0008 /* connection attempt */
644 #define SOCK_NONSOCK 0x0010 /* used for file i/o on debug */
645 #define SOCK_STRONGCONN 0x0020 /* don't report success until sure */
646 #define SOCK_EOFD 0x0040 /* it EOF'd recently during a write */
647 #define SOCK_PROXYWAIT 0x0080 /* waiting for SOCKS traversal */
648 #define SOCK_PASS 0x0100 /* passed on; only notify in case
649 * of traffic */
650 #define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
651 #define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
652 #define SOCK_TCL 0x0800 /* tcl socket, don't do anything on it */
653
654 /* Flags to sock_has_data
655 */
656 enum {
657 SOCK_DATA_OUTGOING, /* Data in out-queue? */
658 SOCK_DATA_INCOMING /* Data in in-queue? */
659 };
660
661 /* Fake idx's for dprintf - these should be ridiculously large +ve nums
662 */
663 #define DP_STDOUT 0x7FF1
664 #define DP_LOG 0x7FF2
665 #define DP_SERVER 0x7FF3
666 #define DP_HELP 0x7FF4
667 #define DP_STDERR 0x7FF5
668 #define DP_MODE 0x7FF6
669 #define DP_MODE_NEXT 0x7FF7
670 #define DP_SERVER_NEXT 0x7FF8
671 #define DP_HELP_NEXT 0x7FF9
672
673 #define NORMAL 0
674 #define QUICK 1
675
676 /* Return codes for add_note */
677 #define NOTE_ERROR 0 /* error */
678 #define NOTE_OK 1 /* success */
679 #define NOTE_STORED 2 /* not online; stored */
680 #define NOTE_FULL 3 /* too many notes stored */
681 #define NOTE_TCL 4 /* tcl binding caught it */
682 #define NOTE_AWAY 5 /* away; stored */
683 #define NOTE_FWD 6 /* away; forwarded */
684 #define NOTE_REJECT 7 /* ignore mask matched */
685
686 #define STR_PROTECT 2
687 #define STR_DIR 1
688
689 #define HELP_DCC 1
690 #define HELP_TEXT 2
691 #define HELP_IRC 16
692
693 /* These are used by the net module to keep track of sockets and what's
694 * queued on them
695 */
696 struct sock_handler {
697 char *inbuf;
698 char *outbuf;
699 unsigned long outbuflen; /* Outbuf could be binary data */
700 unsigned long inbuflen; /* Inbuf could be binary data */
701 };
702
703 struct tclsock_handler {
704 int mask; /* desired events */
705 Tcl_FileProc *proc;
706 ClientData cd;
707 };
708
709 typedef struct sock_list {
710 int sock;
711 short flags;
712 union {
713 struct sock_handler sock;
714 struct tclsock_handler tclsock;
715 } handler;
716 } sock_list;
717
718 enum {
719 EGG_OPTION_SET = 1, /* Set option(s). */
720 EGG_OPTION_UNSET = 2 /* Unset option(s). */
721 };
722
723 /* Telnet codes. See "TELNET Protocol Specification" (RFC 854) and
724 * "TELNET Echo Option" (RFC 875) for details. */
725
726 /* Telnet commands */
727 #define TLN_AYT 246 /* Are You There */
728 #define TLN_WILL 251 /* Will */
729 #define TLN_WILL_C "\373"
730 #define TLN_WONT 252 /* Won't */
731 #define TLN_WONT_C "\374"
732 #define TLN_DO 253 /* Do */
733 #define TLN_DO_C "\375"
734 #define TLN_DONT 254 /* Don't */
735 #define TLN_DONT_C "\376"
736 #define TLN_IAC 255 /* Interpret As Command */
737 #define TLN_IAC_C "\377"
738
739 /* Telnet options */
740 #define TLN_ECHO 1 /* Echo (RFC 875) */
741 #define TLN_ECHO_C "\001"
742 #define TLN_STATUS 5 /* STATUS (RFC 859) */
743 #define TLN_STATUS_C "\005"
744
745 #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23