]>
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 extern unsigned int ps_start_ts
;
102 extern unsigned long countpendingscan
;
104 extern unsigned long scanspermin
;
106 /* proxyscancache.c */
107 cachehost
*addcleanhost(unsigned long IP
, time_t timestamp
);
108 cachehost
*findcachehost(unsigned long IP
);
109 void delcachehost(cachehost
*);
110 void dumpcachehosts();
111 void loadcachehosts();
112 unsigned int cleancount();
113 unsigned int dirtycount();
114 void cachehostinit(time_t ri
);
115 void scanall(int type
, int port
);
117 /* proxyscanalloc.c */
119 void freescan(scan
*sp
);
120 cachehost
*getcachehost();
121 void freecachehost(cachehost
*chp
);
122 foundproxy
*getfoundproxy();
123 void freefoundproxy(foundproxy
*fpp
);
124 pendingscan
*getpendingscan();
125 void freependingscan(pendingscan
*psp
);
128 /* proxyscanlisten.c */
129 int openlistensocket(int portnum
);
130 void handlelistensocket(int fd
, short events
);
132 /* proxyscanconnect.c */
133 int createconnectsocket(long ip
, int socknum
);
136 void loggline(cachehost
*chp
);
137 void proxyscandbclose();
138 int proxyscandbinit();
139 void proxyscandolistopen(nick
*mynick
, nick
*usernick
, time_t snce
);
140 void proxyscanspewip(nick
*mynick
, nick
*usernick
, unsigned long a
, unsigned long b
, unsigned long c
, unsigned long d
);
141 void proxyscanshowkill(nick
*mynick
, nick
*usernick
, unsigned long a
);
142 const char *scantostr(int type
);
144 #if defined(PROXYSCAN_MAIL)
145 /* proxyscanmail.c */
146 void ps_makereportmail(scanhost
*shp
);
149 /* proxyscanqueue.c */
150 void queuescan(unsigned int IP
, short scantype
, unsigned short port
, char class, time_t when
);
151 void startqueuedscans();
154 void startscan(unsigned int IP
, int type
, int port
, int class);