eggdrop.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /*
  2. * eggdrop.h
  3. * Eggdrop compile-time settings
  4. *
  5. * IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  6. *
  7. */
  8. #ifndef _EGG_EGGDROP_H
  9. #define _EGG_EGGDROP_H
  10. #ifdef HAVE_OPENSSL_SSL_H
  11. # ifndef SSL_INC
  12. # include <openssl/ssl.h>
  13. # include <openssl/rand.h>
  14. # include <openssl/err.h>
  15. # include <openssl/md5.h>
  16. # define SSL_INC
  17. # endif /* ! SSL_INC */
  18. # undef HAVE_SSL
  19. /* #define HAVE_SSL 1 */
  20. #endif /* HAVE_OPENSSL_SSL_H */
  21. /*
  22. * Enable IPv6 support?
  23. */
  24. #define USE_IPV6
  25. /*
  26. * Enable IPv6 debugging?
  27. */
  28. #define DEBUG_IPV6
  29. // If you undefine this, be ready for a good novel of errors. (Not Finished)
  30. #ifndef S_IRCNET
  31. #define S_IRCNET
  32. #endif
  33. /*
  34. * Undefine this to completely disable context debugging.
  35. * WARNING: DO NOT send in bug reports if you undefine this!
  36. */
  37. #define DEBUG_CONTEXT
  38. /*
  39. * Set the following to the timestamp for the logfile entries.
  40. * Popular times might be "[%H:%M]" (hour, min), or "[%H:%M:%S]" (hour, min, sec)
  41. * Read `man strftime' for more formatting options. Keep it below 32 chars.
  42. */
  43. #define LOG_TS "[%H:%M]"
  44. /*
  45. * HANDLEN note:
  46. * HANDLEN defines the maximum length a handle on the bot can be.
  47. * Standard (and minimum) is 9 characters long.
  48. *
  49. * Beware that using lengths over 9 chars is 'non-standard' and if
  50. * you wish to link to other bots, they _must_ both have the same
  51. * maximum handle length.
  52. *
  53. * NICKMAX note:
  54. * You should leave this at 32 characters and modify nick-len in the
  55. * configuration file instead.
  56. */
  57. #define HANDLEN 9 /* valid values 9->NICKMAX */
  58. #define NICKMAX 32 /* valid values HANDLEN->32 */
  59. /* Handy string lengths */
  60. #define UHOSTMAX 291 + NICKMAX /* 32 (ident) + 3 (\0, !, @) + NICKMAX */
  61. #define DIRMAX 512 /* paranoia */
  62. #define LOGLINEMAX 867 /* for misc.c/putlog() <cybah> */
  63. #define BADHANDCHARS "-,+*=:!.@#;$%&"
  64. #define MAX_BOTS 500
  65. #define SERVLEN 60
  66. #define SGRAB 2011 /* How much data to allow through sockets. */
  67. #define PRIV_OP 1
  68. #define PRIV_VOICE 2
  69. #define PRIO_DEOP 1
  70. #define PRIO_KICK 2
  71. #define KICK_BANNED 1
  72. #define KICK_KUSER 2
  73. #define KICK_KICKBAN 3
  74. #define KICK_MASSDEOP 4
  75. #define KICK_BADOP 5
  76. #define KICK_BADOPPED 6
  77. #define KICK_MANUALOP 7
  78. #define KICK_MANUALOPPED 8
  79. #define KICK_CLOSED 9
  80. #define KICK_FLOOD 10
  81. #define KICK_NICKFLOOD 11
  82. #define KICK_KICKFLOOD 12
  83. #define KICK_BOGUSUSERNAME 13
  84. #define KICK_MEAN 14
  85. #define KICK_BOGUSKEY 15
  86. #define ERR_BINSTAT 1
  87. #define ERR_BINMOD 2
  88. #define ERR_PASSWD 3
  89. #define ERR_WRONGBINDIR 4
  90. #define ERR_CONFSTAT 5
  91. #define ERR_TMPSTAT 6
  92. #define ERR_CONFDIRMOD 7
  93. #define ERR_CONFMOD 8
  94. #define ERR_TMPMOD 9
  95. #define ERR_NOCONF 10
  96. #define ERR_CONFBADENC 11
  97. #define ERR_WRONGUID 12
  98. #define ERR_WRONGUNAME 13
  99. #define ERR_BADCONF 14
  100. #define ERR_MAX 15
  101. /*
  102. * The 'configure' script should make this next part automatic,
  103. * so you shouldn't need to adjust anything below.
  104. */
  105. #define NICKLEN NICKMAX + 1
  106. #define UHOSTLEN UHOSTMAX + 1
  107. #define DIRLEN DIRMAX + 1
  108. #define LOGLINELEN LOGLINEMAX + 1
  109. #define NOTENAMELEN ((HANDLEN * 2) + 1)
  110. #define BADNICKCHARS "-,+*=:!.@#;$%&"
  111. /* Have to use a weird way to make the compiler error out cos not all
  112. * compilers support #error or error
  113. */
  114. #if !HAVE_VSPRINTF
  115. # include "error_you_need_vsprintf_to_compile_eggdrop"
  116. #endif
  117. /* IPv6 sanity checks. */
  118. #ifdef USE_IPV6
  119. # ifndef HAVE_IPV6
  120. # undef USE_IPV6
  121. # endif
  122. # ifndef HAVE_GETHOSTBYNAME2
  123. # ifndef HAVE_GETIPNODEBYNAME
  124. # undef USE_IPV6
  125. # endif
  126. # endif
  127. #endif
  128. #if HAVE_UNISTD_H
  129. # include <unistd.h>
  130. #endif
  131. #if !defined(STDC_HEADERS)
  132. # include "you_need_to_upgrade_your_compiler_to_a_standard_c_one_mate!"
  133. #endif
  134. #if (NICKMAX < 9) || (NICKMAX > 32)
  135. # include "invalid NICKMAX value"
  136. #endif
  137. #if (HANDLEN < 9) || (HANDLEN > 32)
  138. # include "invalid HANDLEN value"
  139. #endif
  140. #if HANDLEN > NICKMAX
  141. # include "HANDLEN MUST BE <= NICKMAX"
  142. #endif
  143. /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
  144. * Use 255 if we can't find anything else.
  145. */
  146. #ifndef NAME_MAX
  147. # ifdef MAXNAMLEN
  148. # define NAME_MAX MAXNAMLEN
  149. # else
  150. # define NAME_MAX 255
  151. # endif
  152. #endif
  153. /* Almost every module needs some sort of time thingy, so... */
  154. #if TIME_WITH_SYS_TIME
  155. # include <sys/time.h>
  156. # include <time.h>
  157. #else
  158. # if HAVE_SYS_TIME_H
  159. # include <sys/time.h>
  160. # else
  161. # include <time.h>
  162. # endif
  163. #endif
  164. #if !HAVE_SRANDOM
  165. # define srandom(x) srand(x)
  166. #endif
  167. #if !HAVE_RANDOM
  168. # define random() (rand()/16)
  169. #endif
  170. #if !HAVE_SIGACTION /* old "weird signals" */
  171. # define sigaction sigvec
  172. # ifndef sa_handler
  173. # define sa_handler sv_handler
  174. # define sa_mask sv_mask
  175. # define sa_flags sv_flags
  176. # endif
  177. #endif
  178. #if !HAVE_SIGEMPTYSET
  179. /* and they probably won't have sigemptyset, dammit */
  180. # define sigemptyset(x) ((*(int *)(x))=0)
  181. #endif
  182. #if !HAVE_SOCKLEN_T
  183. typedef int socklen_t;
  184. #endif
  185. /*
  186. * Handy aliases for memory tracking and core dumps
  187. */
  188. #define my_bzero(a, b) { char *x = (char *) a; int y = (int) b; while (y--) *x++ = 0; }
  189. #define nmalloc(x) n_malloc((x),__FILE__,__LINE__)
  190. #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
  191. #define nfree(x) n_free((x),__FILE__,__LINE__)
  192. #define killsock(x) real_killsock((x),__FILE__,__LINE__)
  193. #ifdef DEBUG_CONTEXT
  194. # define Context eggContext(__FILE__, __LINE__, NULL)
  195. # define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note)
  196. #else
  197. # define Context {}
  198. # define ContextNote(note) {}
  199. #endif
  200. #ifdef DEBUG_ASSERT
  201. # define Assert(expr) do { \
  202. if (!(expr)) \
  203. eggAssert(__FILE__, __LINE__, NULL); \
  204. } while (0)
  205. #else
  206. # define Assert(expr) do { } while (0)
  207. #endif
  208. #ifndef COMPILING_MEM
  209. # undef malloc
  210. # define malloc(x) dont_use_old_malloc(x)
  211. # undef free
  212. # define free(x) dont_use_old_free(x)
  213. # undef realloc
  214. # define realloc(x) dont_use_old_realloc(x)
  215. #endif /* !COMPILING_MEM */
  216. /* 32 bit type */
  217. #if (SIZEOF_INT == 4)
  218. typedef unsigned int u_32bit_t;
  219. #else
  220. # if (SIZEOF_LONG == 4)
  221. typedef unsigned long u_32bit_t;
  222. # else
  223. # include "cant/find/32bit/type"
  224. # endif
  225. #endif
  226. typedef unsigned short int u_16bit_t;
  227. typedef unsigned char u_8bit_t;
  228. /* IP type */
  229. typedef u_32bit_t IP;
  230. typedef u_32bit_t dword;
  231. #define debug0(x) putlog(LOG_DEBUG,"*",x)
  232. #define debug1(x,a1) putlog(LOG_DEBUG,"*",x,a1)
  233. #define debug2(x,a1,a2) putlog(LOG_DEBUG,"*",x,a1,a2)
  234. #define debug3(x,a1,a2,a3) putlog(LOG_DEBUG,"*",x,a1,a2,a3)
  235. #define debug4(x,a1,a2,a3,a4) putlog(LOG_DEBUG,"*",x,a1,a2,a3,a4)
  236. /***********************************************************************/
  237. /* It's used in so many places, let's put it here */
  238. typedef int (*Function) ();
  239. /* Public structure for the listening port map */
  240. struct portmap {
  241. int realport;
  242. int mappedto;
  243. struct portmap *next;
  244. };
  245. /* Public structure of all the dcc connections */
  246. struct dcc_table {
  247. char *name;
  248. int flags;
  249. void (*eof) (int);
  250. void (*activity) (int, char *, int);
  251. int *timeout_val;
  252. void (*timeout) ();
  253. void (*display) (int, char *);
  254. int (*expmem) (void *);
  255. void (*kill) (int, void *);
  256. void (*output) (int, char *, void *);
  257. void (*outdone) (int);
  258. };
  259. struct userrec;
  260. struct auth_t {
  261. struct userrec *user;
  262. char hash[33]; /* used for dcc authing */
  263. char nick[NICKLEN];
  264. char host[UHOSTLEN];
  265. int authed;
  266. int authing;
  267. time_t authtime; /* what time they authed at */
  268. time_t atime; /* when they last were active */
  269. };
  270. struct dcc_t {
  271. long sock; /* This should be a long to keep 64-bit
  272. machines sane */
  273. IP addr; /* IP address in host byte order */
  274. #ifdef USE_IPV6
  275. char addr6[121]; /* easier.. ipv6 address in regular notation (3ffe:80c0:225::) */
  276. #endif /* USE_IPV6 */
  277. unsigned int port;
  278. int ssl; /* use ssl on this dcc? */
  279. struct userrec *user;
  280. char simulbot[NICKLEN]; /* used for hub->leaf cmd simulation, holds bot that results should be sent to */
  281. time_t simultime; /* the time when the simul dcc is initiated, expires after a number of seconds */
  282. int simul; /* this will hold the idx on the remote bot to return result. */
  283. char hash[33]; /* used for dcc authing */
  284. char nick[NICKLEN];
  285. char host[UHOSTLEN];
  286. struct dcc_table *type;
  287. time_t timeval; /* Use for any timing stuff
  288. - this is used for timeout checking */
  289. time_t pingtime;
  290. unsigned long status; /* A LOT of dcc types have status
  291. thingos, this makes it more avaliabe */
  292. union {
  293. struct chat_info *chat;
  294. struct file_info *file;
  295. struct edit_info *edit;
  296. struct xfer_info *xfer;
  297. struct bot_info *bot;
  298. struct relay_info *relay;
  299. struct script_info *script;
  300. struct dns_info *dns;
  301. struct dupwait_info *dupwait;
  302. int ident_sock;
  303. void *other;
  304. } u; /* Special use depending on type */
  305. };
  306. struct chat_info {
  307. char *away; /* non-NULL if user is away */
  308. int msgs_per_sec; /* used to stop flooding */
  309. int con_flags; /* with console: what to show */
  310. int strip_flags; /* what codes to strip (b,r,u,c,a,g,*) */
  311. char con_chan[81]; /* with console: what channel to view */
  312. int channel; /* 0=party line, -1=off */
  313. struct msgq *buffer; /* a buffer of outgoing lines
  314. (for .page cmd) */
  315. int max_line; /* maximum lines at once */
  316. int line_count; /* number of lines sent since last page */
  317. int current_lines; /* number of lines total stored */
  318. char *su_nick;
  319. };
  320. #define CFGF_GLOBAL 1 /* Accessible as .config */
  321. #define CFGF_LOCAL 2 /* Accessible as .botconfig */
  322. typedef struct cfg_entry {
  323. char *name;
  324. int flags;
  325. char *gdata;
  326. char *ldata;
  327. void (*globalchanged) (struct cfg_entry *, char *oldval, int *valid);
  328. void (*localchanged) (struct cfg_entry *, char *oldval, int *valid);
  329. void (*describe) (struct cfg_entry *, int idx);
  330. } cfg_entry_T;
  331. struct file_info {
  332. struct chat_info *chat;
  333. char dir[161];
  334. };
  335. struct xfer_info {
  336. char *filename;
  337. char *origname;
  338. char dir[DIRLEN]; /* used when uploads go to the current dir */
  339. unsigned long length;
  340. unsigned long acked;
  341. char buf[4]; /* you only need 5 bytes! */
  342. unsigned char sofar; /* how much of the byte count received */
  343. char from[NICKLEN]; /* [GET] user who offered the file */
  344. FILE *f; /* pointer to file being sent/received */
  345. unsigned int type; /* xfer connection type, see enum below */
  346. unsigned short ack_type; /* type of ack */
  347. unsigned long offset; /* offset from beginning of file, during
  348. resend. */
  349. unsigned long block_pending; /* bytes of this DCC block which weren't
  350. sent yet. */
  351. time_t start_time; /* Time when a xfer was started. */
  352. };
  353. enum { /* transfer connection handling a ... */
  354. XFER_SEND, /* ... normal file-send to s.o. */
  355. XFER_RESEND, /* ... file-resend to s.o. */
  356. XFER_RESEND_PEND, /* ... (as above) and waiting for info */
  357. XFER_RESUME, /* ... file-send-resume to s.o. */
  358. XFER_RESUME_PEND, /* ... (as above) and waiting for conn */
  359. XFER_GET /* ... file-get from s.o. */
  360. };
  361. enum {
  362. XFER_ACK_UNKNOWN, /* We don't know how blocks are acked. */
  363. XFER_ACK_WITH_OFFSET, /* Skipped data is also counted as
  364. received. */
  365. XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack. */
  366. };
  367. struct bot_info {
  368. char version[121]; /* channel/version info */
  369. char linker[NOTENAMELEN + 1]; /* who requested this link */
  370. int numver;
  371. char sysname[121];
  372. int port; /* base port */
  373. int uff_flags; /* user file feature flags */
  374. };
  375. struct relay_info {
  376. struct chat_info *chat;
  377. int sock;
  378. int port;
  379. int old_status;
  380. };
  381. struct script_info {
  382. struct dcc_table *type;
  383. union {
  384. struct chat_info *chat;
  385. struct file_info *file;
  386. void *other;
  387. } u;
  388. char command[121];
  389. };
  390. #include <netinet/in.h>
  391. #include <sys/socket.h>
  392. #ifdef USE_IPV6
  393. #define SIZEOF_SOCKADDR(so) ((so).sa.sa_family == AF_INET6 ? sizeof(so.sin6) : sizeof(so.sin))
  394. #else
  395. #define SIZEOF_SOCKADDR(so) (sizeof(so.sin))
  396. #endif /* USE_IPV6 */
  397. #if !defined(IN6_IS_ADDR_V4MAPPED)
  398. # define IN6_IS_ADDR_V4MAPPED(a) \
  399. ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
  400. (((u_int32_t *) (a))[2] == htonl (0xffff)))
  401. #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
  402. union sockaddr_union {
  403. struct sockaddr sa;
  404. struct sockaddr_in sin;
  405. #ifdef USE_IPV6
  406. struct sockaddr_in6 sin6;
  407. #endif /* USE_IPV6 */
  408. };
  409. struct dns_info {
  410. void (*dns_success)(int); /* is called if the dns request succeeds */
  411. void (*dns_failure)(int); /* is called if it fails */
  412. char *host; /* hostname */
  413. char *cbuf; /* temporary buffer. Memory will be free'd
  414. as soon as dns_info is free'd */
  415. char *cptr; /* temporary pointer */
  416. IP ip; /* IP address */
  417. int ibuf; /* temporary buffer for one integer */
  418. char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
  419. struct dcc_table *type; /* type of the dcc table we are making the
  420. lookup for */
  421. };
  422. /* Flags for dns_type
  423. */
  424. #define RES_HOSTBYIP 1 /* hostname to IP address */
  425. #define RES_IPBYHOST 2 /* IP address to hostname */
  426. struct dupwait_info {
  427. int atr; /* the bots attributes */
  428. struct chat_info *chat; /* holds current chat data */
  429. };
  430. /* Flags about dcc types
  431. */
  432. #define DCT_CHAT 0x00000001 /* this dcc type receives botnet
  433. chatter */
  434. #define DCT_MASTER 0x00000002 /* received master chatter */
  435. #define DCT_SHOWWHO 0x00000004 /* show the user in .who */
  436. #define DCT_REMOTEWHO 0x00000008 /* show in remote who */
  437. #define DCT_VALIDIDX 0x00000010 /* valid idx for outputting to
  438. in tcl */
  439. #define DCT_SIMUL 0x00000020 /* can be tcl_simul'd */
  440. #define DCT_CANBOOT 0x00000040 /* can be booted */
  441. #define DCT_GETNOTES DCT_CHAT /* can receive notes */
  442. #define DCT_ 0x00000080 /* unused */
  443. #define DCT_FORKTYPE 0x00000100 /* a forking type */
  444. #define DCT_BOT 0x00000200 /* a bot connection of some sort... */
  445. #define DCT_FILETRAN 0x00000400 /* a file transfer of some sort */
  446. #define DCT_FILESEND 0x00000800 /* a sending file transfer,
  447. getting = !this */
  448. #define DCT_LISTEN 0x00001000 /* a listening port of some sort */
  449. /* For dcc chat & files:
  450. */
  451. #define STAT_ECHO 0x00001 /* echo commands back? */
  452. #define STAT_DENY 0x00002 /* bad username (ignore password & deny
  453. access) */
  454. #define STAT_CHAT 0x00004 /* in file-system but may return */
  455. #define STAT_TELNET 0x00008 /* connected via telnet */
  456. #define STAT_PARTY 0x00010 /* only on party line via 'p' flag */
  457. #define STAT_BOTONLY 0x00020 /* telnet on bots-only connect */
  458. #define STAT_USRONLY 0x00040 /* telnet on users-only connect */
  459. #define STAT_PAGE 0x00080 /* page output to the user */
  460. #define STAT_COLORM 0x00100 /* show crazy colors to user mIRC */
  461. #define STAT_COLORA 0x00200 /* show crazy colors to user ANSI */
  462. #define STAT_COLOR 0x00400 /* Color enabled for user */
  463. /* For stripping out mIRC codes
  464. */
  465. #define STRIP_COLOR 0x00001 /* remove mIRC color codes */
  466. #define STRIP_BOLD 0x00002 /* remove bold codes */
  467. #define STRIP_REV 0x00004 /* remove reverse video codes */
  468. #define STRIP_UNDER 0x00008 /* remove underline codes */
  469. #define STRIP_ANSI 0x00010 /* remove ALL ansi codes */
  470. #define STRIP_BELLS 0x00020 /* remote ctrl-g's */
  471. #define STRIP_ALL 0x00040 /* remove every damn thing! */
  472. /* for dcc bot links: */
  473. #define STAT_PINGED 0x00001 /* waiting for ping to return */
  474. #define STAT_SHARE 0x00002 /* sharing user data with the bot */
  475. #define STAT_CALLED 0x00004 /* this bot called me */
  476. #define STAT_OFFERED 0x00008 /* offered her the user file */
  477. #define STAT_SENDING 0x00010 /* in the process of sending a user list */
  478. #define STAT_GETTING 0x00020 /* in the process of getting a user list */
  479. #define STAT_WARNED 0x00040 /* warned him about unleaflike behavior */
  480. #define STAT_LEAF 0x00080 /* this bot is a leaf only */
  481. #define STAT_LINKING 0x00100 /* the bot is currently going through
  482. the linking stage */
  483. #define STAT_AGGRESSIVE 0x200 /* aggressively sharing with this bot */
  484. #define STAT_OFFEREDU 0x00400
  485. #define STAT_SENDINGU 0x00800
  486. #define STAT_GETTINGU 0x01000
  487. #define STAT_UPDATED 0x02000
  488. /* Flags for listening sockets
  489. */
  490. #define LSTN_PUBLIC 0x000001 /* No access restrictions */
  491. /* chan & global */
  492. #define FLOOD_PRIVMSG 0
  493. #define FLOOD_NOTICE 1
  494. #define FLOOD_CTCP 2
  495. #define FLOOD_NICK 3
  496. #define FLOOD_JOIN 4
  497. #define FLOOD_KICK 5
  498. #define FLOOD_DEOP 6
  499. #define FLOOD_CHAN_MAX 7
  500. #define FLOOD_GLOBAL_MAX 3
  501. /* For local console: */
  502. #define STDIN 0
  503. #define STDOUT 1
  504. #define STDERR 2
  505. #ifdef S_LASTCHECK
  506. #define DETECT_LOGIN 1
  507. #endif
  508. #ifdef S_ANTITRACE
  509. #define DETECT_TRACE 2
  510. #endif
  511. #ifdef S_PROMISC
  512. #define DETECT_PROMISC 3
  513. #endif
  514. #ifdef S_PROCESSCHECK
  515. #define DETECT_PROCESS 4
  516. #endif
  517. #ifdef S_HIJACKCHECK
  518. #define DETECT_SIGCONT 5
  519. #endif
  520. #define DET_IGNORE 0
  521. #define DET_WARN 1
  522. #define DET_REJECT 2
  523. #define DET_DIE 3
  524. #define DET_SUICIDE 4
  525. #define DET_NOCHECK 5
  526. #define CONNECT_SSL 1
  527. #define ACCEPT_SSL 2
  528. /* Structure for internal logs */
  529. typedef struct {
  530. char *filename;
  531. unsigned int mask; /* what to send to this log */
  532. char *chname; /* which channel */
  533. char szlast[LOGLINELEN]; /* for 'Last message repeated n times'
  534. stuff in misc.c/putlog() <cybah> */
  535. int repeats; /* number of times szLast has been repeated */
  536. unsigned int flags; /* other flags <rtc> */
  537. FILE *f; /* existing file */
  538. } log_t;
  539. /* Logfile display flags
  540. */
  541. #define LOG_MSGS 0x000001 /* m msgs/notice/ctcps */
  542. #define LOG_PUBLIC 0x000002 /* p public msg/notice/ctcps */
  543. #define LOG_JOIN 0x000004 /* j channel joins/parts/etc */
  544. #define LOG_MODES 0x000008 /* k mode changes/kicks/bans */
  545. #define LOG_CMDS 0x000010 /* c user dcc or msg commands */
  546. #define LOG_MISC 0x000020 /* o other misc bot things */
  547. #define LOG_BOTS 0x000040 /* b bot notices */
  548. #define LOG_RAW 0x000080 /* r raw server stuff coming in */
  549. #define LOG_FILES 0x000100 /* x file transfer commands and stats */
  550. #define LOG_ERRORS 0x000200 /* e misc errors */
  551. #define LOG_ERROR 0x000200 /* e misc errors */
  552. #define LOG_GETIN 0x000400 /* g op system. (Getin) */
  553. #define LOG_WARN 0x000800 /* u warnings */
  554. #define LOG_WARNING 0x000800 /* u warnings */
  555. //the rest of these can be used for new console modes....
  556. #define LOG_LEV4 0x001000 /* 4 user log level */
  557. #define LOG_LEV5 0x002000 /* 5 user log level */
  558. #define LOG_LEV6 0x004000 /* 6 user log level */
  559. #define LOG_LEV7 0x008000 /* 7 user log level */
  560. #define LOG_LEV8 0x010000 /* 8 user log level */
  561. #define LOG_SERV 0x020000 /* s server information */
  562. #define LOG_DEBUG 0x040000 /* d debug */
  563. #define LOG_WALL 0x080000 /* w wallops */
  564. #define LOG_SRVOUT 0x100000 /* v server output */
  565. #define LOG_BOTNET 0x200000 /* t botnet traffic */
  566. #define LOG_BOTSHARE 0x400000 /* h share traffic */
  567. #define LOG_ALL 0x7fffff /* (dump to all logfiles) */
  568. /* Internal logfile flags
  569. */
  570. #define LF_EXPIRING 0x000001 /* Logfile will be closed soon */
  571. #define FILEDB_HIDE 1
  572. #define FILEDB_UNHIDE 2
  573. #define FILEDB_SHARE 3
  574. #define FILEDB_UNSHARE 4
  575. /* Socket flags:
  576. */
  577. #define SOCK_UNUSED 0x0001 /* empty socket */
  578. #define SOCK_BINARY 0x0002 /* do not buffer input */
  579. #define SOCK_LISTEN 0x0004 /* listening port */
  580. #define SOCK_CONNECT 0x0008 /* connection attempt */
  581. #define SOCK_NONSOCK 0x0010 /* used for file i/o on debug */
  582. #define SOCK_STRONGCONN 0x0020 /* don't report success until sure */
  583. #define SOCK_EOFD 0x0040 /* it EOF'd recently during a write */
  584. #define SOCK_PROXYWAIT 0x0080 /* waiting for SOCKS traversal */
  585. #define SOCK_PASS 0x0100 /* passed on; only notify in case
  586. of traffic */
  587. #define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
  588. #define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
  589. /* Flags to sock_has_data
  590. */
  591. enum {
  592. SOCK_DATA_OUTGOING, /* Data in out-queue? */
  593. SOCK_DATA_INCOMING /* Data in in-queue? */
  594. };
  595. /* Fake idx's for dprintf - these should be ridiculously large +ve nums
  596. */
  597. #define DP_STDOUT 0x7FF1
  598. #define DP_LOG 0x7FF2
  599. #define DP_SERVER 0x7FF3
  600. #define DP_HELP 0x7FF4
  601. #define DP_STDERR 0x7FF5
  602. #define DP_MODE 0x7FF6
  603. #define DP_MODE_NEXT 0x7FF7
  604. #define DP_SERVER_NEXT 0x7FF8
  605. #define DP_HELP_NEXT 0x7FF9
  606. #define NORMAL 0
  607. #define QUICK 1
  608. /* Return codes for add_note */
  609. #define NOTE_ERROR 0 /* error */
  610. #define NOTE_OK 1 /* success */
  611. #define NOTE_STORED 2 /* not online; stored */
  612. #define NOTE_FULL 3 /* too many notes stored */
  613. #define NOTE_TCL 4 /* tcl binding caught it */
  614. #define NOTE_AWAY 5 /* away; stored */
  615. #define NOTE_FWD 6 /* away; forwarded */
  616. #define NOTE_REJECT 7 /* ignore mask matched */
  617. #define STR_PROTECT 2
  618. #define STR_DIR 1
  619. #define HELP_DCC 1
  620. #define HELP_TEXT 2
  621. #define HELP_IRC 16
  622. /* This is used by the net module to keep track of sockets and what's
  623. * queued on them
  624. */
  625. typedef struct {
  626. int sock;
  627. short flags;
  628. char *inbuf;
  629. char *outbuf;
  630. unsigned long outbuflen; /* Outbuf could be binary data */
  631. int encstatus, /* encrypted botlink */
  632. oseed,
  633. iseed;
  634. int gz; /* gzip compression */
  635. char okey[17];
  636. char ikey[17];
  637. unsigned long inbuflen; /* Inbuf could be binary data */
  638. #ifdef USE_IPV6
  639. unsigned int af;
  640. #endif /* USE_IPV6 */
  641. #ifdef HAVE_SSL
  642. SSL *ssl;
  643. #endif /* HAVE_SSL */
  644. } sock_list;
  645. #ifdef S_DCCPASS
  646. typedef struct cmd_pass {
  647. struct cmd_pass *next;
  648. char *name;
  649. char pass[25];
  650. } cmd_pass_t;
  651. #endif
  652. enum {
  653. EGG_OPTION_SET = 1, /* Set option(s). */
  654. EGG_OPTION_UNSET = 2 /* Unset option(s). */
  655. };
  656. /* Telnet codes. See "TELNET Protocol Specification" (RFC 854) and
  657. * "TELNET Echo Option" (RFC 875) for details.
  658. */
  659. #define TLN_AYT 246 /* Are You There */
  660. #define TLN_WILL 251 /* Will */
  661. #define TLN_WILL_C "\373"
  662. #define TLN_WONT 252 /* Won't */
  663. #define TLN_WONT_C "\374"
  664. #define TLN_DO 253 /* Do */
  665. #define TLN_DO_C "\375"
  666. #define TLN_DONT 254 /* Don't */
  667. #define TLN_DONT_C "\376"
  668. #define TLN_IAC 255 /* Interpret As Command */
  669. #define TLN_IAC_C "\377"
  670. #define TLN_ECHO 1 /* Echo */
  671. #define TLN_ECHO_C "\001"
  672. #endif /* _EGG_EGGDROP_H */