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

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

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


Revision 1.19 - (show annotations) (download) (as text)
Mon Mar 20 19:50:02 2000 UTC (19 years, 5 months ago) by guppy
Branch: MAIN
CVS Tags: eggdrop104030RC2, eggdrop10403RC1, eggdrop10404, eggdrop10403, HEAD
Changes since 1.18: +2 -2 lines
File MIME type: text/x-csrc
RC1 here we come

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.18 2000/01/08 21:23:14 per Exp $
8 */
9 /*
10 * Copyright (C) 1997 Robey Pointer
11 * Copyright (C) 1999, 2000 Eggheads
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 /*
38 * Undefine this to completely disable context debugging.
39 * WARNING: DO NOT send in bug reports if you undefine this!
40 */
41 #define DEBUG_CONTEXT
42
43 /*
44 * define the maximum length a handle on the bot can be.
45 * (standard is 9 characters long)
46 * (DO NOT MAKE THIS VALUE LESS THAN 9 UNLESS YOU WANT TROUBLE!)
47 * (beware that using lengths over 9 chars is 'non-standard' and if you
48 * wish to link to other bots, they _must_ both have the same maximum
49 * handle length)
50 */
51
52 /* handy string lengths */
53
54 #define HANDLEN 9 /* valid values 9->NICKMAX */
55 #define BADHANDCHARS "-,+*=:!.@#;$%&"
56 #define NICKMAX 9 /* valid values HANDLEN->32 */
57 #define UHOSTMAX 160 /* reasonable, i think? */
58 #define DIRMAX 256 /* paranoia */
59 #define MAX_LOG_LINE 767 /* for misc.c/putlog() <cybah> */
60
61 /* language stuff */
62
63 #define LANGDIR "./language" /* language file directory */
64 #define BASELANG "english" /* language which always gets loaded before
65 all other languages. You don't want to
66 change this. */
67
68 /***********************************************************************/
69 /***** the 'configure' script should make this next part automatic *****/
70 /***********************************************************************/
71
72 #define NICKLEN NICKMAX + 1
73 #define UHOSTLEN UHOSTMAX + 1
74 #define DIRLEN DIRMAX + 1
75 #define NOTENAMELEN ((HANDLEN * 2) + 1)
76 #define BADNICKCHARS "-,+*=:!.@#;$%&"
77
78 /* have to use a weird way to make the compiler error out cos not all
79 * compilers support #error or error */
80 #if !HAVE_VSPRINTF
81 #include "error_you_need_vsprintf_to_compile_eggdrop"
82 #endif
83
84 #if HAVE_UNISTD_H
85 #include <unistd.h>
86 #endif
87
88 #ifndef STATIC
89 #if (!defined(MODULES_OK) || !defined(HAVE_DLOPEN)) && !defined(HPUX_HACKS)
90 #include "you_can't_compile_with_module_support_on_this_system_try_make_static"
91 #endif
92 #endif
93
94 #if !defined(STDC_HEADERS)
95 #include "you_need_to_upgrade_your_compiler_to_a_standard_c_one_mate!"
96 #endif
97
98 #if (NICKMAX < 9) || (NICKMAX > 32)
99 #include "invalid NICKMAX value"
100 #endif
101
102 #if (HANDLEN < 9) || (HANDLEN > 32)
103 #include "invalid HANDLEN value"
104 #endif
105
106 #if HANDLEN > NICKMAX
107 #include "HANDLEN MUST BE <= NICKMAX"
108 #endif
109
110 /* almost every module needs some sort of time thingy, so... */
111 #if TIME_WITH_SYS_TIME
112 #include <sys/time.h>
113 #include <time.h>
114 #else
115 #if HAVE_SYS_TIME_H
116 #include <sys/time.h>
117 #else
118 #include <time.h>
119 #endif
120 #endif
121
122 #if !HAVE_SRANDOM
123 #define srandom(x) srand(x)
124 #endif
125
126 #if !HAVE_RANDOM
127 #define random() (rand()/16)
128 #endif
129
130 #if !HAVE_SIGACTION /* old "weird signals" */
131 #define sigaction sigvec
132 #ifndef sa_handler
133 #define sa_handler sv_handler
134 #define sa_mask sv_mask
135 #define sa_flags sv_flags
136 #endif
137 #endif
138
139 #if !HAVE_SIGEMPTYSET
140 /* and they probably won't have sigemptyset, dammit */
141 #define sigemptyset(x) ((*(int *)(x))=0)
142 #endif
143
144 /* handy aliases for memory tracking and core dumps */
145 #define nmalloc(x) n_malloc((x),__FILE__,__LINE__)
146 #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
147 #define nfree(x) n_free((x),__FILE__,__LINE__)
148
149 #ifdef DEBUG_CONTEXT
150 # define Context eggContext(__FILE__, __LINE__, NULL)
151 # define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note)
152 #else
153 # define Context {}
154 # define ContextNote(note) {}
155 #endif
156
157 #ifdef DEBUG_ASSERT
158 # define Assert(expr) eggAssert(__FILE__, __LINE__, NULL, (int)(expr))
159 #else
160 # define Assert(expr) {}
161 #endif
162
163 #undef malloc
164 #define malloc(x) dont_use_old_malloc(x)
165 #undef free
166 #define free(x) dont_use_old_free(x)
167
168 /* 32 bit type */
169 #if (SIZEOF_INT == 4)
170 typedef unsigned int u_32bit_t;
171 #else
172 # if (SIZEOF_LONG == 4)
173 typedef unsigned long u_32bit_t;
174 # else
175 # include "cant/find/32bit/type"
176 # endif
177 #endif
178
179 #if (SIZEOF_SHORT_INT == 2)
180 typedef unsigned short int u_16bit_t;
181 #else
182 # include "cant/find/16bit/type"
183 #endif
184
185 #if (SIZEOF_CHAR == 1)
186 typedef unsigned char u_8bit_t;
187 #else
188 # include "cant/find/8bit/type"
189 #endif
190
191 typedef u_8bit_t byte;
192 typedef u_16bit_t word;
193 typedef u_32bit_t dword;
194
195 /* IP type */
196 typedef u_32bit_t IP;
197
198 #define debug0(x) putlog(LOG_DEBUG,"*",x)
199 #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
200 #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
201 #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
202 #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
203
204 /***********************************************************************/
205
206 /* public structure for the listening port map */
207 struct portmap {
208 int realport;
209 int mappedto;
210 struct portmap *next;
211 };
212
213 /* public structure of all the dcc connections */
214 struct dcc_table {
215 char *name;
216 int flags;
217 void (*eof) (int);
218 void (*activity) (int, char *, int);
219 int *timeout_val;
220 void (*timeout) ();
221 void (*display) (int, char *);
222 int (*expmem) (void *);
223 void (*kill) (int, void *);
224 void (*output) (int, char *, void *);
225 };
226
227 struct userrec;
228
229 struct dcc_t {
230 long sock; /* this should be a long to keep 64-bit
231 * machines sane */
232 IP addr; /* IP address in host byte order */
233 unsigned int port;
234 struct userrec *user;
235 char nick[NICKLEN];
236 char host[UHOSTLEN];
237 struct dcc_table *type;
238 time_t timeval; /* use for any timing stuff
239 * - this is used for timeout checking */
240 unsigned long status; /* A LOT of dcc types have status thingos,
241 * this makes it more avaliabe */
242 union {
243 struct chat_info *chat;
244 struct file_info *file;
245 struct edit_info *edit;
246 struct xfer_info *xfer;
247 struct bot_info *bot;
248 struct relay_info *relay;
249 struct script_info *script;
250 int ident_sock;
251 void *other;
252 } u; /* special use depending on type */
253 };
254
255 struct chat_info {
256 char *away; /* non-NULL if user is away */
257 int msgs_per_sec; /* used to stop flooding */
258 int con_flags; /* with console: what to show */
259 int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
260 char con_chan[81]; /* with console: what channel to view */
261 int channel; /* 0=party line, -1=off */
262 struct msgq *buffer; /* a buffer of outgoing lines (for .page cmd) */
263 int max_line; /* maximum lines at once */
264 int line_count; /* number of lines sent since last page */
265 int current_lines; /* number of lines total stored */
266 char *su_nick;
267 };
268
269 struct file_info {
270 struct chat_info *chat;
271 char dir[161];
272 };
273
274 struct xfer_info {
275 char filename[121];
276 char dir[121]; /* used when uploads go to the current dir */
277 unsigned long length;
278 unsigned long acked;
279 char buf[4]; /* you only need 5 bytes! */
280 unsigned char sofar; /* how much of the byte count received */
281 char from[NICKLEN]; /* [GET] user who offered the file */
282 FILE *f; /* pointer to file being sent/received */
283 };
284
285 struct bot_info {
286 char version[121]; /* channel/version info */
287 char linker[NOTENAMELEN + 1]; /* who requested this link */
288 int numver;
289 int port; /* base port */
290 };
291
292 struct relay_info {
293 struct chat_info *chat;
294 int sock;
295 int port;
296 int old_status;
297 };
298
299 struct script_info {
300 struct dcc_table *type;
301 union {
302 struct chat_info *chat;
303 struct file_info *file;
304 void *other;
305 } u;
306 char command[121];
307 };
308
309 /* flags about dcc types */
310 #define DCT_CHAT 0x00000001 /* this dcc type receives botnet chatter */
311 #define DCT_MASTER 0x00000002 /* received master chatter */
312 #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
313 #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
314 #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to in tcl */
315 #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
316 #define DCT_CANBOOT 0x00000040 /* can be booted */
317 #define DCT_GETNOTES DCT_CHAT /* can receive notes */
318 #define DCT_FILES 0x00000080 /* gratuitous hack ;) */
319 #define DCT_FORKTYPE 0x00000100 /* a forking type */
320 #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
321 #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
322 #define DCT_FILESEND 0x00000800 /* a sending file transfer, getting = !this */
323 #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
324
325 /* for dcc chat & files: */
326 #define STAT_ECHO 1 /* echo commands back? */
327 #define STAT_DENY 2 /* bad username (ignore password & deny access) */
328 /*#define STAT_XFER 4 has 'x' flag on chat line */
329 #define STAT_CHAT 8 /* in file-system but may return */
330 #define STAT_TELNET 16 /* connected via telnet */
331 #define STAT_PARTY 32 /* only on party line via 'p' flag */
332 #define STAT_BOTONLY 64 /* telnet on bots-only connect */
333 #define STAT_USRONLY 128 /* telnet on users-only connect */
334 #define STAT_PAGE 256 /* page output to the user */
335
336 /* for stripping out mIRC codes */
337 #define STRIP_COLOR 1 /* remove mIRC color codes */
338 #define STRIP_BOLD 2 /* remove bold codes */
339 #define STRIP_REV 4 /* remove reverse video codes */
340 #define STRIP_UNDER 8 /* remove underline codes */
341 #define STRIP_ANSI 16 /* remove ALL ansi codes */
342 #define STRIP_BELLS 32 /* remote ctrl-g's */
343 #define STRIP_ALL 63 /* remove every damn thing! */
344
345 /* for dcc bot links: */
346 #define STAT_PINGED 0x01 /* waiting for ping to return */
347 #define STAT_SHARE 0x02 /* sharing user data with the bot */
348 #define STAT_CALLED 0x04 /* this bot called me */
349 #define STAT_OFFERED 0x08 /* offered her the user file */
350 #define STAT_SENDING 0x10 /* in the process of sending a user list */
351 #define STAT_GETTING 0x20 /* in the process of getting a user list */
352 #define STAT_WARNED 0x40 /* warned him about unleaflike behavior */
353 #define STAT_LEAF 0x80 /* this bot is a leaf only */
354 #define STAT_LINKING 0x100 /* the bot is currently going through the
355 * linking stage */
356 #define STAT_AGGRESSIVE 0x200 /* aggressively sharing with this bot */
357
358 /* chan & global */
359 #define FLOOD_PRIVMSG 0
360 #define FLOOD_NOTICE 1
361 #define FLOOD_CTCP 2
362 #define FLOOD_NICK 3
363 #define FLOOD_JOIN 4
364 #define FLOOD_KICK 5
365 #define FLOOD_DEOP 6
366 #define FLOOD_CHAN_MAX 7
367 #define FLOOD_GLOBAL_MAX 3
368
369 /* for local console: */
370 #define STDIN 0
371 #define STDOUT 1
372 #define STDERR 2
373
374 /* structure for internal logs */
375 typedef struct {
376 char *filename;
377 unsigned int mask; /* what to send to this log */
378 char *chname; /* which channel */
379 char szLast[MAX_LOG_LINE + 1]; /* for 'Last message repeated n times'
380 * stuff in misc.c/putlog() <cybah> */
381 int Repeats; /* number of times szLast has been repeated */
382 unsigned int flags; /* other flags <rtc> */
383 FILE *f; /* existing file */
384 } log_t;
385
386 /* logfile display flags */
387 #define LOG_MSGS 0x000001 /* m msgs/notice/ctcps */
388 #define LOG_PUBLIC 0x000002 /* p public msg/notice/ctcps */
389 #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
390 #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
391 #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
392 #define LOG_MISC 0x000020 /* o other misc bot things */
393 #define LOG_BOTS 0x000040 /* b bot notices */
394 #define LOG_RAW 0x000080 /* r raw server stuff coming in */
395 #define LOG_FILES 0x000100 /* x file transfer commands and stats */
396 #define LOG_LEV1 0x000200 /* 1 user log level */
397 #define LOG_LEV2 0x000400 /* 2 user log level */
398 #define LOG_LEV3 0x000800 /* 3 user log level */
399 #define LOG_LEV4 0x001000 /* 4 user log level */
400 #define LOG_LEV5 0x002000 /* 5 user log level */
401 #define LOG_LEV6 0x004000 /* 6 user log level */
402 #define LOG_LEV7 0x008000 /* 7 user log level */
403 #define LOG_LEV8 0x010000 /* 8 user log level */
404 #define LOG_SERV 0x020000 /* s server information */
405 #define LOG_DEBUG 0x040000 /* d debug */
406 #define LOG_WALL 0x080000 /* w wallops */
407 #define LOG_SRVOUT 0x100000 /* v server output */
408 #define LOG_BOTNET 0x200000 /* t botnet traffic */
409 #define LOG_BOTSHARE 0x400000 /* h share traffic */
410 #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
411 /* internal logfile flags */
412 #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
413
414 #define FILEDB_HIDE 1
415 #define FILEDB_UNHIDE 2
416 #define FILEDB_SHARE 3
417 #define FILEDB_UNSHARE 4
418
419 /* socket flags: */
420 #define SOCK_UNUSED 0x001 /* empty socket */
421 #define SOCK_BINARY 0x002 /* do not buffer input */
422 #define SOCK_LISTEN 0x004 /* listening port */
423 #define SOCK_CONNECT 0x008 /* connection attempt */
424 #define SOCK_NONSOCK 0x010 /* used for file i/o on debug */
425 #define SOCK_STRONGCONN 0x020 /* don't report success until sure */
426 #define SOCK_EOFD 0x040 /* it EOF'd recently during a write */
427 #define SOCK_PROXYWAIT 0x080 /* waiting for SOCKS traversal */
428
429 /* fake idx's for dprintf - these should be ridiculously large +ve nums */
430 #define DP_STDOUT 0x7FF1
431 #define DP_LOG 0x7FF2
432 #define DP_SERVER 0x7FF3
433 #define DP_HELP 0x7FF4
434 #define DP_STDERR 0x7FF5
435 #define DP_MODE 0x7FF6
436
437 #define NORMAL 0
438 #define QUICK 1
439
440 /* return codes for add_note */
441 #define NOTE_ERROR 0 /* error */
442 #define NOTE_OK 1 /* success */
443 #define NOTE_STORED 2 /* not online; stored */
444 #define NOTE_FULL 3 /* too many notes stored */
445 #define NOTE_TCL 4 /* tcl binding caught it */
446 #define NOTE_AWAY 5 /* away; stored */
447 #define NOTE_FWD 6 /* away; forwarded */
448 #define NOTE_REJECT 7 /* ignore mask matched */
449
450 #define STR_PROTECT 2
451 #define STR_DIR 1
452
453 #define HELP_DCC 1
454 #define HELP_TEXT 2
455 #define HELP_IRC 16
456
457 /* it's used in so many places, let's put it here */
458 typedef int (*Function) ();
459
460 /* this is used by the net module to keep track of sockets and what's
461 * queued on them */
462 typedef struct {
463 int sock;
464 char flags;
465 char *inbuf;
466 char *outbuf;
467 unsigned long outbuflen; /* outbuf could be binary data */
468 } sock_list;
469
470 #endif /* _EGG_EGGDROP_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23