]>
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 extrascan
{
44 struct extrascan
*next
;
45 struct extrascan
*nextbynode
;
48 typedef struct pendingscan
{
49 patricia_node_t
*node
;
54 struct pendingscan
*next
;
57 typedef struct foundproxy
{
60 struct foundproxy
*next
;
63 typedef struct cachehost
{
68 #if defined(PROXYSCAN_MAIL)
69 sstring
*lasthostmask
; /* Not saved to disk */
70 time_t lastconnect
; /* Not saved to disk */
72 struct cachehost
*next
;
77 patricia_node_t
*node
;
81 unsigned short outcome
;
85 char readbuf
[PSCAN_READBUFSIZE
];
90 #if defined(PROXYSCAN_MAIL)
91 extern unsigned int ps_mailip
;
92 extern unsigned int ps_mailport
;
93 extern sstring
*ps_mailname
;
94 extern int psm_mailerfd
;
97 extern int activescans
;
100 extern scantype thescans
[];
102 extern int ps_cache_ext
;
103 extern int ps_scan_ext
;
104 extern int ps_extscan_ext
;
107 extern unsigned int normalqueuedscans
;
108 extern unsigned int prioqueuedscans
;
110 extern unsigned int ps_start_ts
;
112 extern unsigned long countpendingscan
;
114 extern unsigned long scanspermin
;
116 /* proxyscancache.c */
117 cachehost
*addcleanhost(time_t timestamp
);
118 cachehost
*findcachehost(patricia_node_t
*node
);
119 void delcachehost(cachehost
*);
120 void dumpcachehosts();
121 void loadcachehosts();
122 unsigned int cleancount();
123 unsigned int dirtycount();
124 void cachehostinit(time_t ri
);
125 void scanall(int type
, int port
);
127 /* proxyscanalloc.c */
129 void freescan(scan
*sp
);
130 cachehost
*getcachehost();
131 void freecachehost(cachehost
*chp
);
132 foundproxy
*getfoundproxy();
133 void freefoundproxy(foundproxy
*fpp
);
134 pendingscan
*getpendingscan();
135 void freependingscan(pendingscan
*psp
);
137 extrascan
*getextrascan();
138 void freeextrascan(extrascan
*esp
);
140 /* proxyscanlisten.c */
141 int openlistensocket(int portnum
);
142 void handlelistensocket(int fd
, short events
);
144 /* proxyscanconnect.c */
145 int createconnectsocket(long ip
, int socknum
);
148 void loggline(cachehost
*chp
, patricia_node_t
*node
);
149 void proxyscandbclose();
150 int proxyscandbinit();
151 void proxyscandolistopen(nick
*mynick
, nick
*usernick
, time_t snce
);
152 void proxyscanspewip(nick
*mynick
, nick
*usernick
, unsigned long a
, unsigned long b
, unsigned long c
, unsigned long d
);
153 void proxyscanshowkill(nick
*mynick
, nick
*usernick
, unsigned long a
);
154 const char *scantostr(int type
);
156 #if defined(PROXYSCAN_MAIL)
157 /* proxyscanmail.c */
158 void ps_makereportmail(scanhost
*shp
);
161 /* proxyscanqueue.c */
162 void queuescan(patricia_node_t
*node
, short scantype
, unsigned short port
, char class, time_t when
);
163 void startqueuedscans();
166 void startscan(patricia_node_t
*node
, int type
, int port
, int class);
169 unsigned int extrascancount();
170 void loadextrascans();
171 extrascan
*findextrascan(patricia_node_t
*node
);
172 void delextrascan(extrascan
*esp
);
173 extrascan
*addextrascan(unsigned short port
, unsigned char type
);