/[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.3 - (show annotations) (download) (as text)
Thu Aug 26 08:54:41 1999 UTC (20 years ago) by guppy
Branch: MAIN
Changes since 1.2: +3 -0 lines
File MIME type: text/x-csrc
language fixes/changes

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23