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

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

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


Revision 1.4 - (hide annotations) (download) (as text)
Thu Aug 5 18:20:34 2010 UTC (8 years, 11 months ago) by pseudo
Branch: MAIN
Changes since 1.3: +3 -3 lines
File MIME type: text/x-csrc
Replaced some tabs with spaces.

1 simple 1.1 /*
2     * eggdrop.h
3     * Eggdrop compile-time settings
4     *
5     * IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
6     *
7 pseudo 1.4 * $Id: eggdrop.h,v 1.3 2010/08/05 18:12:05 pseudo Exp $
8 simple 1.1 */
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 pseudo 1.2 #define HANDLEN 32 /* valid values 9->NICKMAX */
53 simple 1.1 #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 pseudo 1.3 #ifdef IPV6
339     #include "compat/in6.h"
340     #endif
341    
342     #include <sys/socket.h>
343     #include <netinet/in.h>
344    
345     typedef struct {
346     int family;
347     socklen_t addrlen;
348     union {
349     struct sockaddr sa;
350     struct sockaddr_in s4;
351     #ifdef IPV6
352     struct sockaddr_in6 s6;
353     #endif
354     } addr;
355     } sockname_t;
356    
357 simple 1.1 /* Public structure for the listening port map */
358     struct portmap {
359     int realport;
360     int mappedto;
361     struct portmap *next;
362     };
363    
364     /* Public structure of all the dcc connections */
365     struct dcc_table {
366     char *name;
367     int flags;
368     void (*eof) (int);
369     void (*activity) (int, char *, int);
370     int *timeout_val;
371     void (*timeout) (int);
372     void (*display) (int, char *);
373     int (*expmem) (void *);
374     void (*kill) (int, void *);
375     void (*output) (int, char *, void *);
376     void (*outdone) (int);
377     };
378    
379     struct userrec;
380    
381     struct dcc_t {
382     long sock; /* This should be a long to keep 64-bit machines sane. */
383     IP addr; /* IP address in host network byte order. */
384 pseudo 1.4 sockname_t sockname; /* IPv4/IPv6 sockaddr placeholder */
385 simple 1.1 unsigned int port;
386     struct userrec *user;
387     char nick[NICKLEN];
388     char host[UHOSTLEN];
389     struct dcc_table *type;
390     time_t timeval; /* This is used for timeout checking. */
391     unsigned long status; /* A LOT of dcc types have status things; makes it more availabe. */
392     union {
393     struct chat_info *chat;
394     struct file_info *file;
395     struct edit_info *edit;
396     struct xfer_info *xfer;
397     struct bot_info *bot;
398     struct relay_info *relay;
399     struct script_info *script;
400     struct dns_info *dns;
401     struct dupwait_info *dupwait;
402     int ident_sock;
403     void *other;
404     } u; /* Special use depending on type */
405     };
406    
407     struct chat_info {
408     char *away; /* non-NULL if user is away */
409     int msgs_per_sec; /* used to stop flooding */
410     int con_flags; /* with console: what to show */
411     int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
412     char con_chan[81]; /* with console: what channel to view */
413     int channel; /* 0=party line, -1=off */
414     struct msgq *buffer; /* a buffer of outgoing lines
415     * (for .page cmd) */
416     int max_line; /* maximum lines at once */
417     int line_count; /* number of lines sent since last page */
418     int current_lines; /* number of lines total stored */
419     char *su_nick;
420     };
421    
422     struct file_info {
423     struct chat_info *chat;
424     char dir[161];
425     };
426    
427     struct xfer_info {
428     char *filename;
429     char *origname;
430     char dir[DIRLEN]; /* used when uploads go to the current dir */
431     unsigned long length;
432     unsigned long acked;
433     char buf[4]; /* you only need 5 bytes! */
434     unsigned char sofar; /* how much of the byte count received */
435     char from[NICKLEN]; /* [GET] user who offered the file */
436     FILE *f; /* pointer to file being sent/received */
437     unsigned int type; /* xfer connection type, see enum below */
438     unsigned short ack_type; /* type of ack */
439     unsigned long offset; /* offset from beginning of file, during
440     * resend. */
441     unsigned long block_pending; /* bytes of this DCC block which weren't
442     * sent yet. */
443     time_t start_time; /* Time when a xfer was started. */
444     };
445    
446     enum { /* transfer connection handling a ... */
447     XFER_SEND, /* ... normal file-send to s.o. */
448     XFER_RESEND, /* ... file-resend to s.o. */
449     XFER_RESEND_PEND, /* ... (as above) and waiting for info */
450     XFER_RESUME, /* ... file-send-resume to s.o. */
451     XFER_RESUME_PEND, /* ... (as above) and waiting for conn */
452     XFER_GET /* ... file-get from s.o. */
453     };
454    
455     enum {
456     XFER_ACK_UNKNOWN, /* We don't know how blocks are acked. */
457     XFER_ACK_WITH_OFFSET, /* Skipped data is also counted as
458     * received. */
459     XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack. */
460     };
461    
462     struct bot_info {
463     char version[121]; /* channel/version info */
464     char linker[NOTENAMELEN + 1]; /* who requested this link */
465     int numver;
466     int port; /* base port */
467     int uff_flags; /* user file feature flags */
468     };
469    
470     struct relay_info {
471     struct chat_info *chat;
472     int sock;
473     int port;
474     int old_status;
475     };
476    
477     struct script_info {
478     struct dcc_table *type;
479     union {
480     struct chat_info *chat;
481     struct file_info *file;
482     void *other;
483     } u;
484     char command[121];
485     };
486    
487     struct dns_info {
488     void (*dns_success) (int); /* is called if the dns request succeeds */
489     void (*dns_failure) (int); /* is called if it fails */
490     char *host; /* hostname */
491     char *cbuf; /* temporary buffer. Memory will be free'd
492     * as soon as dns_info is free'd */
493     char *cptr; /* temporary pointer */
494 pseudo 1.4 sockname_t *ip; /* pointer to sockname with ipv4/6 address */
495 simple 1.1 int ibuf; /* temporary buffer for one integer */
496     char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
497     struct dcc_table *type; /* type of the dcc table we are making the
498     * lookup for */
499     };
500    
501     /* Flags for dns_type. */
502     #define RES_HOSTBYIP 1 /* hostname to IP address */
503     #define RES_IPBYHOST 2 /* IP address to hostname */
504    
505     struct dupwait_info {
506     int atr; /* the bots attributes */
507     struct chat_info *chat; /* holds current chat data */
508     };
509    
510     /* Flags for dcc types. */
511     #define DCT_CHAT 0x00000001 /* this dcc type receives botnet
512     * chatter */
513     #define DCT_MASTER 0x00000002 /* received master chatter */
514     #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
515     #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
516     #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to
517     * in tcl */
518     #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
519     #define DCT_CANBOOT 0x00000040 /* can be booted */
520     #define DCT_GETNOTES DCT_CHAT /* can receive notes */
521     #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
522     #define DCT_FORKTYPE 0x00000100 /* a forking type */
523     #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
524     #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
525     #define DCT_FILESEND 0x00000800 /* a sending file transfer,
526     * getting = !this */
527     #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
528    
529     /* For dcc chat & files. */
530     #define STAT_ECHO 0x00001 /* echo commands back? */
531     #define STAT_DENY 0x00002 /* bad username (ignore password & deny
532     * access) */
533     #define STAT_CHAT 0x00004 /* in file-system but may return */
534     #define STAT_TELNET 0x00008 /* connected via telnet */
535     #define STAT_PARTY 0x00010 /* only on party line via 'p' flag */
536     #define STAT_BOTONLY 0x00020 /* telnet on bots-only connect */
537     #define STAT_USRONLY 0x00040 /* telnet on users-only connect */
538     #define STAT_PAGE 0x00080 /* page output to the user */
539    
540     /* For stripping out mIRC codes. */
541     #define STRIP_COLOR 0x00001 /* remove mIRC color codes */
542     #define STRIP_BOLD 0x00002 /* remove bold codes */
543     #define STRIP_REV 0x00004 /* remove reverse video codes */
544     #define STRIP_UNDER 0x00008 /* remove underline codes */
545     #define STRIP_ANSI 0x00010 /* remove ALL ANSI codes */
546     #define STRIP_BELLS 0x00020 /* remove ctrl-g's */
547     #define STRIP_ALL 0x0007F /* remove every damn thing! */
548    
549     /* For dcc bot links. */
550     #define STAT_PINGED 0x00001 /* waiting for ping to return */
551     #define STAT_SHARE 0x00002 /* sharing user data with the bot */
552     #define STAT_CALLED 0x00004 /* this bot called me */
553     #define STAT_OFFERED 0x00008 /* offered her the user file */
554     #define STAT_SENDING 0x00010 /* in the process of sending a user list */
555     #define STAT_GETTING 0x00020 /* in the process of getting a user list */
556     #define STAT_WARNED 0x00040 /* warned him about unleaflike behavior */
557     #define STAT_LEAF 0x00080 /* this bot is a leaf only */
558     #define STAT_LINKING 0x00100 /* the bot is currently going through
559     * the linking stage */
560     #define STAT_AGGRESSIVE 0x00200 /* aggressively sharing with this bot */
561    
562     /* Flags for listening sockets */
563     #define LSTN_PUBLIC 0x000001 /* No access restrictions */
564    
565     /* chan & global */
566     #define FLOOD_PRIVMSG 0
567     #define FLOOD_NOTICE 1
568     #define FLOOD_CTCP 2
569     #define FLOOD_NICK 3
570     #define FLOOD_JOIN 4
571     #define FLOOD_KICK 5
572     #define FLOOD_DEOP 6
573    
574     #define FLOOD_CHAN_MAX 7
575     #define FLOOD_GLOBAL_MAX 3
576    
577     /* For local console: */
578     #define STDIN 0
579     #define STDOUT 1
580     #define STDERR 2
581    
582     /* Structure for internal logs */
583     typedef struct {
584     char *filename;
585     unsigned int mask; /* what to send to this log */
586     char *chname; /* which channel */
587     char szlast[LOGLINELEN]; /* for 'Last message repeated n times'
588     * stuff in misc.c/putlog() <cybah> */
589     int repeats; /* number of times szLast has been repeated */
590     unsigned int flags; /* other flags <rtc> */
591     FILE *f; /* existing file */
592     } log_t;
593    
594     /* Logfile display flags
595     */
596     #define LOG_MSGS 0x000001 /* m private msgs/notices/ctcps */
597     #define LOG_PUBLIC 0x000002 /* p public msgs/notices/ctcps */
598     #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
599     #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
600     #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
601     #define LOG_MISC 0x000020 /* o other misc bot things */
602     #define LOG_BOTS 0x000040 /* b bot notices */
603     #define LOG_RAW 0x000080 /* r raw server stuff coming in */
604     #define LOG_FILES 0x000100 /* x file transfer commands and stats */
605     #define LOG_LEV1 0x000200 /* 1 user log level */
606     #define LOG_LEV2 0x000400 /* 2 user log level */
607     #define LOG_LEV3 0x000800 /* 3 user log level */
608     #define LOG_LEV4 0x001000 /* 4 user log level */
609     #define LOG_LEV5 0x002000 /* 5 user log level */
610     #define LOG_LEV6 0x004000 /* 6 user log level */
611     #define LOG_LEV7 0x008000 /* 7 user log level */
612     #define LOG_LEV8 0x010000 /* 8 user log level */
613     #define LOG_SERV 0x020000 /* s server information */
614     #define LOG_DEBUG 0x040000 /* d debug */
615     #define LOG_WALL 0x080000 /* w wallops */
616     #define LOG_SRVOUT 0x100000 /* v server output */
617     #define LOG_BOTNET 0x200000 /* t botnet traffic */
618     #define LOG_BOTSHARE 0x400000 /* h share traffic */
619     #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
620    
621     /* Internal logfile flags
622     */
623     #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
624    
625     #define FILEDB_HIDE 1
626     #define FILEDB_UNHIDE 2
627     #define FILEDB_SHARE 3
628     #define FILEDB_UNSHARE 4
629    
630     /* Socket flags:
631     */
632     #define SOCK_UNUSED 0x0001 /* empty socket */
633     #define SOCK_BINARY 0x0002 /* do not buffer input */
634     #define SOCK_LISTEN 0x0004 /* listening port */
635     #define SOCK_CONNECT 0x0008 /* connection attempt */
636     #define SOCK_NONSOCK 0x0010 /* used for file i/o on debug */
637     #define SOCK_STRONGCONN 0x0020 /* don't report success until sure */
638     #define SOCK_EOFD 0x0040 /* it EOF'd recently during a write */
639     #define SOCK_PROXYWAIT 0x0080 /* waiting for SOCKS traversal */
640     #define SOCK_PASS 0x0100 /* passed on; only notify in case
641     * of traffic */
642     #define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
643     #define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
644     #define SOCK_TCL 0x0800 /* tcl socket, don't do anything on it */
645    
646     /* Flags to sock_has_data
647     */
648     enum {
649     SOCK_DATA_OUTGOING, /* Data in out-queue? */
650     SOCK_DATA_INCOMING /* Data in in-queue? */
651     };
652    
653     /* Fake idx's for dprintf - these should be ridiculously large +ve nums
654     */
655     #define DP_STDOUT 0x7FF1
656     #define DP_LOG 0x7FF2
657     #define DP_SERVER 0x7FF3
658     #define DP_HELP 0x7FF4
659     #define DP_STDERR 0x7FF5
660     #define DP_MODE 0x7FF6
661     #define DP_MODE_NEXT 0x7FF7
662     #define DP_SERVER_NEXT 0x7FF8
663     #define DP_HELP_NEXT 0x7FF9
664    
665     #define NORMAL 0
666     #define QUICK 1
667    
668     /* Return codes for add_note */
669     #define NOTE_ERROR 0 /* error */
670     #define NOTE_OK 1 /* success */
671     #define NOTE_STORED 2 /* not online; stored */
672     #define NOTE_FULL 3 /* too many notes stored */
673     #define NOTE_TCL 4 /* tcl binding caught it */
674     #define NOTE_AWAY 5 /* away; stored */
675     #define NOTE_FWD 6 /* away; forwarded */
676     #define NOTE_REJECT 7 /* ignore mask matched */
677    
678     #define STR_PROTECT 2
679     #define STR_DIR 1
680    
681     #define HELP_DCC 1
682     #define HELP_TEXT 2
683     #define HELP_IRC 16
684    
685     /* These are used by the net module to keep track of sockets and what's
686     * queued on them
687     */
688     struct sock_handler {
689     char *inbuf;
690     char *outbuf;
691     unsigned long outbuflen; /* Outbuf could be binary data */
692     unsigned long inbuflen; /* Inbuf could be binary data */
693     };
694    
695     struct tclsock_handler {
696     int mask; /* desired events */
697     Tcl_FileProc *proc;
698     ClientData cd;
699     };
700    
701     typedef struct sock_list {
702     int sock;
703     short flags;
704     union {
705     struct sock_handler sock;
706     struct tclsock_handler tclsock;
707     } handler;
708     } sock_list;
709    
710     enum {
711     EGG_OPTION_SET = 1, /* Set option(s). */
712     EGG_OPTION_UNSET = 2 /* Unset option(s). */
713     };
714    
715     /* Telnet codes. See "TELNET Protocol Specification" (RFC 854) and
716     * "TELNET Echo Option" (RFC 875) for details. */
717    
718     /* Telnet commands */
719     #define TLN_AYT 246 /* Are You There */
720     #define TLN_WILL 251 /* Will */
721     #define TLN_WILL_C "\373"
722     #define TLN_WONT 252 /* Won't */
723     #define TLN_WONT_C "\374"
724     #define TLN_DO 253 /* Do */
725     #define TLN_DO_C "\375"
726     #define TLN_DONT 254 /* Don't */
727     #define TLN_DONT_C "\376"
728     #define TLN_IAC 255 /* Interpret As Command */
729     #define TLN_IAC_C "\377"
730    
731     /* Telnet options */
732     #define TLN_ECHO 1 /* Echo (RFC 875) */
733     #define TLN_ECHO_C "\001"
734     #define TLN_STATUS 5 /* STATUS (RFC 859) */
735     #define TLN_STATUS_C "\005"
736    
737     #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23