]>
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
24 #define SOUTCOME_INPROGRESS 0
25 #define SOUTCOME_OPEN 1
26 #define SOUTCOME_CLOSED 2
28 #define SCLASS_NORMAL 0
29 #define SCLASS_CHECK 1
30 #define SCLASS_PASS2 2
31 #define SCLASS_PASS3 3
32 #define SCLASS_PASS4 4
34 typedef struct scantype
{
40 typedef struct pendingscan
{
46 struct pendingscan
*next
;
49 typedef struct foundproxy
{
52 struct foundproxy
*next
;
55 typedef struct cachehost
{
61 #if defined(PROXYSCAN_MAIL)
62 sstring
*lasthostmask
; /* Not saved to disk */
63 time_t lastconnect
; /* Not saved to disk */
65 struct cachehost
*next
;
74 unsigned short outcome
;
78 char readbuf
[PSCAN_READBUFSIZE
];
83 #if defined(PROXYSCAN_MAIL)
84 extern unsigned int ps_mailip
;
85 extern unsigned int ps_mailport
;
86 extern sstring
*ps_mailname
;
87 extern int psm_mailerfd
;
90 extern int activescans
;
93 extern scantype thescans
[];
96 extern unsigned int normalqueuedscans
;
97 extern unsigned int prioqueuedscans
;
99 /* proxyscancache.c */
100 cachehost
*addcleanhost(unsigned long IP
, time_t timestamp
);
101 cachehost
*findcachehost(unsigned long IP
);
102 void delcachehost(cachehost
*);
103 void dumpcachehosts();
104 void loadcachehosts();
105 unsigned int cleancount();
106 unsigned int dirtycount();
107 void cachehostinit(time_t ri
);
108 void scanall(int type
, int port
);
110 /* proxyscanalloc.c */
112 void freescan(scan
*sp
);
113 cachehost
*getcachehost();
114 void freecachehost(cachehost
*chp
);
115 foundproxy
*getfoundproxy();
116 void freefoundproxy(foundproxy
*fpp
);
117 pendingscan
*getpendingscan();
118 void freependingscan(pendingscan
*psp
);
121 /* proxyscanlisten.c */
122 int openlistensocket(int portnum
);
123 void handlelistensocket(int fd
, short events
);
125 /* proxyscanconnect.c */
126 int createconnectsocket(long ip
, int socknum
);
129 void loggline(cachehost
*chp
);
130 void proxyscandbclose();
131 int proxyscandbinit();
132 void proxyscandolistopen(nick
*mynick
, nick
*usernick
, time_t snce
);
133 const char *scantostr(int type
);
135 #if defined(PROXYSCAN_MAIL)
136 /* proxyscanmail.c */
137 void ps_makereportmail(scanhost
*shp
);
140 /* proxyscanqueue.c */
141 void queuescan(unsigned int IP
, short scantype
, unsigned short port
, char class, time_t when
);
142 void startqueuedscans();
145 void startscan(unsigned int IP
, int type
, int port
, int class);