]>
jfr.im git - irc/quakenet/newserv.git/blob - proxyscan/proxyscanext.c
3 * This file deals with extended ports to scan.
9 #include "../core/error.h"
12 extrascan
*addextrascan(unsigned short port
, unsigned char type
) {
22 void delextrascan(extrascan
*esp
) {
27 * Returns a cachehost * for the named IP
30 extrascan
*findextrascan(patricia_node_t
*node
) {
33 if( (extrascan
*)node
->exts
[ps_extscan_ext
] ) {
34 esp
= (extrascan
*)node
->exts
[ps_extscan_ext
];
36 /* valid: return it */
41 /* Not found: return NULL */
45 void loadextrascans() {
52 struct irc_in_addr sin
;
54 patricia_node_t
*node
;
56 if ((fp
=fopen("data/ports.txt","r"))==NULL
) {
57 Error("proxyscan",ERR_ERROR
,"Unable to open ports file for reading!");
68 res
=sscanf(buf
,"%s %hu",ip
,&port
);
73 if (0 == ipmask_parse(ip
,&sin
, &bits
)) {
76 node
= refnode(iptree
, &sin
, bits
);
78 esp
=addextrascan(port
, STYPE_SOCKS4
);
79 esp
->nextbynode
= (extrascan
*)node
->exts
[ps_extscan_ext
];
80 node
->exts
[ps_extscan_ext
] = esp
;
82 esp
=addextrascan(port
, STYPE_SOCKS5
);
83 esp
->nextbynode
= (extrascan
*)node
->exts
[ps_extscan_ext
];
84 node
->exts
[ps_extscan_ext
] = esp
;
86 esp
=addextrascan(port
, STYPE_HTTP
);
87 esp
->nextbynode
= (extrascan
*)node
->exts
[ps_extscan_ext
];
88 node
->exts
[ps_extscan_ext
] = esp
;
95 unsigned int extrascancount() {
98 patricia_node_t
*node
;
100 PATRICIA_WALK (iptree
->head
, node
) {
101 if ( node
->exts
[ps_extscan_ext
] ) {
102 esp
= (extrascan
*) node
->exts
[ps_extscan_ext
];