]>
jfr.im git - irc/quakenet/newserv.git/blob - proxyscan/proxyscan.h
5 #include "../nick/nick.h"
8 #define MAGICSTRING "NOTICE AUTH :*** Looking up your hostname\r\n"
9 #define MAGICSTRINGLENGTH 42
11 #define PSCAN_MAXSCANS 50
12 #define PSCAN_READBUFSIZE (MAGICSTRINGLENGTH * 2)
14 #define SSTATE_CONNECTING 0
15 #define SSTATE_SENTREQUEST 1
16 #define SSTATE_GOTRESPONSE 2
18 #define STYPE_SOCKS4 0
19 #define STYPE_SOCKS5 1
21 #define STYPE_WINGATE 3
23 #define STYPE_DIRECT 5
25 #define SOUTCOME_INPROGRESS 0
26 #define SOUTCOME_OPEN 1
27 #define SOUTCOME_CLOSED 2
29 #define SCLASS_NORMAL 0
30 #define SCLASS_CHECK 1
31 #define SCLASS_PASS2 2
32 #define SCLASS_PASS3 3
33 #define SCLASS_PASS4 4
35 typedef struct scantype
{
41 typedef struct pendingscan
{
47 struct pendingscan
*next
;
50 typedef struct foundproxy
{
53 struct foundproxy
*next
;
56 typedef struct cachehost
{
62 #if defined(PROXYSCAN_MAIL)
63 sstring
*lasthostmask
; /* Not saved to disk */
64 time_t lastconnect
; /* Not saved to disk */
66 struct cachehost
*next
;
75 unsigned short outcome
;
79 char readbuf
[PSCAN_READBUFSIZE
];
84 #if defined(PROXYSCAN_MAIL)
85 extern unsigned int ps_mailip
;
86 extern unsigned int ps_mailport
;
87 extern sstring
*ps_mailname
;
88 extern int psm_mailerfd
;
91 extern int activescans
;
94 extern scantype thescans
[];
97 extern unsigned int normalqueuedscans
;
98 extern unsigned int prioqueuedscans
;
100 /* proxyscancache.c */
101 cachehost
*addcleanhost(unsigned long IP
, time_t timestamp
);
102 cachehost
*findcachehost(unsigned long IP
);
103 void delcachehost(cachehost
*);
104 void dumpcachehosts();
105 void loadcachehosts();
106 unsigned int cleancount();
107 unsigned int dirtycount();
108 void cachehostinit(time_t ri
);
109 void scanall(int type
, int port
);
111 /* proxyscanalloc.c */
113 void freescan(scan
*sp
);
114 cachehost
*getcachehost();
115 void freecachehost(cachehost
*chp
);
116 foundproxy
*getfoundproxy();
117 void freefoundproxy(foundproxy
*fpp
);
118 pendingscan
*getpendingscan();
119 void freependingscan(pendingscan
*psp
);
122 /* proxyscanlisten.c */
123 int openlistensocket(int portnum
);
124 void handlelistensocket(int fd
, short events
);
126 /* proxyscanconnect.c */
127 int createconnectsocket(long ip
, int socknum
);
130 void loggline(cachehost
*chp
);
131 void proxyscandbclose();
132 int proxyscandbinit();
133 void proxyscandolistopen(nick
*mynick
, nick
*usernick
, time_t snce
);
134 void proxyscanspewip(nick
*mynick
, nick
*usernick
, unsigned long a
, unsigned long b
, unsigned long c
, unsigned long d
);
135 void proxyscanshowkill(nick
*mynick
, nick
*usernick
, unsigned long a
);
136 const char *scantostr(int type
);
138 #if defined(PROXYSCAN_MAIL)
139 /* proxyscanmail.c */
140 void ps_makereportmail(scanhost
*shp
);
143 /* proxyscanqueue.c */
144 void queuescan(unsigned int IP
, short scantype
, unsigned short port
, char class, time_t when
);
145 void startqueuedscans();
148 void startscan(unsigned int IP
, int type
, int port
, int class);