]>
jfr.im git - irc/quakenet/newserv.git/blob - proxyscan/proxyscan.h
5 #include "../nick/nick.h"
6 #include "../lib/splitline.h"
10 #define MAGICSTRING "NOTICE AUTH :*** Looking up your hostname\r\n"
11 #define MAGICSTRINGLENGTH 42
13 #define MAGICIRCSTRING ".quakenet.org 451 * :Register first.\r\n"
14 #define MAGICIRCSTRINGLENGTH 38
16 #define PSCAN_MAXSCANS 50
17 #define PSCAN_READBUFSIZE (MAGICSTRINGLENGTH * 2)
19 #define SSTATE_CONNECTING 0
20 #define SSTATE_SENTREQUEST 1
21 #define SSTATE_GOTRESPONSE 2
23 #define STYPE_SOCKS4 0
24 #define STYPE_SOCKS5 1
26 #define STYPE_WINGATE 3
28 #define STYPE_DIRECT 5 /* not sure what this is so I'm leaving it alone */
29 #define STYPE_DIRECT_IRC 6
31 #define SOUTCOME_INPROGRESS 0
32 #define SOUTCOME_OPEN 1
33 #define SOUTCOME_CLOSED 2
35 #define SCLASS_NORMAL 0
36 #define SCLASS_CHECK 1
37 #define SCLASS_PASS2 2
38 #define SCLASS_PASS3 3
39 #define SCLASS_PASS4 4
41 typedef struct scantype
{
47 typedef struct extrascan
{
50 struct extrascan
*next
;
51 struct extrascan
*nextbynode
;
54 typedef struct pendingscan
{
55 patricia_node_t
*node
;
60 struct pendingscan
*next
;
63 typedef struct foundproxy
{
66 struct foundproxy
*next
;
69 typedef struct cachehost
{
75 #if defined(PROXYSCAN_MAIL)
76 sstring
*lasthostmask
; /* Not saved to disk */
77 time_t lastconnect
; /* Not saved to disk */
79 struct cachehost
*next
;
84 patricia_node_t
*node
;
88 unsigned short outcome
;
92 char readbuf
[PSCAN_READBUFSIZE
];
97 #if defined(PROXYSCAN_MAIL)
98 extern unsigned int ps_mailip
;
99 extern unsigned int ps_mailport
;
100 extern sstring
*ps_mailname
;
101 extern int psm_mailerfd
;
104 extern int activescans
;
107 extern scantype thescans
[];
109 extern int ps_cache_ext
;
110 extern int ps_scan_ext
;
111 extern int ps_extscan_ext
;
113 extern int rescaninterval
;
115 extern unsigned int normalqueuedscans
;
116 extern unsigned int prioqueuedscans
;
118 extern unsigned int ps_start_ts
;
120 extern unsigned long countpendingscan
;
122 extern unsigned long scanspermin
;
124 /* proxyscancache.c */
125 cachehost
*addcleanhost(time_t timestamp
);
126 cachehost
*findcachehost(patricia_node_t
*node
);
127 void delcachehost(cachehost
*);
128 void dumpcachehosts();
129 void loadcachehosts();
130 unsigned int cleancount();
131 unsigned int dirtycount();
132 void cachehostinit(time_t ri
);
133 void scanall(int type
, int port
);
135 /* proxyscanalloc.c */
137 void freescan(scan
*sp
);
138 cachehost
*getcachehost();
139 void freecachehost(cachehost
*chp
);
140 foundproxy
*getfoundproxy();
141 void freefoundproxy(foundproxy
*fpp
);
142 pendingscan
*getpendingscan();
143 void freependingscan(pendingscan
*psp
);
145 extrascan
*getextrascan();
146 void freeextrascan(extrascan
*esp
);
148 /* proxyscanlisten.c */
149 int openlistensocket(int portnum
);
150 void handlelistensocket(int fd
, short events
);
152 /* proxyscanconnect.c */
153 int createconnectsocket(long ip
, int socknum
);
156 void loggline(cachehost
*chp
, patricia_node_t
*node
);
157 void proxyscandbclose();
158 int proxyscandbinit();
159 int proxyscandolistopen(void *sender
, int cargc
, char **cargv
);
160 void proxyscanspewip(nick
*mynick
, nick
*usernick
, unsigned long a
, unsigned long b
, unsigned long c
, unsigned long d
);
161 void proxyscanshowkill(nick
*mynick
, nick
*usernick
, unsigned long a
);
162 const char *scantostr(int type
);
164 #if defined(PROXYSCAN_MAIL)
165 /* proxyscanmail.c */
166 void ps_makereportmail(scanhost
*shp
);
169 /* proxyscanqueue.c */
170 void queuescan(patricia_node_t
*node
, short scantype
, unsigned short port
, char class, time_t when
);
171 void startqueuedscans();
174 void startscan(patricia_node_t
*node
, int type
, int port
, int class);
175 void startnickscan(nick
*nick
);
178 unsigned int extrascancount();
179 void loadextrascans();
180 extrascan
*findextrascan(patricia_node_t
*node
);
181 void delextrascan(extrascan
*esp
);
182 extrascan
*addextrascan(unsigned short port
, unsigned char type
);