]> jfr.im git - irc/quakenet/newserv.git/blobdiff - proxyscan/proxyscan.h
PROXYSCAN: Add DIRECT_IRC scan type.
[irc/quakenet/newserv.git] / proxyscan / proxyscan.h
index 279dd3b07fcbe52846ef1468edeab478ed89bae6..110ba302fcfec1152bb216d4bf82ed60ea2676a7 100644 (file)
@@ -3,13 +3,18 @@
 #define __PROXYSCAN_H
 
 #include "../nick/nick.h"
+#include "../lib/splitline.h"
 #include <time.h>
+#include <stdint.h>
 
-#define MAGICSTRING       "NOTICE AUTH :*** Looking up your hostname\r\n"
-#define MAGICSTRINGLENGTH 42
+#define MAGICSTRING         "NOTICE AUTH :*** Looking up your hostname\r\n"
+#define MAGICSTRINGLENGTH   42
 
-#define PSCAN_MAXSCANS     50
-#define PSCAN_READBUFSIZE (MAGICSTRINGLENGTH * 2)
+#define MAGICIRCSTRING      ".quakenet.org 451 *  :Register first.\r\n"
+#define MAGICIRCSTRINGLENGTH 38
+
+#define PSCAN_MAXSCANS      50
+#define PSCAN_READBUFSIZE   (MAGICSTRINGLENGTH * 2)
 
 #define SSTATE_CONNECTING   0
 #define SSTATE_SENTREQUEST  1
@@ -20,7 +25,8 @@
 #define STYPE_HTTP          2
 #define STYPE_WINGATE       3
 #define STYPE_CISCO         4
-#define STYPE_DIRECT        5
+#define STYPE_DIRECT        5 /* not sure what this is so I'm leaving it alone */
+#define STYPE_DIRECT_IRC    6
 
 #define SOUTCOME_INPROGRESS 0
 #define SOUTCOME_OPEN       1
@@ -38,8 +44,15 @@ typedef struct scantype {
   int hits;
 } scantype;
 
+typedef struct extrascan {
+  unsigned short port;
+  unsigned char type;
+  struct extrascan *next;
+  struct extrascan *nextbynode;
+} extrascan;
+
 typedef struct pendingscan {
-  unsigned int IP;
+  patricia_node_t *node; 
   unsigned short port;
   unsigned char type;
   unsigned char class;
@@ -54,7 +67,6 @@ typedef struct foundproxy {
 } foundproxy;
 
 typedef struct cachehost {
-  unsigned long IP;
   time_t lastscan;
   foundproxy *proxies;
   int glineid;
@@ -63,12 +75,12 @@ typedef struct cachehost {
   sstring *lasthostmask; /* Not saved to disk */
   time_t lastconnect;    /* Not saved to disk */
 #endif
-  struct cachehost *next;
+  struct cachehost *next; 
 } cachehost;
 
 typedef struct scan {
   int fd;
-  unsigned int IP;
+  patricia_node_t *node; 
   short type;
   unsigned short port;
   unsigned short state;
@@ -93,13 +105,24 @@ extern int maxscans;
 extern int numscans;
 extern scantype thescans[];
 extern int brokendb;
+extern int ps_cache_ext;
+extern int ps_scan_ext;
+extern int ps_extscan_ext;
+extern int ps_ready;
+extern int rescaninterval;
 
 extern unsigned int normalqueuedscans;
 extern unsigned int prioqueuedscans;
 
+extern unsigned int ps_start_ts;
+
+extern unsigned long countpendingscan;
+
+extern unsigned long scanspermin;
+
 /* proxyscancache.c */
-cachehost *addcleanhost(unsigned long IP, time_t timestamp);
-cachehost *findcachehost(unsigned long IP);
+cachehost *addcleanhost(time_t timestamp);
+cachehost *findcachehost(patricia_node_t *node);
 void delcachehost(cachehost *);
 void dumpcachehosts();
 void loadcachehosts();
@@ -118,6 +141,8 @@ void freefoundproxy(foundproxy *fpp);
 pendingscan *getpendingscan();
 void freependingscan(pendingscan *psp);
 void sfreeall();
+extrascan *getextrascan();
+void freeextrascan(extrascan *esp);
 
 /* proxyscanlisten.c */
 int openlistensocket(int portnum);
@@ -127,10 +152,12 @@ void handlelistensocket(int fd, short events);
 int createconnectsocket(long ip, int socknum);
 
 /* proxyscandb.c */
-void loggline(cachehost *chp);
+void loggline(cachehost *chp, patricia_node_t *node);
 void proxyscandbclose();
 int proxyscandbinit();
-void proxyscandolistopen(nick *mynick, nick *usernick, time_t snce);
+int proxyscandolistopen(void *sender, int cargc, char **cargv);
+void proxyscanspewip(nick *mynick, nick *usernick, unsigned long a, unsigned long b, unsigned long c, unsigned long d);
+void proxyscanshowkill(nick *mynick, nick *usernick, unsigned long a);
 const char *scantostr(int type);
 
 #if defined(PROXYSCAN_MAIL)
@@ -139,11 +166,17 @@ void ps_makereportmail(scanhost *shp);
 #endif
 
 /* proxyscanqueue.c */
-void queuescan(unsigned int IP, short scantype, unsigned short port, char class, time_t when);
+void queuescan(patricia_node_t *node, short scantype, unsigned short port, char class, time_t when);
 void startqueuedscans();
 
 /* proxyscan.c */
-void startscan(unsigned int IP, int type, int port, int class);
-
+void startscan(patricia_node_t *node, int type, int port, int class);
+
+/* proxyscanext.c */
+unsigned int extrascancount();
+void loadextrascans();
+extrascan *findextrascan(patricia_node_t *node);
+void delextrascan(extrascan *esp);
+extrascan *addextrascan(unsigned short port, unsigned char type);
 
 #endif