/[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.8 - (show annotations) (download) (as text)
Fri Jun 22 23:35:33 2012 UTC (7 years, 4 months ago) by thommey
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +10 -9 lines
File MIME type: text/x-csrc
add stripcodes flag to strip italics and rename code for stripcodes o

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23