comparison src/scanner.h @ 75:1142e46be550

start coding on new config syntax
author carl
date Wed, 13 Jul 2005 23:04:14 -0700
parents b7449114ebb0
children 81f1e400e8ab
comparison
equal deleted inserted replaced
74:b7449114ebb0 75:1142e46be550
29 bool excessive_hosts(int limit) {return (limit > 0) && (hosts.size() > limit); }; 29 bool excessive_hosts(int limit) {return (limit > 0) && (hosts.size() > limit); };
30 }; 30 };
31 31
32 32
33 //////////////////////////////////////////////// 33 ////////////////////////////////////////////////
34 // finite state machine
35 //
36 enum state {// host name recognizer states
37 h_init,
38 h_host,
39
40 // html tag discarder states
41 t_init,
42 t_tag1, // seen opening <
43 t_tag2, // not comment
44 t_com1, // seen !
45 t_com2, // seen first -
46 t_com3, // seen second -, looking for -->
47 t_com4, // seen first -
48 t_com5, // seen second -
49 t_disc, // looking for closing >
50
51 // url recognizer states
52 u_init,
53 u_http,
54 u_sla,
55 u_url,
56
57 // url decoder states %xx
58 d_init,
59 d_pcnt,
60 d_1,
61
62 // html entity decoder states &#nnn;
63 e_init,
64 e_amp,
65 e_num,
66
67 // mime decoder states =xx
68 m_init,
69 m_eq,
70 m_1,
71
72 // base64 decoder states
73 b_init,
74 b_lf,
75 b_lf2,
76 b_64,
77
78 // uuencoding decoder states
79 uu_init,
80 uu_lf,
81 uu_lf2,
82 uu_64,
83
84 // counter for number of columns in the table
85 end_state,
86
87 // temporary states
88 h_end,
89 t_bin,
90 t_end,
91 u_reco,
92 d_2,
93 e_semi,
94 m_2,
95 m_cr,
96 m_nl,
97 b_cr,
98 uu_cr
99 };
100
101 #define PENDING_LIMIT 100
102 class fsa {
103 u_char pending[PENDING_LIMIT];
104 int count;
105 state st;
106 state init;
107 fsa *next1;
108 fsa *next2;
109 recorder *memory;
110
111 public:
112 fsa(state init, fsa *next1_, fsa *next2_, recorder *memory_);
113 void push(u_char *buf, int len);
114 void pusher();
115 void error(char *err);
116 };
117
118
119 ////////////////////////////////////////////////
120 // the content scanner 34 // the content scanner
121 // 35 //
36 class fsa;
122 class url_scanner { 37 class url_scanner {
123 fsa *host_parser; 38 fsa *host_parser;
124 fsa *tags_parser; 39 fsa *tags_parser;
125 fsa *urls_parser; 40 fsa *urls_parser;
126 fsa *urld_parser; 41 fsa *urld_parser;