Log a message right before exiting gracefully
[privoxy.git] / filters.h
1 #ifndef FILTERS_H_INCLUDED
2 #define FILTERS_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/filters.h,v $
6  *
7  * Purpose     :  Declares functions to parse/crunch headers and pages.
8  *
9  * Copyright   :  Written by and Copyright (C) 2001-2010 the
10  *                Privoxy team. https://www.privoxy.org/
11  *
12  *                Based on the Internet Junkbuster originally written
13  *                by and Copyright (C) 1997 Anonymous Coders and
14  *                Junkbusters Corporation.  http://www.junkbusters.com
15  *
16  *                This program is free software; you can redistribute it
17  *                and/or modify it under the terms of the GNU General
18  *                Public License as published by the Free Software
19  *                Foundation; either version 2 of the License, or (at
20  *                your option) any later version.
21  *
22  *                This program is distributed in the hope that it will
23  *                be useful, but WITHOUT ANY WARRANTY; without even the
24  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
25  *                PARTICULAR PURPOSE.  See the GNU General Public
26  *                License for more details.
27  *
28  *                The GNU General Public License should be included with
29  *                this file.  If not, you can view it at
30  *                http://www.gnu.org/copyleft/gpl.html
31  *                or write to the Free Software Foundation, Inc., 59
32  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
33  *
34  *********************************************************************/
35
36
37 #include "project.h"
38
39 /*
40  * ACL checking
41  */
42 #ifdef FEATURE_ACL
43 extern int block_acl(const struct access_control_addr *dst, const struct client_state *csp);
44 extern int acl_addr(const char *aspec, struct access_control_addr *aca);
45 #endif /* def FEATURE_ACL */
46
47 /*
48  * Interceptors
49  */
50 extern struct http_response *block_url(struct client_state *csp);
51 extern struct http_response *redirect_url(struct client_state *csp);
52 #ifdef FEATURE_TRUST
53 extern struct http_response *trust_url(struct client_state *csp);
54 #endif /* def FEATURE_TRUST */
55
56 /*
57  * Request inspectors
58  */
59 #ifdef FEATURE_TRUST
60 extern int is_untrusted_url(const struct client_state *csp);
61 #endif /* def FEATURE_TRUST */
62 #ifdef FEATURE_IMAGE_BLOCKING
63 extern int is_imageurl(const struct client_state *csp);
64 #endif /* def FEATURE_IMAGE_BLOCKING */
65 extern int connect_port_is_forbidden(const struct client_state *csp);
66
67 /*
68  * Determining applicable actions
69  */
70 extern void get_url_actions(struct client_state *csp,
71                             struct http_request *http);
72
73 extern struct re_filterfile_spec *get_filter(const struct client_state *csp,
74                                              const char *requested_name,
75                                              enum filter_type requested_type);
76
77 /*
78  * Determining parent proxies
79  */
80 extern const struct forward_spec *forward_url(struct client_state *csp,
81                                               const struct http_request *http);
82
83 /*
84  * Content modification
85  */
86 extern char *execute_content_filters(struct client_state *csp);
87 extern char *execute_client_body_filters(struct client_state *csp, size_t *filtered_data_len);
88 extern char *execute_single_pcrs_command(char *subject, const char *pcrs_command, int *hits);
89 extern char *rewrite_url(char *old_url, const char *pcrs_command);
90
91 extern pcrs_job *compile_dynamic_pcrs_job_list(const struct client_state *csp, const struct re_filterfile_spec *b);
92
93 extern int content_requires_filtering(struct client_state *csp);
94 extern int content_filters_enabled(const struct current_action_spec *action);
95 extern int client_body_filters_enabled(const struct current_action_spec *action);
96 extern int filters_available(const struct client_state *csp);
97
98 /*
99  * Handling Max-Forwards:
100  */
101 extern struct http_response *direct_response(struct client_state *csp);
102
103 #ifdef FUZZ
104 extern char *gif_deanimate_response(struct client_state *csp);
105 extern jb_err remove_chunked_transfer_coding(char *buffer, size_t *size);
106 #endif
107
108 #ifdef FEATURE_EXTENDED_STATISTICS
109 extern void register_filter_for_statistics(const char *filter);
110 extern void update_filter_statistics(const char *filter, int hits);
111 extern void get_filter_statistics(const char *filter,
112                                   unsigned long long *executions,
113                                   unsigned long long *pages_modified,
114                                   unsigned long long *hits);
115
116 extern void register_block_reason_for_statistics(const char *block_reason);
117 extern void get_block_reason_count(const char *block_reason,
118                                    unsigned long long *count);
119 #endif
120
121 #endif /* ndef FILTERS_H_INCLUDED */
122
123 /*
124   Local Variables:
125   tab-width: 3
126   end:
127 */