comparison src/scanner.h @ 214:82886d4dd71f stable-6-0-19

Fixes to compile on Fedora 9 and for const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Jun 2008 08:58:42 -0700
parents c7fc218686f5
children c0d2e99c0a1d
comparison
equal deleted inserted replaced
213:44ffef730bc4 214:82886d4dd71f
14 //////////////////////////////////////////////// 14 ////////////////////////////////////////////////
15 // memory for the content scanner 15 // memory for the content scanner
16 // 16 //
17 class recorder 17 class recorder
18 { 18 {
19 mlfiPriv *priv; // needed for syslog 19 mlfiPriv *priv; // needed for syslog
20 string_set *html_tags; // valid tags 20 string_set *html_tags; // valid tags
21 string_set *tlds; // valid tlds 21 string_set *tlds; // valid tlds
22 string_set *cctlds; // valid cctlds 22 string_set *cctlds; // valid cctlds
23 string_set hosts; 23 string_set hosts;
24 int bad_html_tags; 24 size_t bad_html_tags;
25 int binary_tags; 25 size_t binary_tags;
26 26
27 public: 27 public:
28 recorder(mlfiPriv *priv_, string_set &html_tags_, string_set &tlds_, string_set &cctlds_); 28 recorder(mlfiPriv *priv_, string_set &html_tags_, string_set &tlds_, string_set &cctlds_);
29 ~recorder() { empty(); }; 29 ~recorder() { empty(); };
30 void empty(); 30 void empty();
31 void new_url(char *host); 31 void new_url(char *host);
32 void new_tag(char *tag); 32 void new_tag(char *tag);
33 void binary(); 33 void binary();
34 void syslog(char *buf) { my_syslog(priv, buf); }; 34 void syslog(char *buf) { my_syslog(priv, buf); };
35 mlfiPriv *get_priv() { return priv; }; 35 mlfiPriv *get_priv() { return priv; };
36 string_set *get_cctlds() { return cctlds; }; 36 string_set *get_cctlds() { return cctlds; };
37 string_set *get_tlds() { return tlds; }; 37 string_set *get_tlds() { return tlds; };
38 string_set &get_hosts() { return hosts; }; 38 string_set &get_hosts() { return hosts; };
39 bool excessive_bad_tags(int limit) { return (limit > 0) && (bad_html_tags > limit) && (bad_html_tags > 3*binary_tags); }; 39 bool excessive_bad_tags(size_t limit){ return (limit > 0) && (bad_html_tags > limit) && (bad_html_tags > 3*binary_tags); };
40 bool excessive_hosts(int limit) { return (limit > 0) && (hosts.size() > limit); }; 40 bool excessive_hosts(size_t limit) { return (limit > 0) && (hosts.size() > limit); };
41 41
42 }; 42 };
43 43
44 44
45 //////////////////////////////////////////////// 45 ////////////////////////////////////////////////
46 // the content scanner 46 // the content scanner
47 // 47 //
48 class fsa; 48 class fsa;
49 class url_scanner { 49 class url_scanner {
50 fsa *host_parser; 50 fsa *host_parser;
51 fsa *tags_parser; 51 fsa *tags_parser;
52 fsa *urls_parser; 52 fsa *urls_parser;
53 fsa *urld_parser; 53 fsa *urld_parser;
54 fsa *html_parser; 54 fsa *html_parser;
55 fsa *mime_parser; 55 fsa *mime_parser;
56 fsa *b64_parser; 56 fsa *b64_parser;
57 fsa *uu_parser; 57 fsa *uu_parser;
58 58
59 public: 59 public:
60 url_scanner(recorder *memory); 60 url_scanner(recorder *memory);
61 ~url_scanner(); 61 ~url_scanner();
62 void scan(u_char *buffer, size_t length); 62 void scan(u_char *buffer, size_t length);
63 }; 63 };
64 64
65 #endif 65 #endif