diff src/scanner.cpp @ 75:1142e46be550

start coding on new config syntax
author carl
date Wed, 13 Jul 2005 23:04:14 -0700
parents b7449114ebb0
children 81f1e400e8ab
line wrap: on
line diff
--- a/src/scanner.cpp	Sun Jul 10 14:19:00 2005 -0700
+++ b/src/scanner.cpp	Wed Jul 13 23:04:14 2005 -0700
@@ -10,6 +10,92 @@
 
 static char* scanner_version="$Id$";
 
+////////////////////////////////////////////////
+// finite state machine
+//
+enum state {// host name recognizer states
+            h_init,
+            h_host,
+
+            // html tag discarder states
+            t_init,
+            t_tag1,     // seen opening <
+            t_tag2,     // not comment
+            t_com1,     // seen !
+            t_com2,     // seen first -
+            t_com3,     // seen second -, looking for -->
+            t_com4,     // seen first -
+            t_com5,     // seen second -
+            t_disc,     // looking for closing >
+
+            // url recognizer states
+            u_init,
+            u_http,
+            u_sla,
+            u_url,
+
+            // url decoder states  %xx
+            d_init,
+            d_pcnt,
+            d_1,
+
+            // html entity decoder states &#nnn;
+            e_init,
+            e_amp,
+            e_num,
+
+            // mime decoder states =xx
+            m_init,
+            m_eq,
+            m_1,
+
+            // base64 decoder states
+            b_init,
+            b_lf,
+            b_lf2,
+            b_64,
+
+            // uuencoding decoder states
+            uu_init,
+            uu_lf,
+            uu_lf2,
+            uu_64,
+
+            // counter for number of columns in the table
+            end_state,
+
+            // temporary states
+            h_end,
+            t_bin,
+            t_end,
+            u_reco,
+            d_2,
+            e_semi,
+            m_2,
+            m_cr,
+            m_nl,
+            b_cr,
+            uu_cr
+           };
+
+#define PENDING_LIMIT 100
+class fsa {
+    u_char      pending[PENDING_LIMIT];
+    int         count;
+    state       st;
+    state       init;
+    fsa         *next1;
+    fsa         *next2;
+    recorder    *memory;
+
+public:
+    fsa(state init, fsa *next1_, fsa *next2_, recorder *memory_);
+    void push(u_char *buf, int len);
+    void pusher();
+    void error(char *err);
+};
+
+
 typedef state PARSE[end_state];
 
 static PARSE parse_table[256] = {