Update to 2008-02-05.
[privoxy.git] / actions.h
1 #ifndef ACTIONS_H_INCLUDED
2 #define ACTIONS_H_INCLUDED
3 #define ACTIONS_H_VERSION "$Id: actions.h,v 1.16 2007/04/17 18:21:45 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/actions.h,v $
7  *
8  * Purpose     :  Declares functions to work with actions files
9  *                Functions declared include: FIXME
10  *
11  * Copyright   :  Written by and Copyright (C) 2001-2007 the SourceForge
12  *                Privoxy team. http://www.privoxy.org/
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and 
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it 
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  * Revisions   :
37  *    $Log: actions.h,v $
38  *    Revision 1.16  2007/04/17 18:21:45  fabiankeil
39  *    Split update_action_bits() into
40  *    update_action_bits_for_all_tags()
41  *    and update_action_bits_for_tag().
42  *
43  *    Revision 1.15  2007/04/15 16:39:20  fabiankeil
44  *    Introduce tags as alternative way to specify which
45  *    actions apply to a request. At the moment tags can be
46  *    created based on client and server headers.
47  *
48  *    Revision 1.14  2006/07/18 14:48:45  david__schmidt
49  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
50  *    with what was really the latest development (the v_3_0_branch branch)
51  *
52  *    Revision 1.12  2002/05/06 07:56:50  oes
53  *    Made actions_to_html independent of FEATURE_CGI_EDIT_ACTIONS
54  *
55  *    Revision 1.11  2002/04/30 11:14:52  oes
56  *    Made csp the first parameter in *action_to_html
57  *
58  *    Revision 1.10  2002/04/26 12:53:33  oes
59  *     -  actions_to_html signature change
60  *     -  current_action_to_text: renamed to current_action_to_html
61  *        and signature change
62  *
63  *    Revision 1.9  2002/03/26 22:29:54  swa
64  *    we have a new homepage!
65  *
66  *    Revision 1.8  2002/03/24 13:25:43  swa
67  *    name change related issues
68  *
69  *    Revision 1.7  2002/03/16 23:54:06  jongfoster
70  *    Adding graceful termination feature, to help look for memory leaks.
71  *    If you enable this (which, by design, has to be done by hand
72  *    editing config.h) and then go to http://i.j.b/die, then the program
73  *    will exit cleanly after the *next* request.  It should free all the
74  *    memory that was used.
75  *
76  *    Revision 1.6  2001/10/23 21:30:30  jongfoster
77  *    Adding error-checking to selected functions.
78  *
79  *    Revision 1.5  2001/10/14 21:58:22  jongfoster
80  *    Adding support for the CGI-based editor:
81  *    - Exported get_actions()
82  *    - Added new function free_alias_list()
83  *    - Added support for {{settings}} and {{description}} blocks
84  *      in the actions file.  They are currently ignored.
85  *    - Added restriction to only one {{alias}} block which must appear
86  *      first in the file, to simplify the editor's rewriting rules.
87  *    - Note that load_actions_file() is no longer used by the CGI-based
88  *      editor, but some of the other routines in this file are.
89  *
90  *    Revision 1.4  2001/09/16 15:47:37  jongfoster
91  *    First version of CGI-based edit interface.  This is very much a
92  *    work-in-progress, and you can't actually use it to edit anything
93  *    yet.  You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
94  *    to have any effect.
95  *
96  *    Revision 1.3  2001/09/14 00:17:32  jongfoster
97  *    Tidying up memory allocation. New function init_action().
98  *
99  *    Revision 1.2  2001/07/29 19:01:11  jongfoster
100  *    Changed _FILENAME_H to FILENAME_H_INCLUDED.
101  *    Added forward declarations for needed structures.
102  *
103  *    Revision 1.1  2001/05/31 21:16:46  jongfoster
104  *    Moved functions to process the action list into this new file.
105  *
106  *
107  *********************************************************************/
108 \f
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114
115 struct action_spec;
116 struct current_action_spec;
117 struct client_state;
118
119
120
121 /* This structure is used to hold user-defined aliases */
122 struct action_alias
123 {
124    const char * name;
125    struct action_spec action[1];
126    struct action_alias * next;
127 };
128
129
130 extern jb_err get_actions (char *line, 
131                            struct action_alias * alias_list,
132                            struct action_spec *cur_action);
133 extern void free_alias_list(struct action_alias *alias_list);
134
135 extern void init_action(struct action_spec *dest);
136 extern void free_action(struct action_spec *src);
137 extern jb_err merge_actions (struct action_spec *dest, 
138                              const struct action_spec *src);
139 #if 0
140 extern int update_action_bits_for_all_tags(struct client_state *csp);
141 #endif
142 extern int update_action_bits_for_tag(struct client_state *csp, const char *tag);
143 extern jb_err copy_action (struct action_spec *dest, 
144                            const struct action_spec *src);
145 extern char * actions_to_text     (const struct action_spec *action);
146 extern char * actions_to_html     (const struct client_state *csp,
147                                    const struct action_spec *action);
148 extern void init_current_action     (struct current_action_spec *dest);
149 extern void free_current_action     (struct current_action_spec *src);
150 extern jb_err merge_current_action  (struct current_action_spec *dest, 
151                                      const struct action_spec *src);
152 extern char * current_action_to_html(const struct client_state *csp,
153                                      const struct current_action_spec *action);
154
155 extern jb_err get_action_token(char **line, char **name, char **value);
156 extern void unload_actions_file(void *file_data);
157 extern int load_actions_file(struct client_state *csp);
158
159 #ifdef FEATURE_GRACEFUL_TERMINATION
160 void unload_current_actions_file(void);
161 #endif
162
163
164 /* Revision control strings from this header and associated .c file */
165 extern const char actions_rcs[];
166 extern const char actions_h_rcs[];
167
168 #ifdef __cplusplus
169 } /* extern "C" */
170 #endif
171
172 #endif /* ndef ACTIONS_H_INCLUDED */
173
174 /*
175   Local Variables:
176   tab-width: 3
177   end:
178 */
179