annotate src/scanner.h @ 122:e8971c595845 stable-5-14

fix typo in multi.surbl.org name
author carl
date Mon, 13 Mar 2006 08:45:54 -0800
parents aa07452e641b
children ecb40aa3eaa5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
1 #ifndef scanner_include
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
2 #define scanner_include
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
3
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
4 #include "dnsbl.h"
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
5
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
6 ////////////////////////////////////////////////
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
7 // memory for the content scanner
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
8 //
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
9 class recorder
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
10 {
117
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
11 mlfiPriv *priv; // needed for syslog
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
12 string_set *html_tags; // valid tags
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
13 string_set *tlds; // valid tlds
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
14 string_set *cctlds; // valid cctlds
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
15 string_set hosts;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
16 int bad_html_tags;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
17 int binary_tags;
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
18
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
19 public:
117
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
20 recorder(mlfiPriv *priv_, string_set &html_tags_, string_set &tlds_, string_set &cctlds_);
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
21 ~recorder() { empty(); };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
22 void empty();
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
23 void new_url(char *host);
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
24 void new_tag(char *tag);
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
25 void binary();
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
26 mlfiPriv *get_priv() { return priv; };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
27 string_set *get_cctlds() { return cctlds; };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
28 string_set *get_tlds() { return tlds; };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
29 string_set &get_hosts() { return hosts; };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
30 bool excessive_bad_tags(int limit) { return (limit > 0) && (bad_html_tags > limit) && (bad_html_tags > 3*binary_tags); };
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
31 bool excessive_hosts(int limit) { return (limit > 0) && (hosts.size() > limit); };
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
32 };
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
33
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
34
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
35 ////////////////////////////////////////////////
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
36 // the content scanner
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
37 //
75
1142e46be550 start coding on new config syntax
carl
parents: 74
diff changeset
38 class fsa;
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
39 class url_scanner {
117
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
40 fsa *host_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
41 fsa *tags_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
42 fsa *urls_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
43 fsa *urld_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
44 fsa *html_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
45 fsa *mime_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
46 fsa *b64_parser;
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
47 fsa *uu_parser;
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
48
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
49 public:
117
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
50 url_scanner(recorder *memory);
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
51 ~url_scanner();
aa07452e641b uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 76
diff changeset
52 void scan(u_char *buffer, size_t length);
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
53 };
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
54
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
55 #endif