3 #define FILTERS_H_VERSION "$Id: filters.h,v 1.10 2001/06/29 13:29:01 oes 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.10 2001/06/29 13:29:01 oes
44 * Cleaned up and updated to reflect the changesin
47 * Revision 1.9 2001/06/07 23:10:53 jongfoster
48 * Replacing struct gateway with struct forward_spec
50 * Revision 1.8 2001/06/03 19:12:00 oes
51 * extracted-CGI relevant stuff
53 * Revision 1.7 2001/05/31 21:21:30 jongfoster
54 * Permissionsfile / actions file changes:
55 * - Changed "permission" to "action" throughout
56 * - changes to file format to allow string parameters
57 * - Moved helper functions to actions.c
59 * Revision 1.6 2001/05/29 09:50:24 jongfoster
60 * Unified blocklist/imagelist/permissionslist.
61 * File format is still under discussion, but the internal changes
64 * Also modified interceptor behaviour:
65 * - We now intercept all URLs beginning with one of the following
66 * prefixes (and *only* these prefixes):
68 * * http://ijbswa.sf.net/config/
69 * * http://ijbswa.sourceforge.net/config/
70 * - New interceptors "home page" - go to http://i.j.b/ to see it.
71 * - Internal changes so that intercepted and fast redirect pages
72 * are not replaced with an image.
73 * - Interceptors now have the option to send a binary page direct
74 * to the client. (i.e. ijb-send-banner uses this)
75 * - Implemented show-url-info interceptor. (Which is why I needed
76 * the above interceptors changes - a typical URL is
77 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
78 * The previous mechanism would not have intercepted that, and
79 * if it had been intercepted then it then it would have replaced
82 * Revision 1.5 2001/05/27 22:17:04 oes
84 * - re_process_buffer no longer writes the modified buffer
85 * to the client, which was very ugly. It now returns the
86 * buffer, which it is then written by chat.
88 * - content_length now adjusts the Content-Length: header
89 * for modified documents rather than crunch()ing it.
90 * (Length info in csp->content_length, which is 0 for
91 * unmodified documents)
93 * - For this to work, sed() is called twice when filtering.
95 * Revision 1.4 2001/05/26 15:26:15 jongfoster
96 * ACL feature now provides more security by immediately dropping
97 * connections from untrusted hosts.
99 * Revision 1.3 2001/05/22 18:46:04 oes
101 * - Enabled filtering banners by size rather than URL
102 * by adding patterns that replace all standard banner
103 * sizes with the "Junkbuster" gif to the re_filterfile
105 * - Enabled filtering WebBugs by providing a pattern
106 * which kills all 1x1 images
108 * - Added support for PCRE_UNGREEDY behaviour to pcrs,
109 * which is selected by the (nonstandard and therefore
110 * capital) letter 'U' in the option string.
111 * It causes the quantifiers to be ungreedy by default.
112 * Appending a ? turns back to greedy (!).
114 * - Added a new interceptor ijb-send-banner, which
115 * sends back the "Junkbuster" gif. Without imagelist or
116 * MSIE detection support, or if tinygif = 1, or the
117 * URL isn't recognized as an imageurl, a lame HTML
118 * explanation is sent instead.
120 * - Added new feature, which permits blocking remote
121 * script redirects and firing back a local redirect
123 * The feature is conditionally compiled, i.e. it
124 * can be disabled with --disable-fast-redirects,
125 * plus it must be activated by a "fast-redirects"
126 * line in the config file, has its own log level
127 * and of course wants to be displayed by show-proxy-args
128 * Note: Boy, all the #ifdefs in 1001 locations and
129 * all the fumbling with configure.in and acconfig.h
130 * were *way* more work than the feature itself :-(
132 * - Because a generic redirect template was needed for
133 * this, tinygif = 3 now uses the same.
135 * - Moved GIFs, and other static HTTP response templates
140 * - Removed some >400 CRs again (Jon, you really worked
143 * Revision 1.2 2001/05/20 01:21:20 jongfoster
144 * Version 2.9.4 checkin.
145 * - Merged popupfile and cookiefile, and added control over PCRS
146 * filtering, in new "permissionsfile".
147 * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
148 * file error you now get a message box (in the Win32 GUI) rather
149 * than the program exiting with no explanation.
150 * - Made killpopup use the PCRS MIME-type checking and HTTP-header
152 * - Removed tabs from "config"
153 * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
154 * - Bumped up version number.
156 * Revision 1.1.1.1 2001/05/15 13:58:52 oes
157 * Initial import of version 2.9.3 source tree
160 *********************************************************************/
173 extern int block_acl(struct access_control_addr *dst, struct client_state *csp);
174 extern int acl_addr(char *aspec, struct access_control_addr *aca);
175 #endif /* def ACL_FILES */
180 extern struct http_response *block_url(struct client_state *csp);
181 extern struct http_response *redirect_url(struct client_state *csp);
183 extern struct http_response *trust_url(struct client_state *csp);
184 #endif /* def TRUST_FILES */
190 extern int is_untrusted_url(struct client_state *csp);
191 #endif /* def TRUST_FILES */
192 #ifdef IMAGE_BLOCKING
193 extern int is_imageurl(struct client_state *csp);
194 #endif /* def IMAGE_BLOCKING */
197 * Determining applicable actions
199 extern void url_actions(struct http_request *http,
200 struct client_state *csp);
201 extern void apply_url_actions(struct current_action_spec *action,
202 struct http_request *http,
203 struct url_actions *b);
205 * Determining parent proxies
207 extern const struct forward_spec *forward_url(struct http_request *http, struct client_state *csp);
209 extern struct url_spec dsplit(char *domain);
210 extern int domaincmp(struct url_spec *pattern, struct url_spec *fqdn);
213 * Content modification
215 extern char *pcrs_filter_response(struct client_state *csp);
216 extern char *gif_deanimate_response(struct client_state *csp);
219 * Revision control strings from this header and associated .c file
221 extern const char filters_rcs[];
222 extern const char filters_h_rcs[];
228 #endif /* ndef _FILTERS_H */