/[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.11 - (show annotations) (download) (as text)
Sun Nov 28 18:07:09 1999 UTC (19 years, 9 months ago) by guppy
Branch: MAIN
Changes since 1.10: +1 -1 lines
File MIME type: text/x-csrc
more patches

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23