1 #ifndef FILTERS_H_INCLUDED
2 #define FILTERS_H_INCLUDED
3 #define FILTERS_H_VERSION "$Id: filters.h,v 1.12 2001/07/29 19:01:11 jongfoster Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/filters.h,v $
8 * Purpose : Declares functions to parse/crunch headers and pages.
9 * Functions declared include:
10 * `acl_addr', `add_stats', `block_acl', `block_imageurl',
11 * `block_url', `url_actions', `domaincmp', `dsplit',
12 * `filter_popups', `forward_url'
13 * `ij_untrusted_url', `intercept_url', `re_process_buffer',
14 * `show_proxy_args', and `trust_url'
16 * Copyright : Written by and Copyright (C) 2001 the SourceForge
17 * IJBSWA team. http://ijbswa.sourceforge.net
19 * Based on the Internet Junkbuster originally written
20 * by and Copyright (C) 1997 Anonymous Coders and
21 * Junkbusters Corporation. http://www.junkbusters.com
23 * This program is free software; you can redistribute it
24 * and/or modify it under the terms of the GNU General
25 * Public License as published by the Free Software
26 * Foundation; either version 2 of the License, or (at
27 * your option) any later version.
29 * This program is distributed in the hope that it will
30 * be useful, but WITHOUT ANY WARRANTY; without even the
31 * implied warranty of MERCHANTABILITY or FITNESS FOR A
32 * PARTICULAR PURPOSE. See the GNU General Public
33 * License for more details.
35 * The GNU General Public License should be included with
36 * this file. If not, you can view it at
37 * http://www.gnu.org/copyleft/gpl.html
38 * or write to the Free Software Foundation, Inc., 59
39 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
43 * Revision 1.12 2001/07/29 19:01:11 jongfoster
44 * Changed _FILENAME_H to FILENAME_H_INCLUDED.
45 * Added forward declarations for needed structures.
47 * Revision 1.11 2001/07/13 14:00:18 oes
48 * - Introduced gif_deanimate_response
49 * - Renamed re_process_buffer to pcrs_filter_response
50 * - Removed all #ifdef PCRS
52 * Revision 1.10 2001/06/29 13:29:01 oes
53 * Cleaned up and updated to reflect the changesin
56 * Revision 1.9 2001/06/07 23:10:53 jongfoster
57 * Replacing struct gateway with struct forward_spec
59 * Revision 1.8 2001/06/03 19:12:00 oes
60 * extracted-CGI relevant stuff
62 * Revision 1.7 2001/05/31 21:21:30 jongfoster
63 * Permissionsfile / actions file changes:
64 * - Changed "permission" to "action" throughout
65 * - changes to file format to allow string parameters
66 * - Moved helper functions to actions.c
68 * Revision 1.6 2001/05/29 09:50:24 jongfoster
69 * Unified blocklist/imagelist/permissionslist.
70 * File format is still under discussion, but the internal changes
73 * Also modified interceptor behaviour:
74 * - We now intercept all URLs beginning with one of the following
75 * prefixes (and *only* these prefixes):
77 * * http://ijbswa.sf.net/config/
78 * * http://ijbswa.sourceforge.net/config/
79 * - New interceptors "home page" - go to http://i.j.b/ to see it.
80 * - Internal changes so that intercepted and fast redirect pages
81 * are not replaced with an image.
82 * - Interceptors now have the option to send a binary page direct
83 * to the client. (i.e. ijb-send-banner uses this)
84 * - Implemented show-url-info interceptor. (Which is why I needed
85 * the above interceptors changes - a typical URL is
86 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
87 * The previous mechanism would not have intercepted that, and
88 * if it had been intercepted then it then it would have replaced
91 * Revision 1.5 2001/05/27 22:17:04 oes
93 * - re_process_buffer no longer writes the modified buffer
94 * to the client, which was very ugly. It now returns the
95 * buffer, which it is then written by chat.
97 * - content_length now adjusts the Content-Length: header
98 * for modified documents rather than crunch()ing it.
99 * (Length info in csp->content_length, which is 0 for
100 * unmodified documents)
102 * - For this to work, sed() is called twice when filtering.
104 * Revision 1.4 2001/05/26 15:26:15 jongfoster
105 * ACL feature now provides more security by immediately dropping
106 * connections from untrusted hosts.
108 * Revision 1.3 2001/05/22 18:46:04 oes
110 * - Enabled filtering banners by size rather than URL
111 * by adding patterns that replace all standard banner
112 * sizes with the "Junkbuster" gif to the re_filterfile
114 * - Enabled filtering WebBugs by providing a pattern
115 * which kills all 1x1 images
117 * - Added support for PCRE_UNGREEDY behaviour to pcrs,
118 * which is selected by the (nonstandard and therefore
119 * capital) letter 'U' in the option string.
120 * It causes the quantifiers to be ungreedy by default.
121 * Appending a ? turns back to greedy (!).
123 * - Added a new interceptor ijb-send-banner, which
124 * sends back the "Junkbuster" gif. Without imagelist or
125 * MSIE detection support, or if tinygif = 1, or the
126 * URL isn't recognized as an imageurl, a lame HTML
127 * explanation is sent instead.
129 * - Added new feature, which permits blocking remote
130 * script redirects and firing back a local redirect
132 * The feature is conditionally compiled, i.e. it
133 * can be disabled with --disable-fast-redirects,
134 * plus it must be activated by a "fast-redirects"
135 * line in the config file, has its own log level
136 * and of course wants to be displayed by show-proxy-args
137 * Note: Boy, all the #ifdefs in 1001 locations and
138 * all the fumbling with configure.in and acconfig.h
139 * were *way* more work than the feature itself :-(
141 * - Because a generic redirect template was needed for
142 * this, tinygif = 3 now uses the same.
144 * - Moved GIFs, and other static HTTP response templates
149 * - Removed some >400 CRs again (Jon, you really worked
152 * Revision 1.2 2001/05/20 01:21:20 jongfoster
153 * Version 2.9.4 checkin.
154 * - Merged popupfile and cookiefile, and added control over PCRS
155 * filtering, in new "permissionsfile".
156 * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
157 * file error you now get a message box (in the Win32 GUI) rather
158 * than the program exiting with no explanation.
159 * - Made killpopup use the PCRS MIME-type checking and HTTP-header
161 * - Removed tabs from "config"
162 * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
163 * - Bumped up version number.
165 * Revision 1.1.1.1 2001/05/15 13:58:52 oes
166 * Initial import of version 2.9.3 source tree
169 *********************************************************************/
179 struct access_control_addr;
182 struct http_response;
183 struct current_action_spec;
192 extern int block_acl(struct access_control_addr *dst, struct client_state *csp);
193 extern int acl_addr(char *aspec, struct access_control_addr *aca);
194 #endif /* def FEATURE_ACL */
199 extern struct http_response *block_url(struct client_state *csp);
200 extern struct http_response *redirect_url(struct client_state *csp);
201 #ifdef FEATURE_COOKIE_JAR
202 extern struct http_response *trust_url(struct client_state *csp);
203 #endif /* def FEATURE_COOKIE_JAR */
208 #ifdef FEATURE_COOKIE_JAR
209 extern int is_untrusted_url(struct client_state *csp);
210 #endif /* def FEATURE_COOKIE_JAR */
211 #ifdef FEATURE_IMAGE_BLOCKING
212 extern int is_imageurl(struct client_state *csp);
213 #endif /* def FEATURE_IMAGE_BLOCKING */
216 * Determining applicable actions
218 extern void url_actions(struct http_request *http,
219 struct client_state *csp);
220 extern void apply_url_actions(struct current_action_spec *action,
221 struct http_request *http,
222 struct url_actions *b);
224 * Determining parent proxies
226 extern const struct forward_spec *forward_url(struct http_request *http, struct client_state *csp);
228 extern struct url_spec dsplit(char *domain);
229 extern int domaincmp(struct url_spec *pattern, struct url_spec *fqdn);
232 * Content modification
234 extern char *pcrs_filter_response(struct client_state *csp);
235 extern char *gif_deanimate_response(struct client_state *csp);
238 * Revision control strings from this header and associated .c file
240 extern const char filters_rcs[];
241 extern const char filters_h_rcs[];
247 #endif /* ndef FILTERS_H_INCLUDED */