/[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.6.2.3 - (hide annotations) (download) (as text)
Fri Jun 22 23:37:42 2012 UTC (7 years, 3 months ago) by thommey
Branch: gettext
Changes since 1.6.2.2: +10 -9 lines
File MIME type: text/x-csrc
add stripcodes flag to strip italics and rename code for stripcodes o

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 thommey 1.6.2.3 * $Id: eggdrop.h,v 1.6.2.3 2012/06/22 23:37:42 thommey 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     #ifdef HAVE_UNISTD_H
90     # include <unistd.h>
91     #endif
92    
93     /* This allows us to make things a lot less messy in modules.c. */
94     #ifndef STATIC
95     # if !defined(MODULES_OK) || (!defined(MOD_USE_DL) && !defined(MOD_USE_SHL) && !defined(MOD_USE_DYLD) && !defined(MOD_USE_RLD) && !defined(MOD_USE_LOADER))
96     # include "Error: You can't compile with module support on this system (try make static)."
97     # else
98     # ifdef MOD_USE_DL
99     # ifndef HAVE_DLOPEN
100     # 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'."
101     # endif
102     # undef MOD_USE_SHL
103     # undef MOD_USE_DYLD
104     # undef MOD_USE_RLD
105     # undef MOD_USE_LOADER
106     # endif
107     # ifdef MOD_USE_SHL
108     # ifndef HAVE_SHL_LOAD
109     # 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'."
110     # endif
111     # undef MOD_USE_DL
112     # undef MOD_USE_DYLD
113     # undef MOD_USE_RLD
114     # undef MOD_USE_LOADER
115     # endif
116     # ifdef MOD_USE_DYLD
117     # ifndef HAVE_NSLINKMODULE
118     # 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'."
119     # endif
120     # undef MOD_USE_DL
121     # undef MOD_USE_SHL
122     # undef MOD_USE_RLD
123     # undef MOD_USE_LOADER
124     # endif
125     # ifdef MOD_USE_RLD
126     # ifndef HAVE_RLD_LOAD
127     # 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'."
128     # endif
129     # undef MOD_USE_DL
130     # undef MOD_USE_SHL
131     # undef MOD_USE_DYLD
132     # undef MOD_USE_LOADER
133     # endif
134     # ifdef MOD_USE_LOADER
135     # ifndef HAVE_LOAD
136     # 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'."
137     # endif
138     # undef MOD_USE_DL
139     # undef MOD_USE_SHL
140     # undef MOD_USE_DYLD
141     # undef MOD_USE_RLD
142     # endif
143     # endif
144     #endif
145    
146     #ifdef EGG_HANDLEN
147     # undef HANDLEN
148     # define HANDLEN EGG_HANDLEN
149     #endif
150    
151     #if (NICKMAX < 9) || (NICKMAX > 32)
152     # include "Error: Invalid NICKMAX value."
153     #endif
154    
155     #if (HANDLEN < 9) || (HANDLEN > 32)
156     # include "Error: Invalid HANDLEN value."
157     #endif
158    
159     #if HANDLEN > NICKMAX
160     # include "Error: HANDLEN must be <= NICKMAX."
161     #endif
162    
163     #ifdef HAVE_SYS_PARAM_H
164     # include <sys/param.h>
165     #endif
166    
167     /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
168     * Use 255 if we can't find anything else.
169     */
170     #ifndef NAME_MAX
171     # ifdef MAXNAMLEN
172     # define NAME_MAX MAXNAMLEN
173     # else
174     # define NAME_MAX 255
175     # endif
176     #endif
177    
178     /* Almost every module needs some sort of time thingy, so... */
179     #ifdef TIME_WITH_SYS_TIME
180     # include <sys/time.h>
181     # include <time.h>
182     #else
183     # ifdef HAVE_SYS_TIME_H
184     # include <sys/time.h>
185     # else
186     # include <time.h>
187     # endif
188     #endif
189    
190    
191     /* Yikes...who would have thought finding a usable random() would be so much
192     * trouble?
193     * Note: random(), rand(), and lrand48() are *not* thread safe.
194 pseudo 1.5 *
195     * QNX doesn't include random() and srandom() in libc.so, only in libc.a
196     * So we can only use these functions in static builds on QNX.
197 simple 1.1 */
198 pseudo 1.5 #if defined QNX_HACKS && defined MAKING_MODS
199     # undef HAVE_RANDOM
200     # undef HAVE_SRANDOM
201     #endif
202    
203 simple 1.1 #ifdef HAVE_RANDOM
204     /* On systems with random(), RANDOM_MAX may or may not be defined.
205     *
206     * If RANDOM_MAX isn't defined, we use 0x7FFFFFFF (2^31-1), or 2147483647
207     * since this follows the 4.3BSD and POSIX.1-2001 standards. This of course
208     * assumes random() uses a 32 bit long int type per the standards.
209     */
210     # ifndef RANDOM_MAX
211     # define RANDOM_MAX 0x7FFFFFFF /* random() -- 2^31-1 */
212     # endif
213     #else /* !HAVE_RANDOM */
214     /* This shouldn't exist in this case, but just to be safe... */
215     # ifdef RANDOM_MAX
216     # undef RANDOM_MAX
217     # endif
218     /* If we don't have random() it's safe to assume we also don't have
219     * srandom(), and we need both.
220     */
221     # ifdef HAVE_RAND
222     # define random() rand()
223     # define srandom(x) srand(x)
224     /* Depending on the system int size, RAND_MAX can be either 0x7FFFFFFF
225     * (2^31-1), or 2147483647 for a 32 bit int, or 0x7FFF (2^15-1), or
226     * 32767 for a 16 bit int. The standards only state that RAND_MAX must
227     * be _at least_ 32767 but some systems with 16 bit int define it as
228     * 32767. See: SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
229     */
230     # define RANDOM_MAX RAND_MAX /* rand() -- 2^31-1 or 2^15-1 */
231     # else /* !HAVE_RAND */
232     # ifdef HAVE_LRAND48
233     # define random() lrand48()
234     # define srandom(x) srand48(x)
235     /* For lrand48() we define RANDOM_MAX as 0x7FFFFFFF (2^31-1), or
236     * 2147483647 since this is what the SVr4 and POSIX.1-2001 standards
237     * call for. Note: SVID 3 declares these functions as obsolete and
238     * states rand() should be used instead.
239     */
240     # define RANDOM_MAX 0x7FFFFFFF /* lrand48() -- 2^31-1 */
241     # else /* !HAVE_LRAND48 */
242     # include "Error: Must define one of HAVE_RANDOM, HAVE_RAND, or HAVE_LRAND48"
243     # endif /* HAVE_LRAND48 */
244     # endif /* HAVE_RAND */
245     #endif /* HAVE_RANDOM */
246    
247    
248     /* Use high-order bits for getting the random integer. With a modern
249     * random() implmentation, modulo would probably be sufficient, but on
250     * systems lacking random(), it may just be a macro for an older rand()
251 pseudo 1.5 * function.
252 simple 1.1 */
253     #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
254    
255    
256     #ifndef HAVE_SIGACTION /* old "weird signals" */
257     # define sigaction sigvec
258     # ifndef sa_handler
259     # define sa_handler sv_handler
260     # define sa_mask sv_mask
261     # define sa_flags sv_flags
262     # endif
263     #endif
264    
265     #ifndef HAVE_SIGEMPTYSET
266     # define sigemptyset(x) ((*(int *)(x))=0)
267     #endif
268    
269     #ifndef HAVE_SOCKLEN_T
270     typedef int socklen_t;
271     #endif
272    
273 pseudo 1.6 #ifdef TLS
274     # include <openssl/ssl.h>
275     #endif
276    
277 simple 1.1 /*
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 pseudo 1.3 #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 simple 1.1 /* 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 pseudo 1.6 sockname_t sockname; /* IPv4/IPv6 sockaddr placeholder */
393 simple 1.1 unsigned int port;
394 pseudo 1.6 #ifdef TLS
395     int ssl;
396     #endif
397 simple 1.1 struct userrec *user;
398     char nick[NICKLEN];
399     char host[UHOSTLEN];
400     struct dcc_table *type;
401     time_t timeval; /* This is used for timeout checking. */
402     unsigned long status; /* A LOT of dcc types have status things; makes it more availabe. */
403     union {
404     struct chat_info *chat;
405     struct file_info *file;
406     struct edit_info *edit;
407     struct xfer_info *xfer;
408     struct bot_info *bot;
409     struct relay_info *relay;
410     struct script_info *script;
411     struct dns_info *dns;
412     struct dupwait_info *dupwait;
413     int ident_sock;
414     void *other;
415     } u; /* Special use depending on type */
416     };
417    
418     struct chat_info {
419     char *away; /* non-NULL if user is away */
420     int msgs_per_sec; /* used to stop flooding */
421     int con_flags; /* with console: what to show */
422     int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
423     char con_chan[81]; /* with console: what channel to view */
424     int channel; /* 0=party line, -1=off */
425     struct msgq *buffer; /* a buffer of outgoing lines
426     * (for .page cmd) */
427     int max_line; /* maximum lines at once */
428     int line_count; /* number of lines sent since last page */
429     int current_lines; /* number of lines total stored */
430     char *su_nick;
431     };
432    
433     struct file_info {
434     struct chat_info *chat;
435     char dir[161];
436     };
437    
438     struct xfer_info {
439     char *filename;
440     char *origname;
441     char dir[DIRLEN]; /* used when uploads go to the current dir */
442     unsigned long length;
443     unsigned long acked;
444     char buf[4]; /* you only need 5 bytes! */
445     unsigned char sofar; /* how much of the byte count received */
446     char from[NICKLEN]; /* [GET] user who offered the file */
447     FILE *f; /* pointer to file being sent/received */
448     unsigned int type; /* xfer connection type, see enum below */
449     unsigned short ack_type; /* type of ack */
450     unsigned long offset; /* offset from beginning of file, during
451     * resend. */
452     unsigned long block_pending; /* bytes of this DCC block which weren't
453     * sent yet. */
454     time_t start_time; /* Time when a xfer was started. */
455     };
456    
457     enum { /* transfer connection handling a ... */
458     XFER_SEND, /* ... normal file-send to s.o. */
459     XFER_RESEND, /* ... file-resend to s.o. */
460     XFER_RESEND_PEND, /* ... (as above) and waiting for info */
461     XFER_RESUME, /* ... file-send-resume to s.o. */
462     XFER_RESUME_PEND, /* ... (as above) and waiting for conn */
463     XFER_GET /* ... file-get from s.o. */
464     };
465    
466     enum {
467     XFER_ACK_UNKNOWN, /* We don't know how blocks are acked. */
468     XFER_ACK_WITH_OFFSET, /* Skipped data is also counted as
469     * received. */
470     XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack. */
471     };
472    
473     struct bot_info {
474     char version[121]; /* channel/version info */
475     char linker[NOTENAMELEN + 1]; /* who requested this link */
476     int numver;
477     int port; /* base port */
478     int uff_flags; /* user file feature flags */
479     };
480    
481     struct relay_info {
482     struct chat_info *chat;
483     int sock;
484     int port;
485     int old_status;
486     };
487    
488     struct script_info {
489     struct dcc_table *type;
490     union {
491     struct chat_info *chat;
492     struct file_info *file;
493     void *other;
494     } u;
495     char command[121];
496     };
497    
498     struct dns_info {
499     void (*dns_success) (int); /* is called if the dns request succeeds */
500     void (*dns_failure) (int); /* is called if it fails */
501     char *host; /* hostname */
502     char *cbuf; /* temporary buffer. Memory will be free'd
503     * as soon as dns_info is free'd */
504     char *cptr; /* temporary pointer */
505 pseudo 1.4 sockname_t *ip; /* pointer to sockname with ipv4/6 address */
506 simple 1.1 int ibuf; /* temporary buffer for one integer */
507     char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
508     struct dcc_table *type; /* type of the dcc table we are making the
509     * lookup for */
510     };
511    
512     /* Flags for dns_type. */
513     #define RES_HOSTBYIP 1 /* hostname to IP address */
514     #define RES_IPBYHOST 2 /* IP address to hostname */
515    
516     struct dupwait_info {
517     int atr; /* the bots attributes */
518     struct chat_info *chat; /* holds current chat data */
519     };
520    
521     /* Flags for dcc types. */
522     #define DCT_CHAT 0x00000001 /* this dcc type receives botnet
523     * chatter */
524     #define DCT_MASTER 0x00000002 /* received master chatter */
525     #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
526     #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
527     #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to
528     * in tcl */
529     #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
530     #define DCT_CANBOOT 0x00000040 /* can be booted */
531     #define DCT_GETNOTES DCT_CHAT /* can receive notes */
532     #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
533     #define DCT_FORKTYPE 0x00000100 /* a forking type */
534     #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
535     #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
536     #define DCT_FILESEND 0x00000800 /* a sending file transfer,
537     * getting = !this */
538     #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
539    
540     /* For dcc chat & files. */
541     #define STAT_ECHO 0x00001 /* echo commands back? */
542 pseudo 1.6 #define STAT_FPRINT 0x00002 /* fingerprint auth (ignore password &
543     * allow access) */
544 simple 1.1 #define STAT_CHAT 0x00004 /* in file-system but may return */
545     #define STAT_TELNET 0x00008 /* connected via telnet */
546     #define STAT_PARTY 0x00010 /* only on party line via 'p' flag */
547     #define STAT_BOTONLY 0x00020 /* telnet on bots-only connect */
548     #define STAT_USRONLY 0x00040 /* telnet on users-only connect */
549     #define STAT_PAGE 0x00080 /* page output to the user */
550    
551     /* For stripping out mIRC codes. */
552 thommey 1.6.2.3 #define STRIP_COLOR 0x00001 /* remove mIRC color codes */
553     #define STRIP_BOLD 0x00002 /* remove bold codes */
554     #define STRIP_REVERSE 0x00004 /* remove reverse video codes */
555     #define STRIP_UNDERLINE 0x00008 /* remove underline codes */
556     #define STRIP_ANSI 0x00010 /* remove ALL ANSI codes */
557     #define STRIP_BELLS 0x00020 /* remove ctrl-g's */
558     #define STRIP_ORDINARY 0x00040 /* remove ordinary codes */
559     #define STRIP_ITALICS 0x00080 /* remove italics codes */
560     #define STRIP_ALL 0x000FF /* remove every damn thing! */
561 simple 1.1
562     /* For dcc bot links. */
563     #define STAT_PINGED 0x00001 /* waiting for ping to return */
564     #define STAT_SHARE 0x00002 /* sharing user data with the bot */
565     #define STAT_CALLED 0x00004 /* this bot called me */
566     #define STAT_OFFERED 0x00008 /* offered her the user file */
567     #define STAT_SENDING 0x00010 /* in the process of sending a user list */
568     #define STAT_GETTING 0x00020 /* in the process of getting a user list */
569     #define STAT_WARNED 0x00040 /* warned him about unleaflike behavior */
570     #define STAT_LEAF 0x00080 /* this bot is a leaf only */
571     #define STAT_LINKING 0x00100 /* the bot is currently going through
572     * the linking stage */
573     #define STAT_AGGRESSIVE 0x00200 /* aggressively sharing with this bot */
574 pseudo 1.6 #ifdef TLS
575     #define STAT_STARTTLS 0x00400 /* have we sent a starttls request? */
576     #endif
577 simple 1.1
578     /* Flags for listening sockets */
579     #define LSTN_PUBLIC 0x000001 /* No access restrictions */
580    
581     /* chan & global */
582     #define FLOOD_PRIVMSG 0
583     #define FLOOD_NOTICE 1
584     #define FLOOD_CTCP 2
585     #define FLOOD_NICK 3
586     #define FLOOD_JOIN 4
587     #define FLOOD_KICK 5
588     #define FLOOD_DEOP 6
589    
590     #define FLOOD_CHAN_MAX 7
591     #define FLOOD_GLOBAL_MAX 3
592    
593     /* For local console: */
594     #define STDIN 0
595     #define STDOUT 1
596     #define STDERR 2
597    
598     /* Structure for internal logs */
599     typedef struct {
600     char *filename;
601     unsigned int mask; /* what to send to this log */
602     char *chname; /* which channel */
603     char szlast[LOGLINELEN]; /* for 'Last message repeated n times'
604     * stuff in misc.c/putlog() <cybah> */
605     int repeats; /* number of times szLast has been repeated */
606     unsigned int flags; /* other flags <rtc> */
607     FILE *f; /* existing file */
608     } log_t;
609    
610     /* Logfile display flags
611     */
612     #define LOG_MSGS 0x000001 /* m private msgs/notices/ctcps */
613     #define LOG_PUBLIC 0x000002 /* p public msgs/notices/ctcps */
614     #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
615     #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
616     #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
617     #define LOG_MISC 0x000020 /* o other misc bot things */
618     #define LOG_BOTS 0x000040 /* b bot notices */
619     #define LOG_RAW 0x000080 /* r raw server stuff coming in */
620     #define LOG_FILES 0x000100 /* x file transfer commands and stats */
621     #define LOG_LEV1 0x000200 /* 1 user log level */
622     #define LOG_LEV2 0x000400 /* 2 user log level */
623     #define LOG_LEV3 0x000800 /* 3 user log level */
624     #define LOG_LEV4 0x001000 /* 4 user log level */
625     #define LOG_LEV5 0x002000 /* 5 user log level */
626     #define LOG_LEV6 0x004000 /* 6 user log level */
627     #define LOG_LEV7 0x008000 /* 7 user log level */
628     #define LOG_LEV8 0x010000 /* 8 user log level */
629     #define LOG_SERV 0x020000 /* s server information */
630     #define LOG_DEBUG 0x040000 /* d debug */
631     #define LOG_WALL 0x080000 /* w wallops */
632     #define LOG_SRVOUT 0x100000 /* v server output */
633     #define LOG_BOTNET 0x200000 /* t botnet traffic */
634     #define LOG_BOTSHARE 0x400000 /* h share traffic */
635     #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
636    
637     /* Internal logfile flags
638     */
639     #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
640    
641     #define FILEDB_HIDE 1
642     #define FILEDB_UNHIDE 2
643     #define FILEDB_SHARE 3
644     #define FILEDB_UNSHARE 4
645    
646     /* Socket flags:
647     */
648     #define SOCK_UNUSED 0x0001 /* empty socket */
649     #define SOCK_BINARY 0x0002 /* do not buffer input */
650     #define SOCK_LISTEN 0x0004 /* listening port */
651     #define SOCK_CONNECT 0x0008 /* connection attempt */
652     #define SOCK_NONSOCK 0x0010 /* used for file i/o on debug */
653     #define SOCK_STRONGCONN 0x0020 /* don't report success until sure */
654     #define SOCK_EOFD 0x0040 /* it EOF'd recently during a write */
655     #define SOCK_PROXYWAIT 0x0080 /* waiting for SOCKS traversal */
656     #define SOCK_PASS 0x0100 /* passed on; only notify in case
657     * of traffic */
658     #define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
659     #define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
660     #define SOCK_TCL 0x0800 /* tcl socket, don't do anything on it */
661    
662     /* Flags to sock_has_data
663     */
664     enum {
665     SOCK_DATA_OUTGOING, /* Data in out-queue? */
666     SOCK_DATA_INCOMING /* Data in in-queue? */
667     };
668    
669     /* Fake idx's for dprintf - these should be ridiculously large +ve nums
670     */
671     #define DP_STDOUT 0x7FF1
672     #define DP_LOG 0x7FF2
673     #define DP_SERVER 0x7FF3
674     #define DP_HELP 0x7FF4
675     #define DP_STDERR 0x7FF5
676     #define DP_MODE 0x7FF6
677     #define DP_MODE_NEXT 0x7FF7
678     #define DP_SERVER_NEXT 0x7FF8
679     #define DP_HELP_NEXT 0x7FF9
680    
681     #define NORMAL 0
682     #define QUICK 1
683    
684     /* Return codes for add_note */
685     #define NOTE_ERROR 0 /* error */
686     #define NOTE_OK 1 /* success */
687     #define NOTE_STORED 2 /* not online; stored */
688     #define NOTE_FULL 3 /* too many notes stored */
689     #define NOTE_TCL 4 /* tcl binding caught it */
690     #define NOTE_AWAY 5 /* away; stored */
691     #define NOTE_FWD 6 /* away; forwarded */
692     #define NOTE_REJECT 7 /* ignore mask matched */
693    
694     #define STR_PROTECT 2
695     #define STR_DIR 1
696    
697     #define HELP_DCC 1
698     #define HELP_TEXT 2
699     #define HELP_IRC 16
700    
701 pseudo 1.6 #ifdef TLS
702     /* TLS generic flags */
703     # define TLS_LISTEN 0x80000000
704     # define TLS_CONNECT 0x40000000
705     # define TLS_DEPTH0 0x20000000
706    
707     /* TLS verification flags */
708     # define TLS_VERIFYPEER 0x00000001
709     # define TLS_VERIFYCN 0x00000002
710     # define TLS_VERIFYISSUER 0x00000004
711     # define TLS_VERIFYFROM 0x00000008
712     # define TLS_VERIFYTO 0x00000010
713     # define TLS_VERIFYREV 0x00000020
714    
715     /* Context information to attach to SSL sockets */
716     typedef struct {
717     int flags; /* listen/connect, generic ssl flags */
718     int verify; /* certificate validation mode */
719     int loglevel; /* log level to output TLS information to */
720     char host[256]; /* host or IP for certificate validation */
721     IntFunc cb;
722     } ssl_appdata;
723     #endif /* TLS */
724    
725 simple 1.1 /* These are used by the net module to keep track of sockets and what's
726     * queued on them
727     */
728     struct sock_handler {
729     char *inbuf;
730     char *outbuf;
731     unsigned long outbuflen; /* Outbuf could be binary data */
732     unsigned long inbuflen; /* Inbuf could be binary data */
733     };
734    
735     struct tclsock_handler {
736     int mask; /* desired events */
737     Tcl_FileProc *proc;
738     ClientData cd;
739     };
740    
741     typedef struct sock_list {
742     int sock;
743 pseudo 1.6 #ifdef TLS
744     SSL *ssl;
745     #endif
746 simple 1.1 short flags;
747     union {
748     struct sock_handler sock;
749     struct tclsock_handler tclsock;
750     } handler;
751     } sock_list;
752    
753     enum {
754     EGG_OPTION_SET = 1, /* Set option(s). */
755     EGG_OPTION_UNSET = 2 /* Unset option(s). */
756     };
757    
758     /* Telnet codes. See "TELNET Protocol Specification" (RFC 854) and
759     * "TELNET Echo Option" (RFC 875) for details. */
760    
761     /* Telnet commands */
762     #define TLN_AYT 246 /* Are You There */
763     #define TLN_WILL 251 /* Will */
764     #define TLN_WILL_C "\373"
765     #define TLN_WONT 252 /* Won't */
766     #define TLN_WONT_C "\374"
767     #define TLN_DO 253 /* Do */
768     #define TLN_DO_C "\375"
769     #define TLN_DONT 254 /* Don't */
770     #define TLN_DONT_C "\376"
771     #define TLN_IAC 255 /* Interpret As Command */
772     #define TLN_IAC_C "\377"
773    
774     /* Telnet options */
775     #define TLN_ECHO 1 /* Echo (RFC 875) */
776     #define TLN_ECHO_C "\001"
777     #define TLN_STATUS 5 /* STATUS (RFC 859) */
778     #define TLN_STATUS_C "\005"
779    
780     #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23