eggdrop.h 23 KB

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