Replace TABs by spaces in source code.
[privoxy.git] / actionlist.h
1 /*********************************************************************
2  *
3  * File        :  $Source: /cvsroot/ijbswa/current/actionlist.h,v $
4  *
5  * Purpose     :  Master list of supported actions.
6  *                Not really a header, since it generates code.
7  *                This is included (3 times!) from actions.c
8  *                Each time, the following macros are defined to
9  *                suitable values beforehand:
10  *                    DEFINE_ACTION_MULTI()
11  *                    DEFINE_ACTION_STRING()
12  *                    DEFINE_ACTION_BOOL()
13  *                    DEFINE_ACTION_ALIAS
14  *
15  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
16  *                Privoxy team. http://www.privoxy.org/
17  *
18  *                Based on the Internet Junkbuster originally written
19  *                by and Copyright (C) 1997 Anonymous Coders and 
20  *                Junkbusters Corporation.  http://www.junkbusters.com
21  *
22  *                This program is free software; you can redistribute it 
23  *                and/or modify it under the terms of the GNU General
24  *                Public License as published by the Free Software
25  *                Foundation; either version 2 of the License, or (at
26  *                your option) any later version.
27  *
28  *                This program is distributed in the hope that it will
29  *                be useful, but WITHOUT ANY WARRANTY; without even the
30  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
31  *                PARTICULAR PURPOSE.  See the GNU General Public
32  *                License for more details.
33  *
34  *                The GNU General Public License should be included with
35  *                this file.  If not, you can view it at
36  *                http://www.gnu.org/copyleft/gpl.html
37  *                or write to the Free Software Foundation, Inc., 59
38  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39  *
40  * Revisions   :
41  *    $Log: actionlist.h,v $
42  *    Revision 1.21  2006/08/14 08:25:19  fabiankeil
43  *    Split filter-headers{} into filter-client-headers{}
44  *    and filter-server-headers{}.
45  *    Added parse_header_time() to share some code.
46  *    Replaced timegm() with mktime().
47  *
48  *    Revision 1.20  2006/08/03 02:46:41  david__schmidt
49  *    Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
50  *
51  *    Revision 1.19  2006/07/18 14:48:45  david__schmidt
52  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
53  *    with what was really the latest development (the v_3_0_branch branch)
54  *
55  *    Revision 1.17.2.3  2004/10/03 12:53:32  david__schmidt
56  *    Add the ability to check jpeg images for invalid
57  *    lengths of comment blocks.  Defensive strategy
58  *    against the exploit:
59  *       Microsoft Security Bulletin MS04-028
60  *       Buffer Overrun in JPEG Processing (GDI+) Could
61  *       Allow Code Execution (833987)
62  *    Enabled with +inspect-jpegs in actions files.
63  *
64  *    Revision 1.17.2.2  2002/09/25 15:25:25  oes
65  *    Added more aliases for prehistoric action names
66  *
67  *    Revision 1.17.2.1  2002/08/02 12:50:47  oes
68  *    Consistency with docs: Change default name for action from hide-referer to hide-referrer
69  *
70  *    Revision 1.17  2002/05/14 21:25:55  oes
71  *    Renamed prevent-(setting/reading)-cookies to crunch-(incoming/outgoing)-cookies
72  *
73  *    Revision 1.16  2002/04/24 02:15:18  oes
74  *    Renamed actions as discussed, Aliased old action names to new ones.
75  *
76  *    Revision 1.15  2002/03/26 22:29:54  swa
77  *    we have a new homepage!
78  *
79  *    Revision 1.14  2002/03/24 16:32:08  jongfoster
80  *    Removing logo option
81  *
82  *    Revision 1.13  2002/03/24 15:23:33  jongfoster
83  *    Name changes
84  *
85  *    Revision 1.12  2002/03/24 13:25:43  swa
86  *    name change related issues
87  *
88  *    Revision 1.11  2002/03/12 01:42:49  oes
89  *    Introduced modular filters
90  *
91  *    Revision 1.10  2002/03/08 18:19:14  jongfoster
92  *    Adding +image-blocker{pattern} option to edit interface
93  *
94  *    Revision 1.9  2001/11/22 21:58:41  jongfoster
95  *    Adding action +no-cookies-keep
96  *
97  *    Revision 1.8  2001/10/10 16:42:52  oes
98  *    Fixed a bug, Added +limit-connect string action
99  *
100  *    Revision 1.7  2001/10/07 15:33:59  oes
101  *    Introduced a +no-compression action
102  *    Introduced a +downgrade action
103  *
104  *    Revision 1.6  2001/09/16 15:47:37  jongfoster
105  *    First version of CGI-based edit interface.  This is very much a
106  *    work-in-progress, and you can't actually use it to edit anything
107  *    yet.  You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
108  *    to have any effect.
109  *
110  *    Revision 1.5  2001/07/18 12:27:03  oes
111  *    Changed deanimate-gifs to string action
112  *
113  *    Revision 1.4  2001/07/13 13:52:12  oes
114  *     - Formatting
115  *     - Introduced new action ACTION_DEANIMATE
116  *
117  *    Revision 1.3  2001/06/07 23:03:56  jongfoster
118  *    Added standard comment at top of file.
119  *
120  *
121  *********************************************************************/
122 \f
123
124 #if !(defined(DEFINE_ACTION_BOOL) && defined(DEFINE_ACTION_MULTI) && defined(DEFINE_ACTION_STRING))
125 #error Please define lots of macros before including "actionlist.h".
126 #endif /* !defined(all the DEFINE_ACTION_xxx macros) */
127
128 #ifndef DEFINE_CGI_PARAM_RADIO
129 #define DEFINE_CGI_PARAM_RADIO(name, bit, index, value, is_default)
130 #define DEFINE_CGI_PARAM_CUSTOM(name, bit, index, default_val)
131 #define DEFINE_CGI_PARAM_NO_RADIO(name, bit, index, default_val)
132 #endif /* ndef DEFINE_CGI_PARAM_RADIO */
133
134 DEFINE_ACTION_MULTI      ("add-header",                 ACTION_MULTI_ADD_HEADER)
135 DEFINE_ACTION_BOOL       ("block",                      ACTION_BLOCK)
136 DEFINE_ACTION_STRING     ("content-type-overwrite",     ACTION_CONTENT_TYPE_OVERWRITE, ACTION_STRING_CONTENT_TYPE)
137 DEFINE_CGI_PARAM_NO_RADIO("content-type-overwrite",     ACTION_CONTENT_TYPE_OVERWRITE, ACTION_STRING_CONTENT_TYPE,    "text/html")
138 DEFINE_ACTION_STRING     ("crunch-client-header",       ACTION_CRUNCH_CLIENT_HEADER, ACTION_STRING_CLIENT_HEADER)
139 DEFINE_CGI_PARAM_NO_RADIO("crunch-client-header",       ACTION_CRUNCH_CLIENT_HEADER, ACTION_STRING_CLIENT_HEADER,          "X-Whatever:")
140 DEFINE_ACTION_BOOL       ("crunch-if-none-match",       ACTION_CRUNCH_IF_NONE_MATCH)
141 DEFINE_ACTION_BOOL       ("crunch-incoming-cookies",    ACTION_NO_COOKIE_SET)
142 DEFINE_ACTION_BOOL       ("crunch-outgoing-cookies",    ACTION_NO_COOKIE_READ)
143 DEFINE_ACTION_STRING     ("crunch-server-header",       ACTION_CRUNCH_SERVER_HEADER, ACTION_STRING_SERVER_HEADER)
144 DEFINE_CGI_PARAM_NO_RADIO("crunch-server-header",       ACTION_CRUNCH_SERVER_HEADER, ACTION_STRING_SERVER_HEADER,          "X-Whatever:")
145 DEFINE_ACTION_STRING     ("deanimate-gifs",             ACTION_DEANIMATE,       ACTION_STRING_DEANIMATE)
146 DEFINE_CGI_PARAM_RADIO   ("deanimate-gifs",             ACTION_DEANIMATE,       ACTION_STRING_DEANIMATE,     "first", 0)
147 DEFINE_CGI_PARAM_RADIO   ("deanimate-gifs",             ACTION_DEANIMATE,       ACTION_STRING_DEANIMATE,     "last",  1)
148 DEFINE_ACTION_BOOL       ("downgrade-http-version",     ACTION_DOWNGRADE)
149 DEFINE_ACTION_STRING     ("fast-redirects",             ACTION_FAST_REDIRECTS,  ACTION_STRING_FAST_REDIRECTS)
150 DEFINE_CGI_PARAM_RADIO   ("fast-redirects",             ACTION_FAST_REDIRECTS,  ACTION_STRING_FAST_REDIRECTS, "simple-check",  0)
151 DEFINE_CGI_PARAM_RADIO   ("fast-redirects",             ACTION_FAST_REDIRECTS,  ACTION_STRING_FAST_REDIRECTS, "check-decoded-url",  1)
152 DEFINE_ACTION_MULTI      ("filter",                     ACTION_MULTI_FILTER)
153 DEFINE_ACTION_BOOL       ("filter-client-headers",      ACTION_FILTER_CLIENT_HEADERS)
154 DEFINE_ACTION_BOOL       ("filter-server-headers",      ACTION_FILTER_SERVER_HEADERS)
155 DEFINE_ACTION_BOOL       ("force-text-mode",            ACTION_FORCE_TEXT_MODE)
156 DEFINE_ACTION_BOOL       ("handle-as-empty-document",   ACTION_HANDLE_AS_EMPTY_DOCUMENT)
157 DEFINE_ACTION_BOOL       ("handle-as-image",            ACTION_IMAGE)
158 DEFINE_ACTION_STRING     ("hide-accept-language",       ACTION_HIDE_ACCEPT_LANGUAGE, ACTION_STRING_LANGUAGE)
159 DEFINE_CGI_PARAM_RADIO   ("hide-accept-language",       ACTION_HIDE_ACCEPT_LANGUAGE, ACTION_STRING_LANGUAGE, "block", 0)
160 DEFINE_CGI_PARAM_CUSTOM  ("hide-accept-language",       ACTION_HIDE_ACCEPT_LANGUAGE, ACTION_STRING_LANGUAGE, "de-de")
161 DEFINE_ACTION_STRING     ("hide-content-disposition",   ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION)
162 DEFINE_CGI_PARAM_RADIO   ("hide-content-disposition",   ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION,    "block", 0)
163 DEFINE_CGI_PARAM_CUSTOM  ("hide-content-disposition",   ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION,    "attachment; filename=WHATEVER.txt")
164 DEFINE_ACTION_BOOL       ("hide-forwarded-for-headers", ACTION_HIDE_FORWARDED)
165 DEFINE_ACTION_STRING     ("hide-from-header",           ACTION_HIDE_FROM,       ACTION_STRING_FROM)
166 DEFINE_CGI_PARAM_RADIO   ("hide-from-header",           ACTION_HIDE_FROM,       ACTION_STRING_FROM,          "block", 1)
167 DEFINE_CGI_PARAM_CUSTOM  ("hide-from-header",           ACTION_HIDE_FROM,       ACTION_STRING_FROM,          "spam_me_senseless@sittingduck.xyz")
168 DEFINE_ACTION_STRING     ("hide-if-modified-since",     ACTION_HIDE_IF_MODIFIED_SINCE, ACTION_STRING_IF_MODIFIED_SINCE)
169 DEFINE_CGI_PARAM_RADIO   ("hide-if-modified-since",     ACTION_HIDE_IF_MODIFIED_SINCE, ACTION_STRING_IF_MODIFIED_SINCE, "block", 0)
170 DEFINE_CGI_PARAM_CUSTOM  ("hide-if-modified-since",     ACTION_HIDE_IF_MODIFIED_SINCE, ACTION_STRING_IF_MODIFIED_SINCE, "-1")
171 DEFINE_ACTION_STRING     ("hide-referrer",              ACTION_HIDE_REFERER,    ACTION_STRING_REFERER)
172 DEFINE_CGI_PARAM_RADIO   ("hide-referrer",              ACTION_HIDE_REFERER,    ACTION_STRING_REFERER,       "conditional-block", 2)
173 DEFINE_CGI_PARAM_RADIO   ("hide-referrer",              ACTION_HIDE_REFERER,    ACTION_STRING_REFERER,       "forge", 1)
174 DEFINE_CGI_PARAM_RADIO   ("hide-referrer",              ACTION_HIDE_REFERER,    ACTION_STRING_REFERER,       "block", 0)
175 DEFINE_CGI_PARAM_CUSTOM  ("hide-referrer",              ACTION_HIDE_REFERER,    ACTION_STRING_REFERER,       "http://www.google.com/")
176 DEFINE_ACTION_STRING     ("hide-user-agent",            ACTION_HIDE_USER_AGENT, ACTION_STRING_USER_AGENT)
177 DEFINE_CGI_PARAM_NO_RADIO("hide-user-agent",            ACTION_HIDE_USER_AGENT, ACTION_STRING_USER_AGENT,    "Privoxy/3.0 (Anonymous)")
178 DEFINE_ACTION_BOOL       ("inspect-jpegs",              ACTION_JPEG_INSPECT)
179 DEFINE_ACTION_BOOL       ("kill-popups",                ACTION_NO_POPUPS)
180 DEFINE_ACTION_STRING     ("limit-connect",              ACTION_LIMIT_CONNECT,   ACTION_STRING_LIMIT_CONNECT)
181 DEFINE_CGI_PARAM_NO_RADIO("limit-connect",              ACTION_LIMIT_CONNECT,   ACTION_STRING_LIMIT_CONNECT,  "443")
182 DEFINE_ACTION_STRING     ("overwrite-last-modified",    ACTION_OVERWRITE_LAST_MODIFIED, ACTION_STRING_LAST_MODIFIED)
183 DEFINE_CGI_PARAM_RADIO   ("overwrite-last-modified",    ACTION_OVERWRITE_LAST_MODIFIED, ACTION_STRING_LAST_MODIFIED, "block", 0)
184 DEFINE_CGI_PARAM_RADIO   ("overwrite-last-modified",    ACTION_OVERWRITE_LAST_MODIFIED, ACTION_STRING_LAST_MODIFIED, "reset-to-request-time", 1)
185 DEFINE_CGI_PARAM_RADIO   ("overwrite-last-modified",    ACTION_OVERWRITE_LAST_MODIFIED, ACTION_STRING_LAST_MODIFIED, "randomize", 2)
186 DEFINE_ACTION_BOOL       ("prevent-compression",        ACTION_NO_COMPRESSION)
187 DEFINE_ACTION_STRING     ("redirect",                   ACTION_REDIRECT,        ACTION_STRING_REDIRECT)
188 DEFINE_CGI_PARAM_NO_RADIO("redirect",                   ACTION_REDIRECT,        ACTION_STRING_REDIRECT,  "http://localhost/")
189 DEFINE_ACTION_BOOL       ("send-vanilla-wafer",         ACTION_VANILLA_WAFER)
190 DEFINE_ACTION_MULTI      ("send-wafer",                 ACTION_MULTI_WAFER)
191 DEFINE_ACTION_BOOL       ("session-cookies-only",       ACTION_NO_COOKIE_KEEP)
192 DEFINE_ACTION_STRING     ("set-image-blocker",          ACTION_IMAGE_BLOCKER,   ACTION_STRING_IMAGE_BLOCKER)
193 DEFINE_CGI_PARAM_RADIO   ("set-image-blocker",          ACTION_IMAGE_BLOCKER,   ACTION_STRING_IMAGE_BLOCKER, "pattern", 1)
194 DEFINE_CGI_PARAM_RADIO   ("set-image-blocker",          ACTION_IMAGE_BLOCKER,   ACTION_STRING_IMAGE_BLOCKER, "blank", 0)
195 DEFINE_CGI_PARAM_CUSTOM  ("set-image-blocker",          ACTION_IMAGE_BLOCKER,   ACTION_STRING_IMAGE_BLOCKER,  CGI_PREFIX "show-banner?type=pattern")
196 DEFINE_ACTION_BOOL       ("treat-forbidden-connects-like-blocks",   ACTION_TREAT_FORBIDDEN_CONNECTS_LIKE_BLOCKS)
197
198
199 #if DEFINE_ACTION_ALIAS
200
201 /* 
202  * Alternative spellings
203  */
204 DEFINE_ACTION_BOOL       ("kill-popup",      ACTION_NO_POPUPS)
205 DEFINE_ACTION_STRING     ("hide-referer",   ACTION_HIDE_REFERER,    ACTION_STRING_REFERER)
206 DEFINE_ACTION_BOOL       ("prevent-keeping-cookies", ACTION_NO_COOKIE_KEEP)
207
208 /* 
209  * Pre-3.0 compatibility
210  */
211 DEFINE_ACTION_BOOL       ("no-cookie-read",          ACTION_NO_COOKIE_READ)
212 DEFINE_ACTION_BOOL       ("no-cookie-set",           ACTION_NO_COOKIE_SET)
213 DEFINE_ACTION_BOOL       ("prevent-reading-cookies", ACTION_NO_COOKIE_READ)
214 DEFINE_ACTION_BOOL       ("prevent-setting-cookies", ACTION_NO_COOKIE_SET)
215 DEFINE_ACTION_BOOL       ("downgrade",               ACTION_DOWNGRADE)
216 DEFINE_ACTION_BOOL       ("hide-forwarded",          ACTION_HIDE_FORWARDED)
217 DEFINE_ACTION_STRING     ("hide-from",               ACTION_HIDE_FROM,       ACTION_STRING_FROM)
218 DEFINE_ACTION_BOOL       ("image",                   ACTION_IMAGE)
219 DEFINE_ACTION_STRING     ("image-blocker",           ACTION_IMAGE_BLOCKER,   ACTION_STRING_IMAGE_BLOCKER)
220 DEFINE_ACTION_BOOL       ("no-compression",          ACTION_NO_COMPRESSION)
221 DEFINE_ACTION_BOOL       ("no-cookies-keep",         ACTION_NO_COOKIE_KEEP)
222 DEFINE_ACTION_BOOL       ("no-cookies-read",         ACTION_NO_COOKIE_READ)
223 DEFINE_ACTION_BOOL       ("no-cookies-set",          ACTION_NO_COOKIE_SET)
224 DEFINE_ACTION_BOOL       ("no-popups",               ACTION_NO_POPUPS)
225 DEFINE_ACTION_BOOL       ("vanilla-wafer",           ACTION_VANILLA_WAFER)
226 DEFINE_ACTION_MULTI      ("wafer",                   ACTION_MULTI_WAFER)
227 #endif /* if DEFINE_ACTION_ALIAS */
228
229 #undef DEFINE_ACTION_MULTI
230 #undef DEFINE_ACTION_STRING
231 #undef DEFINE_ACTION_BOOL
232 #undef DEFINE_ACTION_ALIAS
233 #undef DEFINE_CGI_PARAM_CUSTOM
234 #undef DEFINE_CGI_PARAM_RADIO
235 #undef DEFINE_CGI_PARAM_NO_RADIO
236