75 struct v_globals { |
75 struct v_globals { |
76 unsigned short int debugmode; /* debug level */ |
76 unsigned short int debugmode; /* debug level */ |
77 char dbname[128]; /* path to database file */ |
77 char dbname[128]; /* path to database file */ |
78 struct sqlite3 *db; /* database handle */ |
78 struct sqlite3 *db; /* database handle */ |
79 |
79 |
|
80 /* prepared statements */ |
|
81 struct { |
|
82 struct sqlite3_stmt *match_request; |
|
83 struct sqlite3_stmt *get_rewrite_rule; |
|
84 } db_stmt; |
|
85 |
80 struct { |
86 struct { |
81 time_t start; /* start time */ |
87 time_t start; /* start time */ |
82 unsigned long int lines; /* line count for determining speed */ |
88 unsigned long int lines; /* line count for determining speed */ |
83 } timer; |
89 } timer; |
84 }; |
90 }; |
113 unsigned short int c_ip_length; |
119 unsigned short int c_ip_length; |
114 } tokens; |
120 } tokens; |
115 } request; |
121 } request; |
116 |
122 |
117 /* |
123 /* |
|
124 * The URL elements to rewrite a user's request into. |
|
125 * |
|
126 */ |
|
127 typedef struct rewrite { |
|
128 char *scheme; |
|
129 char *host; |
|
130 char *path; |
|
131 unsigned short int port; |
|
132 unsigned short int redir; |
|
133 } rewrite; |
|
134 |
|
135 |
|
136 /* |
118 * |
137 * |
119 * Function prototypes |
138 * Function prototypes |
120 * |
139 * |
121 */ |
140 */ |
122 int getopt( int, char * const [], const char *); |
141 int getopt( int, char * const [], const char *); |
129 char *slurp_file( char * ); |
148 char *slurp_file( char * ); |
130 char *extend_line( char *, const char * ); |
149 char *extend_line( char *, const char * ); |
131 char *copy_string_token( char *, unsigned short int ); |
150 char *copy_string_token( char *, unsigned short int ); |
132 struct in_addr *copy_ipv4_token( char *, unsigned short int ); |
151 struct in_addr *copy_ipv4_token( char *, unsigned short int ); |
133 |
152 |
|
153 void shutdown_handler( int ); |
|
154 void shutdown_actions( void ); |
134 int accept_loop( void ); |
155 int accept_loop( void ); |
135 void process( char * ); |
156 void process( char * ); |
136 request *parse( char * ); |
157 request *parse( char * ); |
137 request *init_request( void ); |
158 request *init_request( void ); |
138 void populate_request( request * ); |
159 void populate_request( request * ); |
139 void parse_tld( request * ); |
160 void parse_tld( request * ); |
140 void cleanup_request( request * ); |
161 void parse_port( request * ); |
|
162 void finish_request( request * ); |
141 |
163 |
142 #endif |
164 #endif |
143 |
165 |