X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/ff99b5c0abab99c8aa28afc5c4dfcd4ee948198c..440cd7e63ac2b059ea1a467a2e4e2244faf92cb3:/proxyscan/proxyscan.h diff --git a/proxyscan/proxyscan.h b/proxyscan/proxyscan.h index b73ec2ca..627d7462 100644 --- a/proxyscan/proxyscan.h +++ b/proxyscan/proxyscan.h @@ -3,13 +3,21 @@ #define __PROXYSCAN_H #include "../nick/nick.h" +#include "../lib/splitline.h" #include +#include -#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 MAGICROUTERSTRING "\r\nServer: Mikrotik HttpProxy\r\n" +#define MAGICROUTERSTRINGLENGTH 30 + +#define PSCAN_MAXSCANS 100 +#define PSCAN_READBUFSIZE (MAGICSTRINGLENGTH * 2) #define SSTATE_CONNECTING 0 #define SSTATE_SENTREQUEST 1 @@ -20,7 +28,9 @@ #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 STYPE_ROUTER 7 #define SOUTCOME_INPROGRESS 0 #define SOUTCOME_OPEN 1 @@ -38,8 +48,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,21 +71,21 @@ typedef struct foundproxy { } foundproxy; typedef struct cachehost { - unsigned long IP; time_t lastscan; foundproxy *proxies; int glineid; + time_t lastgline; unsigned char marker; #if defined(PROXYSCAN_MAIL) 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,6 +110,11 @@ 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; @@ -104,8 +126,8 @@ 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(); @@ -123,20 +145,21 @@ foundproxy *getfoundproxy(); void freefoundproxy(foundproxy *fpp); pendingscan *getpendingscan(); void freependingscan(pendingscan *psp); -void sfreeall(); +extrascan *getextrascan(); +void freeextrascan(extrascan *esp); /* proxyscanlisten.c */ int openlistensocket(int portnum); void handlelistensocket(int fd, short events); /* proxyscanconnect.c */ -int createconnectsocket(long ip, int socknum); +int createconnectsocket(struct irc_in_addr *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); @@ -147,11 +170,18 @@ 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); +void startnickscan(nick *nick); + +/* 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