Преглед изворни кода

* Cleared out eggdrop.h, just need to merge eggmain.h to eggdrop.h now

svn: 640
Bryan Drewery пре 22 година
родитељ
комит
ab16af6526

+ 1 - 0
src/auth.c

@@ -7,6 +7,7 @@
 #include "eggmain.h"
 #include "eggmain.h"
 #include "auth.h"
 #include "auth.h"
 #include "misc.h"
 #include "misc.h"
+#include "types.h"
 #include "users.h"
 #include "users.h"
 #include "crypt.h"
 #include "crypt.h"
 #include <sys/stat.h>
 #include <sys/stat.h>

+ 13 - 0
src/auth.h

@@ -1,6 +1,19 @@
 #ifndef _AUTH_H
 #ifndef _AUTH_H
 #define _AUTH_H
 #define _AUTH_H
 
 
+#include "crypt.h"
+
+struct auth_t {
+  struct userrec *user;
+  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
+  char nick[NICKLEN];
+  char host[UHOSTLEN];
+  int authed;
+  int authing;
+  time_t authtime;       /* what time they authed at */
+  time_t atime;          /* when they last were active */
+};
+
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
 int new_auth();
 int new_auth();
 int findauth(char *);
 int findauth(char *);

+ 10 - 0
src/botmsg.h

@@ -4,6 +4,16 @@
 #include "eggmain.h"
 #include "eggmain.h"
 #include "cfg.h"
 #include "cfg.h"
 
 
+/* Return codes for add_note */
+#define NOTE_ERROR      0       /* error                        */
+#define NOTE_OK         1       /* success                      */
+#define NOTE_STORED     2       /* not online; stored           */
+#define NOTE_FULL       3       /* too many notes stored        */
+#define NOTE_TCL        4       /* tcl binding caught it        */
+#define NOTE_AWAY       5       /* away; stored                 */
+#define NOTE_FWD        6       /* away; forwarded              */
+
+
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
 void botnet_send_cfg(int idx, struct cfg_entry *entry);
 void botnet_send_cfg(int idx, struct cfg_entry *entry);
 void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
 void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);

+ 11 - 0
src/cmds.h

@@ -1,6 +1,8 @@
 #ifndef _CMDS_H
 #ifndef _CMDS_H
 #define _CMDS_H
 #define _CMDS_H
 
 
+#include "types.h"
+
 typedef struct {
 typedef struct {
   char          *name;
   char          *name;
   char          *flags;
   char          *flags;
@@ -14,6 +16,15 @@ typedef struct {
   Function func;
   Function func;
 } botcmd_t;
 } botcmd_t;
 
 
+#ifdef S_DCCPASS
+typedef struct cmd_pass {
+  struct cmd_pass *next;
+  char *name;
+  char pass[25];
+} cmd_pass_t;
+#endif
+
+
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
 int check_dcc_attrs(struct userrec *, int);
 int check_dcc_attrs(struct userrec *, int);
 int check_dcc_chanattrs(struct userrec *, char *, int, int);
 int check_dcc_chanattrs(struct userrec *, char *, int, int);

+ 10 - 0
src/compat/compat.h

@@ -15,5 +15,15 @@
 #include "strcasecmp.h"
 #include "strcasecmp.h"
 #include "strftime.h"
 #include "strftime.h"
 
 
+
+/* These apparently are unsafe without recasting. */
+#define egg_isdigit(x)  isdigit((int)  (unsigned char) (x))
+#define egg_isxdigit(x) isxdigit((int) (unsigned char) (x))
+#define egg_isascii(x)  isascii((int)  (unsigned char) (x))
+#define egg_isspace(x)  isspace((int)  (unsigned char) (x))
+#define egg_islower(x)  islower((int)  (unsigned char) (x))
+#define egg_isupper(x)  isupper((int)  (unsigned char) (x))
+
+
 #endif /* !__EGG_COMPAT_COMPAT_H */
 #endif /* !__EGG_COMPAT_COMPAT_H */
 
 

+ 205 - 0
src/dcc.h

@@ -1,6 +1,211 @@
 #ifndef _DCC_H
 #ifndef _DCC_H
 #define _DCC_H
 #define _DCC_H
 
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "types.h"
+#include "crypt.h"
+#include "eggdrop.h"
+#include "dns.h"
+
+/* Public structure of all the dcc connections */
+struct dcc_table {
+  char *name;
+  int flags;
+  void (*eof) (int);
+  void (*activity) (int, char *, int);
+  int *timeout_val;
+  void (*timeout) ();
+  void (*display) (int, char *);
+  void (*kill) (int, void *);
+  void (*output) (int, char *, void *);
+  void (*outdone) (int);
+};
+
+
+struct dcc_t {
+  long sock;                    /* This should be a long to keep 64-bit
+                                   machines sane                         */
+  IP addr;                      /* IP address in host byte order         */
+#ifdef USE_IPV6
+  char addr6[121];              /* easier.. ipv6 address in regular notation (3ffe:80c0:225::) */
+#endif /* USE_IPV6 */
+  unsigned int port;
+  int ssl;                      /* use ssl on this dcc? */
+  struct userrec *user;
+  char simulbot[NICKLEN];       /* used for hub->leaf cmd simulation, holds bot that results should be sent to */
+  time_t simultime;             /* the time when the simul dcc is initiated, expires after a number of seconds */
+  int simul;                    /* this will hold the idx on the remote bot to return result. */
+  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
+  char nick[NICKLEN];
+  char host[UHOSTLEN];
+  struct dcc_table *type;
+  time_t timeval;               /* Use for any timing stuff
+                                   - this is used for timeout checking  */
+  time_t pingtime;
+  unsigned long status;         /* A LOT of dcc types have status
+                                   thingos, this makes it more avaliabe */
+  union {
+    struct chat_info *chat;
+    struct file_info *file;
+    struct edit_info *edit;
+    struct xfer_info *xfer;
+    struct bot_info *bot;
+    struct relay_info *relay;
+    struct dns_info *dns;
+    struct dupwait_info *dupwait;
+    int ident_sock;
+    void *other;
+  } u;                          /* Special use depending on type        */
+};
+
+
+struct chat_info {
+  char *away;                   /* non-NULL if user is away             */
+  int msgs_per_sec;             /* used to stop flooding                */
+  int con_flags;                /* with console: what to show           */
+  int strip_flags;              /* what codes to strip (b,r,u,c,a,g,*)  */
+  char con_chan[81];            /* with console: what channel to view   */
+  int channel;                  /* 0=party line, -1=off                 */
+  struct msgq *buffer;          /* a buffer of outgoing lines
+                                   (for .page cmd)                      */
+  int max_line;                 /* maximum lines at once                */
+  int line_count;               /* number of lines sent since last page */
+  int current_lines;            /* number of lines total stored         */
+  char *su_nick;
+};
+
+struct file_info {
+  struct chat_info *chat;
+  char dir[161];
+};
+
+struct xfer_info {
+  char *filename;
+  char *origname;
+  char dir[DIRLEN];             /* used when uploads go to the current dir */
+  unsigned long length;
+  unsigned long acked;
+  char buf[4];                  /* you only need 5 bytes!                  */
+  unsigned char sofar;          /* how much of the byte count received     */
+  char from[NICKLEN];           /* [GET] user who offered the file         */
+  FILE *f;                      /* pointer to file being sent/received     */
+  unsigned int type;            /* xfer connection type, see enum below    */
+  unsigned short ack_type;      /* type of ack                             */
+  unsigned long offset;         /* offset from beginning of file, during
+                                   resend.                                 */
+  unsigned long block_pending;  /* bytes of this DCC block which weren't
+                                   sent yet.                               */
+  time_t start_time;            /* Time when a xfer was started.           */
+};
+
+struct bot_info {
+  char version[121];            /* channel/version info                 */
+  time_t bts;                   /* build timestamp */
+  char linker[NOTENAMELEN + 1]; /* who requested this link              */
+  int  numver;
+  char sysname[121];
+  int  port;                    /* base port                            */
+  int  uff_flags;               /* user file feature flags              */
+};
+
+struct relay_info {
+  struct chat_info *chat;
+  int sock;
+  int port;
+  int old_status;
+};
+
+struct dupwait_info {
+  int atr;                      /* the bots attributes                  */
+  struct chat_info *chat;       /* holds current chat data              */
+};
+
+
+/* Flags about dcc types
+ */
+#define DCT_CHAT      0x00000001        /* this dcc type receives botnet
+                                           chatter                          */
+#define DCT_MASTER    0x00000002        /* received master chatter          */
+#define DCT_SHOWWHO   0x00000004        /* show the user in .who            */
+#define DCT_REMOTEWHO 0x00000008        /* show in remote who               */
+#define DCT_VALIDIDX  0x00000010        /* valid idx for outputting to
+                                           in tcl                           */
+#define DCT_SIMUL     0x00000020        /* can be tcl_simul'd               */
+#define DCT_CANBOOT   0x00000040        /* can be booted                    */
+#define DCT_GETNOTES  DCT_CHAT          /* can receive notes                */
+#define DCT_          0x00000080        /* unused */
+#define DCT_FORKTYPE  0x00000100        /* a forking type                   */
+#define DCT_BOT       0x00000200        /* a bot connection of some sort... */
+#define DCT_FILETRAN  0x00000400        /* a file transfer of some sort     */
+#define DCT_FILESEND  0x00000800        /* a sending file transfer,
+                                           getting = !this                  */
+#define DCT_LISTEN    0x00001000        /* a listening port of some sort    */
+
+/* For dcc chat & files:
+ */
+#define STAT_ECHO    0x00001    /* echo commands back?                  */
+#define STAT_DENY    0x00002    /* bad username (ignore password & deny
+                                   access)                              */
+#define STAT_CHAT    0x00004    /* in file-system but may return        */
+#define STAT_TELNET  0x00008    /* connected via telnet                 */
+#define STAT_PARTY   0x00010    /* only on party line via 'p' flag      */
+#define STAT_BOTONLY 0x00020    /* telnet on bots-only connect          */
+#define STAT_USRONLY 0x00040    /* telnet on users-only connect         */
+#define STAT_PAGE    0x00080    /* page output to the user              */
+#define STAT_COLOR   0x00100    /* Color enabled for user */
+
+/* For stripping out mIRC codes
+ */
+#define STRIP_COLOR  0x00001    /* remove mIRC color codes              */
+#define STRIP_BOLD   0x00002    /* remove bold codes                    */
+#define STRIP_REV    0x00004    /* remove reverse video codes           */
+#define STRIP_UNDER  0x00008    /* remove underline codes               */
+#define STRIP_ANSI   0x00010    /* remove ALL ansi codes                */
+#define STRIP_BELLS  0x00020    /* remote ctrl-g's                      */
+#define STRIP_ALL    0x00040    /* remove every damn thing!             */
+
+/* for dcc bot links: */
+#define STAT_PINGED  0x00001    /* waiting for ping to return            */
+#define STAT_SHARE   0x00002    /* sharing user data with the bot        */
+#define STAT_CALLED  0x00004    /* this bot called me                    */
+#define STAT_OFFERED 0x00008    /* offered her the user file             */
+#define STAT_SENDING 0x00010    /* in the process of sending a user list */
+#define STAT_GETTING 0x00020    /* in the process of getting a user list */
+#define STAT_WARNED  0x00040    /* warned him about unleaflike behavior  */
+#define STAT_LEAF    0x00080    /* this bot is a leaf only               */
+#define STAT_LINKING 0x00100    /* the bot is currently going through
+                                   the linking stage                     */
+#define STAT_AGGRESSIVE   0x200 /* aggressively sharing with this bot    */
+#define STAT_OFFEREDU 0x00400
+#define STAT_SENDINGU 0x00800
+#define STAT_GETTINGU 0x01000
+#define STAT_UPDATED  0x02000
+
+/* Flags for listening sockets
+ */
+#define LSTN_PUBLIC  0x000001   /* No access restrictions               */
+
+/* Telnet codes.  See "TELNET Protocol Specification" (RFC 854) and
+ * "TELNET Echo Option" (RFC 875) for details.
+ */
+
+#define TLN_AYT         246             /* Are You There        */
+#define TLN_WILL        251             /* Will                 */
+#define TLN_WILL_C      "\373"
+#define TLN_WONT        252             /* Won't                */
+#define TLN_WONT_C      "\374"
+#define TLN_DO          253             /* Do                   */
+#define TLN_DO_C        "\375"
+#define TLN_DONT        254             /* Don't                */
+#define TLN_DONT_C      "\376"
+#define TLN_IAC         255             /* Interpret As Command */
+#define TLN_IAC_C       "\377"
+#define TLN_ECHO        1               /* Echo                 */
+#define TLN_ECHO_C      "\001"
+
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
 
 
 extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,
 extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,

+ 1 - 0
src/dccutil.h

@@ -2,6 +2,7 @@
 #define _DCCUTIL_H
 #define _DCCUTIL_H
 
 
 #include "eggmain.h"
 #include "eggmain.h"
+#include "dcc.h"
 
 
 #ifdef HAVE_DPRINTF
 #ifdef HAVE_DPRINTF
 #  define dprintf dprintf_eggdrop
 #  define dprintf dprintf_eggdrop

+ 22 - 0
src/dns.h

@@ -7,6 +7,28 @@
 #ifndef _EGG_DNS_H
 #ifndef _EGG_DNS_H
 #define _EGG_DNS_H
 #define _EGG_DNS_H
 
 
+#include "types.h"
+#include "dcc.h"
+
+/* Flags for dns_type
+ */
+#define RES_HOSTBYIP  1         /* hostname to IP address               */
+#define RES_IPBYHOST  2         /* IP address to hostname               */
+
+struct dns_info {
+  void (*dns_success)(int);     /* is called if the dns request succeeds   */
+  void (*dns_failure)(int);     /* is called if it fails                   */
+  char *host;                   /* hostname                                */
+  char *cbuf;                   /* temporary buffer. Memory will be free'd
+                                   as soon as dns_info is free'd           */
+  char *cptr;                   /* temporary pointer                       */
+  IP ip;                        /* IP address                              */
+  int ibuf;                     /* temporary buffer for one integer        */
+  char dns_type;                /* lookup type, e.g. RES_HOSTBYIP          */
+  struct dcc_table *type;       /* type of the dcc table we are making the
+                                   lookup for                              */
+};
+
 typedef struct {
 typedef struct {
   char *name;
   char *name;
   void (*event)(IP, char *, int, void *);
   void (*event)(IP, char *, int, void *);

+ 2 - 0
src/egg_timer.h

@@ -1,6 +1,8 @@
 #ifndef _EGG_TIMER_H_
 #ifndef _EGG_TIMER_H_
 #define _EGG_TIMER_H_
 #define _EGG_TIMER_H_
 
 
+#include "types.h"
+
 typedef struct egg_timeval_b {
 typedef struct egg_timeval_b {
 	int sec;
 	int sec;
 	int usec;
 	int usec;

+ 1 - 413
src/eggdrop.h

@@ -62,24 +62,6 @@
 #  include "HANDLEN MUST BE <= NICKMAX"
 #  include "HANDLEN MUST BE <= NICKMAX"
 #endif
 #endif
 
 
-
-/* Have to use a weird way to make the compiler error out cos not all
- * compilers support #error or error
- */
-#if !HAVE_VSPRINTF
-#  include "error_you_need_vsprintf_to_compile_eggdrop"
-#endif
-
-
-#if HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-
-#if !defined(STDC_HEADERS)
-#  include "you_need_to_upgrade_your_compiler_to_a_standard_c_one_mate!"
-#endif
-
-
 /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
 /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
  * Use 255 if we can't find anything else.
  * Use 255 if we can't find anything else.
  */
  */
@@ -103,6 +85,7 @@
 #  endif
 #  endif
 #endif
 #endif
 
 
+
 #if !HAVE_SRANDOM
 #if !HAVE_SRANDOM
 #  define srandom(x) srand(x)
 #  define srandom(x) srand(x)
 #endif
 #endif
@@ -112,276 +95,9 @@
 #endif
 #endif
 
 
 
 
-/* These apparently are unsafe without recasting. */
-#define egg_isdigit(x)  isdigit((int)  (unsigned char) (x))
-#define egg_isxdigit(x) isxdigit((int) (unsigned char) (x))
-#define egg_isascii(x)  isascii((int)  (unsigned char) (x))
-#define egg_isspace(x)  isspace((int)  (unsigned char) (x))
-#define egg_islower(x)  islower((int)  (unsigned char) (x))
-#define egg_isupper(x)  isupper((int)  (unsigned char) (x))
-
 /***********************************************************************/
 /***********************************************************************/
 
 
-/* Public structure of all the dcc connections */
-struct dcc_table {
-  char *name;
-  int flags;
-  void (*eof) (int);
-  void (*activity) (int, char *, int);
-  int *timeout_val;
-  void (*timeout) ();
-  void (*display) (int, char *);
-  void (*kill) (int, void *);
-  void (*output) (int, char *, void *);
-  void (*outdone) (int);
-};
-
-struct userrec;
-
-#include "crypt.h"
-
-struct auth_t {
-  struct userrec *user;
-  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
-  char nick[NICKLEN];
-  char host[UHOSTLEN];
-  int authed;
-  int authing;
-  time_t authtime;	 /* what time they authed at */
-  time_t atime;	         /* when they last were active */
-};
-
-#include "types.h"
-
-struct dcc_t {
-  long sock;			/* This should be a long to keep 64-bit
-				   machines sane			 */
-  IP addr;			/* IP address in host byte order	 */
-#ifdef USE_IPV6
-  char addr6[121];              /* easier.. ipv6 address in regular notation (3ffe:80c0:225::) */
-#endif /* USE_IPV6 */
-  unsigned int port;
-  int ssl;			/* use ssl on this dcc? */
-  struct userrec *user;
-  char simulbot[NICKLEN];	/* used for hub->leaf cmd simulation, holds bot that results should be sent to */
-  time_t simultime;		/* the time when the simul dcc is initiated, expires after a number of seconds */
-  int simul;			/* this will hold the idx on the remote bot to return result. */
-  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
-  char nick[NICKLEN];
-  char host[UHOSTLEN];
-  struct dcc_table *type;
-  time_t timeval;		/* Use for any timing stuff
-				   - this is used for timeout checking	*/
-  time_t pingtime;
-  unsigned long status;		/* A LOT of dcc types have status
-				   thingos, this makes it more avaliabe	*/
-  union {
-    struct chat_info *chat;
-    struct file_info *file;
-    struct edit_info *edit;
-    struct xfer_info *xfer;
-    struct bot_info *bot;
-    struct relay_info *relay;
-    struct script_info *script;
-    struct dns_info *dns;
-    struct dupwait_info *dupwait;
-    int ident_sock;
-    void *other;
-  } u;				/* Special use depending on type	*/
-};
 
 
-struct chat_info {
-  char *away;			/* non-NULL if user is away		*/
-  int msgs_per_sec;		/* used to stop flooding		*/
-  int con_flags;		/* with console: what to show		*/
-  int strip_flags;		/* what codes to strip (b,r,u,c,a,g,*)	*/
-  char con_chan[81];		/* with console: what channel to view	*/
-  int channel;			/* 0=party line, -1=off			*/
-  struct msgq *buffer;		/* a buffer of outgoing lines
-				   (for .page cmd)			*/
-  int max_line;			/* maximum lines at once		*/
-  int line_count;		/* number of lines sent since last page	*/
-  int current_lines;		/* number of lines total stored		*/
-  char *su_nick;
-};
-
-struct file_info {
-  struct chat_info *chat;
-  char dir[161];
-};
-
-struct xfer_info {
-  char *filename;
-  char *origname;
-  char dir[DIRLEN];		/* used when uploads go to the current dir */
-  unsigned long length;
-  unsigned long acked;
-  char buf[4];			/* you only need 5 bytes!		   */
-  unsigned char sofar;		/* how much of the byte count received	   */
-  char from[NICKLEN];		/* [GET] user who offered the file	   */
-  FILE *f;			/* pointer to file being sent/received	   */
-  unsigned int type;		/* xfer connection type, see enum below	   */
-  unsigned short ack_type;	/* type of ack				   */
-  unsigned long offset;		/* offset from beginning of file, during
-				   resend.				   */
-  unsigned long block_pending;	/* bytes of this DCC block which weren't
-				   sent yet.				   */
-  time_t start_time;		/* Time when a xfer was started.	   */
-};
-
-enum {				/* transfer connection handling a ...	*/
-	XFER_SEND,		/*  ... normal file-send to s.o.	*/
-	XFER_RESEND,		/*  ... file-resend to s.o.		*/
-	XFER_RESEND_PEND,	/*  ... (as above) and waiting for info	*/
-	XFER_RESUME,		/*  ... file-send-resume to s.o.	*/
-	XFER_RESUME_PEND,	/*  ... (as above) and waiting for conn */
-	XFER_GET		/*  ... file-get from s.o.		*/
-};
-
-enum {
-	XFER_ACK_UNKNOWN,	/* We don't know how blocks are acked.	*/
-	XFER_ACK_WITH_OFFSET,	/* Skipped data is also counted as
-				   received.				*/
-	XFER_ACK_WITHOUT_OFFSET	/* Skipped data is NOT counted in ack.	*/
-};
-
-struct bot_info {
-  char version[121];		/* channel/version info			*/
-  time_t bts;			/* build timestamp */
-  char linker[NOTENAMELEN + 1];	/* who requested this link		*/
-  int  numver;
-  char sysname[121];
-  int  port;			/* base port				*/
-  int  uff_flags;		/* user file feature flags		*/
-};
-
-struct relay_info {
-  struct chat_info *chat;
-  int sock;
-  int port;
-  int old_status;
-};
-
-struct script_info {
-  struct dcc_table *type;
-  union {
-    struct chat_info *chat;
-    struct file_info *file;
-    void *other;
-  } u;
-  char command[121];
-};
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#ifdef USE_IPV6
-#define SIZEOF_SOCKADDR(so) ((so).sa.sa_family == AF_INET6 ? sizeof(so.sin6) : sizeof(so.sin))
-#else
-#define SIZEOF_SOCKADDR(so) (sizeof(so.sin))
-#endif /* USE_IPV6 */
-
-#if !defined(IN6_IS_ADDR_V4MAPPED) 
-# define IN6_IS_ADDR_V4MAPPED(a) \
-        ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
-         (((u_int32_t *) (a))[2] == htonl (0xffff)))
-#endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
-
-union sockaddr_union {
-  struct sockaddr sa;
-  struct sockaddr_in sin;
-#ifdef USE_IPV6
-  struct sockaddr_in6 sin6;
-#endif /* USE_IPV6 */
-};
-
-struct dns_info {
-  void (*dns_success)(int);	/* is called if the dns request succeeds   */
-  void (*dns_failure)(int);	/* is called if it fails		   */
-  char *host;			/* hostname				   */
-  char *cbuf;			/* temporary buffer. Memory will be free'd
-				   as soon as dns_info is free'd	   */
-  char *cptr;			/* temporary pointer			   */
-  IP ip;			/* IP address				   */
-  int ibuf;			/* temporary buffer for one integer	   */
-  char dns_type;		/* lookup type, e.g. RES_HOSTBYIP	   */
-  struct dcc_table *type;	/* type of the dcc table we are making the
-				   lookup for				   */
-};
-
-/* Flags for dns_type
- */
-#define RES_HOSTBYIP  1		/* hostname to IP address		*/
-#define RES_IPBYHOST  2		/* IP address to hostname		*/
-
-struct dupwait_info {
-  int atr;			/* the bots attributes			*/
-  struct chat_info *chat;	/* holds current chat data		*/
-};
-
-/* Flags about dcc types
- */
-#define DCT_CHAT      0x00000001	/* this dcc type receives botnet
-					   chatter			    */
-#define DCT_MASTER    0x00000002	/* received master chatter	    */
-#define DCT_SHOWWHO   0x00000004	/* show the user in .who	    */
-#define DCT_REMOTEWHO 0x00000008	/* show in remote who		    */
-#define DCT_VALIDIDX  0x00000010	/* valid idx for outputting to
-					   in tcl			    */
-#define DCT_SIMUL     0x00000020	/* can be tcl_simul'd		    */
-#define DCT_CANBOOT   0x00000040	/* can be booted		    */
-#define DCT_GETNOTES  DCT_CHAT		/* can receive notes		    */
-#define DCT_  	      0x00000080	/* unused */
-#define DCT_FORKTYPE  0x00000100	/* a forking type		    */
-#define DCT_BOT       0x00000200	/* a bot connection of some sort... */
-#define DCT_FILETRAN  0x00000400	/* a file transfer of some sort	    */
-#define DCT_FILESEND  0x00000800	/* a sending file transfer,
-					   getting = !this		    */
-#define DCT_LISTEN    0x00001000	/* a listening port of some sort    */
-
-/* For dcc chat & files:
- */
-#define STAT_ECHO    0x00001	/* echo commands back?			*/
-#define STAT_DENY    0x00002	/* bad username (ignore password & deny
-				   access)				*/
-#define STAT_CHAT    0x00004	/* in file-system but may return	*/
-#define STAT_TELNET  0x00008	/* connected via telnet			*/
-#define STAT_PARTY   0x00010	/* only on party line via 'p' flag	*/
-#define STAT_BOTONLY 0x00020	/* telnet on bots-only connect		*/
-#define STAT_USRONLY 0x00040	/* telnet on users-only connect		*/
-#define STAT_PAGE    0x00080	/* page output to the user		*/
-#define STAT_COLOR   0x00100    /* Color enabled for user */
-
-/* For stripping out mIRC codes
- */
-#define STRIP_COLOR  0x00001	/* remove mIRC color codes		*/
-#define STRIP_BOLD   0x00002	/* remove bold codes			*/
-#define STRIP_REV    0x00004	/* remove reverse video codes		*/
-#define STRIP_UNDER  0x00008	/* remove underline codes		*/
-#define STRIP_ANSI   0x00010	/* remove ALL ansi codes		*/
-#define STRIP_BELLS  0x00020	/* remote ctrl-g's			*/
-#define STRIP_ALL    0x00040	/* remove every damn thing!		*/
-
-/* for dcc bot links: */
-#define STAT_PINGED  0x00001	/* waiting for ping to return		 */
-#define STAT_SHARE   0x00002	/* sharing user data with the bot	 */
-#define STAT_CALLED  0x00004	/* this bot called me			 */
-#define STAT_OFFERED 0x00008	/* offered her the user file		 */
-#define STAT_SENDING 0x00010	/* in the process of sending a user list */
-#define STAT_GETTING 0x00020	/* in the process of getting a user list */
-#define STAT_WARNED  0x00040	/* warned him about unleaflike behavior  */
-#define STAT_LEAF    0x00080	/* this bot is a leaf only		 */
-#define STAT_LINKING 0x00100	/* the bot is currently going through
-				   the linking stage			 */
-#define STAT_AGGRESSIVE   0x200	/* aggressively sharing with this bot	 */
-#define STAT_OFFEREDU 0x00400
-#define STAT_SENDINGU 0x00800
-#define STAT_GETTINGU 0x01000
-#define STAT_UPDATED  0x02000
-
-/* Flags for listening sockets
- */
-#define LSTN_PUBLIC  0x000001	/* No access restrictions		*/
 
 
 /* chan & global */
 /* chan & global */
 #define FLOOD_PRIVMSG    0
 #define FLOOD_PRIVMSG    0
@@ -395,30 +111,6 @@ struct dupwait_info {
 #define FLOOD_CHAN_MAX   7
 #define FLOOD_CHAN_MAX   7
 #define FLOOD_GLOBAL_MAX 3
 #define FLOOD_GLOBAL_MAX 3
 
 
-#ifdef S_LASTCHECK
-#define DETECT_LOGIN 1
-#endif
-#ifdef S_ANTITRACE
-#define DETECT_TRACE 2
-#endif
-#ifdef S_PROMISC
-#define DETECT_PROMISC 3
-#endif
-#ifdef S_PROCESSCHECK
-#define DETECT_PROCESS 4
-#endif
-#ifdef S_HIJACKCHECK
-#define DETECT_SIGCONT 5
-#endif
-
-#define DET_IGNORE 0
-#define DET_WARN 1
-#define DET_REJECT 2
-#define DET_DIE 3
-#define DET_SUICIDE 4
-
-#define CONNECT_SSL 1
-#define ACCEPT_SSL 2
 
 
 /* Logfile display flags
 /* Logfile display flags
  */
  */
@@ -451,36 +143,6 @@ struct dupwait_info {
 #define LOG_BOTSHARE 0x400000	/* h   share traffic			*/
 #define LOG_BOTSHARE 0x400000	/* h   share traffic			*/
 #define LOG_ALL      0x7fffff	/* (dump to all logfiles)		*/
 #define LOG_ALL      0x7fffff	/* (dump to all logfiles)		*/
 
 
-/* Internal logfile flags
- */
-#define LF_EXPIRING 0x000001	/* Logfile will be closed soon		*/
-
-#define FILEDB_HIDE     1
-#define FILEDB_UNHIDE   2
-#define FILEDB_SHARE    3
-#define FILEDB_UNSHARE  4
-
-/* Socket flags:
- */
-#define SOCK_UNUSED     0x0001	/* empty socket				*/
-#define SOCK_BINARY     0x0002	/* do not buffer input			*/
-#define SOCK_LISTEN     0x0004	/* listening port			*/
-#define SOCK_CONNECT    0x0008	/* connection attempt			*/
-#define SOCK_NONSOCK    0x0010	/* used for file i/o on debug		*/
-#define SOCK_STRONGCONN 0x0020	/* don't report success until sure	*/
-#define SOCK_EOFD       0x0040	/* it EOF'd recently during a write	*/
-#define SOCK_PROXYWAIT	0x0080	/* waiting for SOCKS traversal		*/
-#define SOCK_PASS	0x0100	/* passed on; only notify in case
-				   of traffic				*/
-#define SOCK_VIRTUAL	0x0200	/* not-connected socket (dont read it!)	*/
-#define SOCK_BUFFER	0x0400	/* buffer data; don't notify dcc funcs	*/
-
-/* Flags to sock_has_data
- */
-enum {
-  SOCK_DATA_OUTGOING,		/* Data in out-queue?			*/
-  SOCK_DATA_INCOMING		/* Data in in-queue?			*/
-};
 
 
 /* Fake idx's for dprintf - these should be ridiculously large +ve nums
 /* Fake idx's for dprintf - these should be ridiculously large +ve nums
  */
  */
@@ -494,78 +156,4 @@ enum {
 #define DP_SERVER_NEXT  0x7FF8
 #define DP_SERVER_NEXT  0x7FF8
 #define DP_HELP_NEXT    0x7FF9
 #define DP_HELP_NEXT    0x7FF9
 
 
-#define NORMAL          0
-#define QUICK           1
-
-/* Return codes for add_note */
-#define NOTE_ERROR      0	/* error			*/
-#define NOTE_OK         1	/* success			*/
-#define NOTE_STORED     2	/* not online; stored		*/
-#define NOTE_FULL       3	/* too many notes stored	*/
-#define NOTE_TCL        4	/* tcl binding caught it	*/
-#define NOTE_AWAY       5	/* away; stored			*/
-#define NOTE_FWD        6	/* away; forwarded		*/
-
-#define STR_PROTECT     2
-#define STR_DIR         1
-
-#define HELP_DCC        1
-#define HELP_TEXT       2
-#define HELP_IRC        16
-
-/* This is used by the net module to keep track of sockets and what's
- * queued on them
- */
-typedef struct {
-  int		 sock;
-  short		 flags;
-  char		*inbuf;
-  char		*outbuf;
-  unsigned long  outbuflen;		/* Outbuf could be binary data	*/
-  int encstatus;			/* encrypted botlink */
-  int oseed;				/* botlink out seed */
-  int iseed;				/* botlink in seed */
-  char okey[33];			/* botlink enckey: out */
-  char ikey[33];			/* botlink enckey: in  */
-  int gz; /* gzip compression */
-  unsigned long	 inbuflen;		/* Inbuf could be binary data	*/
-#ifdef USE_IPV6
-  unsigned int af;
-#endif /* USE_IPV6 */
-#ifdef HAVE_SSL
-  SSL 		*ssl;
-#endif /* HAVE_SSL */
-} sock_list;
-
-#ifdef S_DCCPASS
-typedef struct cmd_pass {
-  struct cmd_pass *next;
-  char *name;
-  char pass[25];
-} cmd_pass_t;
-#endif
-
-enum {
-  EGG_OPTION_SET	= 1,	/* Set option(s).		*/
-  EGG_OPTION_UNSET	= 2	/* Unset option(s).		*/
-};
-
-/* Telnet codes.  See "TELNET Protocol Specification" (RFC 854) and
- * "TELNET Echo Option" (RFC 875) for details.
- */
-
-#define TLN_AYT		246		/* Are You There	*/
-#define TLN_WILL	251		/* Will			*/
-#define TLN_WILL_C	"\373"
-#define TLN_WONT	252		/* Won't		*/
-#define TLN_WONT_C	"\374"
-#define TLN_DO		253		/* Do			*/
-#define TLN_DO_C	"\375"
-#define TLN_DONT	254		/* Don't		*/
-#define TLN_DONT_C	"\376"
-#define TLN_IAC		255		/* Interpret As Command	*/
-#define TLN_IAC_C	"\377"
-#define TLN_ECHO	1		/* Echo			*/
-#define TLN_ECHO_C	"\001"
-
 #endif				/* _EGG_EGGDROP_H */
 #endif				/* _EGG_EGGDROP_H */

+ 0 - 1
src/eggmain.h

@@ -19,7 +19,6 @@
 #include "compat/compat.h"
 #include "compat/compat.h"
 
 
 
 
-
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>

+ 13 - 0
src/misc.h

@@ -48,6 +48,19 @@
 #define EMAIL_TEAM      0x2
 #define EMAIL_TEAM      0x2
 
 
 
 
+#define DETECT_LOGIN 1
+#define DETECT_TRACE 2
+#define DETECT_PROMISC 3
+#define DETECT_PROCESS 4
+#define DETECT_SIGCONT 5
+
+#define DET_IGNORE 0
+#define DET_WARN 1
+#define DET_REJECT 2
+#define DET_DIE 3
+#define DET_SUICIDE 4
+
+
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
 char *homedir();
 char *homedir();
 char *my_uname();
 char *my_uname();

+ 1 - 0
src/mod/dns.mod/coredns.c

@@ -17,6 +17,7 @@
  * Released under the GPL, as above.
  * Released under the GPL, as above.
  */
  */
 
 
+#include "src/net.h"
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/inet.h>

+ 1 - 0
src/mod/irc.mod/irc.c

@@ -10,6 +10,7 @@
 #include "src/mod/module.h"
 #include "src/mod/module.h"
 #include "irc.h"
 #include "irc.h"
 #include "src/misc.h"
 #include "src/misc.h"
+#include "src/auth.h"
 #include "src/salt.h"
 #include "src/salt.h"
 #include "src/mod/server.mod/server.h"
 #include "src/mod/server.mod/server.h"
 #undef serv
 #undef serv

+ 3 - 0
src/mod/irc.mod/irc.h

@@ -13,6 +13,9 @@
 #define PRIO_DEOP 1
 #define PRIO_DEOP 1
 #define PRIO_KICK 2
 #define PRIO_KICK 2
 
 
+/* For flushmodes */
+#define NORMAL          0
+#define QUICK           1
 
 
 #ifdef MAKING_IRC
 #ifdef MAKING_IRC
 #ifdef S_AUTH
 #ifdef S_AUTH

+ 1 - 0
src/mod/module.h

@@ -26,6 +26,7 @@
 
 
 /* Just include *all* the include files...it's slower but EASIER */
 /* Just include *all* the include files...it's slower but EASIER */
 #include "src/eggmain.h"
 #include "src/eggmain.h"
+#include "src/dcc.h"
 #include "src/debug.h"
 #include "src/debug.h"
 #include "src/color.h"
 #include "src/color.h"
 #include "src/users.h"
 #include "src/users.h"

+ 2 - 0
src/mod/modvals.h

@@ -24,6 +24,8 @@
 #ifndef _EGG_MOD_MODVALS_H
 #ifndef _EGG_MOD_MODVALS_H
 #define _EGG_MOD_MODVALS_H
 #define _EGG_MOD_MODVALS_H
 
 
+#include "src/types.h"
+
 /* #define HOOK_GET_FLAGREC	  0 	*/
 /* #define HOOK_GET_FLAGREC	  0 	*/
 /* #define HOOK_BUILD_FLAGREC	  1 	*/
 /* #define HOOK_BUILD_FLAGREC	  1 	*/
 /* #define HOOK_SET_FLAGREC	  2 	*/
 /* #define HOOK_SET_FLAGREC	  2 	*/

+ 1 - 0
src/mod/notes.mod/notes.c

@@ -13,6 +13,7 @@
 #include <sys/stat.h> /* chmod(..) */
 #include <sys/stat.h> /* chmod(..) */
 #include "src/mod/module.h"
 #include "src/mod/module.h"
 #include "src/tandem.h"
 #include "src/tandem.h"
+#include "src/botmsg.h" /* NOTE DEFINES */
 #undef global
 #undef global
 #include "notes.h"
 #include "notes.h"
 
 

+ 2 - 0
src/mod/server.mod/server.c

@@ -9,6 +9,8 @@
 #define MAKING_SERVER
 #define MAKING_SERVER
 #include "src/mod/module.h"
 #include "src/mod/module.h"
 #include "src/net.h"
 #include "src/net.h"
+#include "src/auth.h"
+#include "src/dns.h"
 #include "server.h"
 #include "server.h"
 
 
 static Function *global = NULL;
 static Function *global = NULL;

+ 17 - 0
src/mod/transfer.mod/transfer.h

@@ -14,6 +14,23 @@ enum dccsend_types {
   DCCSEND_FEMPTY	/* File is empty			*/
   DCCSEND_FEMPTY	/* File is empty			*/
 };
 };
 
 
+enum {                          /* transfer connection handling a ...   */
+        XFER_SEND,              /*  ... normal file-send to s.o.        */
+        XFER_RESEND,            /*  ... file-resend to s.o.             */
+        XFER_RESEND_PEND,       /*  ... (as above) and waiting for info */
+        XFER_RESUME,            /*  ... file-send-resume to s.o.        */
+        XFER_RESUME_PEND,       /*  ... (as above) and waiting for conn */
+        XFER_GET                /*  ... file-get from s.o.              */
+};
+
+enum {
+        XFER_ACK_UNKNOWN,       /* We don't know how blocks are acked.  */
+        XFER_ACK_WITH_OFFSET,   /* Skipped data is also counted as
+                                   received.                            */
+        XFER_ACK_WITHOUT_OFFSET /* Skipped data is NOT counted in ack.  */
+};
+
+
 #ifndef MAKING_TRANSFER
 #ifndef MAKING_TRANSFER
 /* 4 - 7 */
 /* 4 - 7 */
 #define DCC_FORK_SEND (*(struct dcc_table *)(transfer_funcs[4]))
 #define DCC_FORK_SEND (*(struct dcc_table *)(transfer_funcs[4]))

+ 1 - 3
src/mod/update.mod/update.c

@@ -7,6 +7,7 @@
 #define MAKING_update
 #define MAKING_update
 
 
 #include "src/mod/module.h"
 #include "src/mod/module.h"
+#include "src/net.h"
 
 
 #include <netinet/in.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/inet.h>
@@ -17,9 +18,6 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-#ifdef HUB
-#include "src/net.h"
-#endif
 
 
 #include "src/mod/transfer.mod/transfer.h"
 #include "src/mod/transfer.mod/transfer.h"
 #include "src/mod/compress.mod/compress.h"
 #include "src/mod/compress.mod/compress.h"

+ 1 - 0
src/modules.h

@@ -12,6 +12,7 @@
 /* Module related structures
 /* Module related structures
  */
  */
 #include "mod/modvals.h"
 #include "mod/modvals.h"
+#include "types.h"
 
 
 #ifndef MAKING_NUMMODS
 #ifndef MAKING_NUMMODS
 
 

+ 75 - 0
src/net.h

@@ -6,6 +6,8 @@
 #endif
 #endif
 
 
 #include "types.h"
 #include "types.h"
+#include <netinet/in.h>
+#include <sys/socket.h>
 
 
 
 
 #ifdef HAVE_OPENSSL_SSL_H
 #ifdef HAVE_OPENSSL_SSL_H
@@ -38,9 +40,82 @@
 
 
 #define SGRAB 2011         /* How much data to allow through sockets. */
 #define SGRAB 2011         /* How much data to allow through sockets. */
 
 
+enum {
+  EGG_OPTION_SET        = 1,    /* Set option(s).               */
+  EGG_OPTION_UNSET      = 2     /* Unset option(s).             */
+};
+
+/* Socket flags:
+ */
+#define SOCK_UNUSED     0x0001  /* empty socket                         */
+#define SOCK_BINARY     0x0002  /* do not buffer input                  */
+#define SOCK_LISTEN     0x0004  /* listening port                       */
+#define SOCK_CONNECT    0x0008  /* connection attempt                   */
+#define SOCK_NONSOCK    0x0010  /* used for file i/o on debug           */
+#define SOCK_STRONGCONN 0x0020  /* don't report success until sure      */
+#define SOCK_EOFD       0x0040  /* it EOF'd recently during a write     */
+#define SOCK_PROXYWAIT  0x0080  /* waiting for SOCKS traversal          */
+#define SOCK_PASS       0x0100  /* passed on; only notify in case
+                                   of traffic                           */
+#define SOCK_VIRTUAL    0x0200  /* not-connected socket (dont read it!) */
+#define SOCK_BUFFER     0x0400  /* buffer data; don't notify dcc funcs  */
+
+/* Flags to sock_has_data
+ */
+enum {
+  SOCK_DATA_OUTGOING,           /* Data in out-queue?                   */
+  SOCK_DATA_INCOMING            /* Data in in-queue?                    */
+};
+
 
 
 #define iptolong(a)             (0xffffffff &                           \
 #define iptolong(a)             (0xffffffff &                           \
                                  (long) (htonl((unsigned long) a)))
                                  (long) (htonl((unsigned long) a)))
+#define CONNECT_SSL 1
+#define ACCEPT_SSL 2
+
+#ifdef USE_IPV6
+#define SIZEOF_SOCKADDR(so) ((so).sa.sa_family == AF_INET6 ? sizeof(so.sin6) : sizeof(so.sin))
+#else
+#define SIZEOF_SOCKADDR(so) (sizeof(so.sin))
+#endif /* USE_IPV6 */
+
+#if !defined(IN6_IS_ADDR_V4MAPPED)
+# define IN6_IS_ADDR_V4MAPPED(a) \
+        ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
+         (((u_int32_t *) (a))[2] == htonl (0xffff)))
+#endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
+
+union sockaddr_union {
+  struct sockaddr sa;
+  struct sockaddr_in sin;
+#ifdef USE_IPV6
+  struct sockaddr_in6 sin6;
+#endif /* USE_IPV6 */
+};
+
+/* This is used by the net module to keep track of sockets and what's
+ * queued on them
+ */
+typedef struct {
+  int            sock;
+  short          flags;
+  char          *inbuf;
+  char          *outbuf;
+  unsigned long  outbuflen;             /* Outbuf could be binary data  */
+  int encstatus;                        /* encrypted botlink */
+  int oseed;                            /* botlink out seed */
+  int iseed;                            /* botlink in seed */
+  char okey[33];                        /* botlink enckey: out */
+  char ikey[33];                        /* botlink enckey: in  */
+  int gz; /* gzip compression */
+  unsigned long  inbuflen;              /* Inbuf could be binary data   */
+#ifdef USE_IPV6
+  unsigned int af;
+#endif /* USE_IPV6 */
+#ifdef HAVE_SSL
+  SSL           *ssl;
+#endif /* HAVE_SSL */
+} sock_list;
 
 
 
 
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS