ssl_send_certificate_error(): Don't sleep
[privoxy.git] / cgi.h
1 #ifndef CGI_H_INCLUDED
2 #define CGI_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/cgi.h,v $
6  *
7  * Purpose     :  Declares functions to intercept request, generate
8  *                html or gif answers, and to compose HTTP resonses.
9  *
10  *                Functions declared include:
11  *
12  *
13  * Copyright   :  Written by and Copyright (C) 2001-2009 the
14  *                Privoxy team. https://www.privoxy.org/
15  *
16  *                Based on the Internet Junkbuster originally written
17  *                by and Copyright (C) 1997 Anonymous Coders and
18  *                Junkbusters Corporation.  http://www.junkbusters.com
19  *
20  *                This program is free software; you can redistribute it
21  *                and/or modify it under the terms of the GNU General
22  *                Public License as published by the Free Software
23  *                Foundation; either version 2 of the License, or (at
24  *                your option) any later version.
25  *
26  *                This program is distributed in the hope that it will
27  *                be useful, but WITHOUT ANY WARRANTY; without even the
28  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
29  *                PARTICULAR PURPOSE.  See the GNU General Public
30  *                License for more details.
31  *
32  *                The GNU General Public License should be included with
33  *                this file.  If not, you can view it at
34  *                http://www.gnu.org/copyleft/gpl.html
35  *                or write to the Free Software Foundation, Inc., 59
36  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
37  *
38  **********************************************************************/
39
40
41 #include "project.h"
42
43 /*
44  * Main dispatch function
45  */
46 extern struct http_response *dispatch_cgi(struct client_state *csp);
47
48 /* Not exactly a CGI */
49 extern struct http_response *error_response(struct client_state *csp,
50                                             const char *templatename);
51
52 /*
53  * CGI support functions
54  */
55 extern struct http_response * alloc_http_response(void);
56 extern void free_http_response(struct http_response *rsp);
57
58 extern struct http_response *finish_http_response(struct client_state *csp,
59                                                   struct http_response *rsp);
60
61 extern struct map * default_exports(const struct client_state *csp, const char *caller);
62
63 extern jb_err map_block_killer (struct map *exports, const char *name);
64 extern jb_err map_block_keep   (struct map *exports, const char *name);
65 extern jb_err map_conditional  (struct map *exports, const char *name, int choose_first);
66
67 extern jb_err template_load(const struct client_state *csp, char ** template_ptr,
68                             const char *templatename, int recursive);
69 extern jb_err template_fill(char ** template_ptr, const struct map *exports);
70 extern jb_err template_fill_for_cgi(const struct client_state *csp,
71                                     const char *templatename,
72                                     struct map *exports,
73                                     struct http_response *rsp);
74
75 extern void cgi_init_error_messages(void);
76 extern struct http_response *cgi_error_memory(void);
77 extern jb_err cgi_redirect (struct http_response * rsp, const char *target);
78
79 extern jb_err cgi_error_no_template(const struct client_state *csp,
80                                     struct http_response *rsp,
81                                     const char *template_name);
82 extern jb_err cgi_error_bad_param(const struct client_state *csp,
83                                   struct http_response *rsp);
84 extern jb_err cgi_error_disabled(const struct client_state *csp,
85                                  struct http_response *rsp);
86 extern jb_err cgi_error_unknown(const struct client_state *csp,
87                          struct http_response *rsp,
88                          jb_err error_to_report);
89
90 extern jb_err get_number_param(struct client_state *csp,
91                                const struct map *parameters,
92                                char *name,
93                                unsigned *pvalue);
94 extern jb_err get_string_param(const struct map *parameters,
95                                const char *param_name,
96                                const char **pparam);
97 extern char   get_char_param(const struct map *parameters,
98                              const char *param_name);
99 #ifdef FEATURE_COMPRESSION
100 /*
101  * Minimum length which a buffer has to reach before
102  * we bother to (re-)compress it. Completely arbitrary.
103  */
104 extern const size_t LOWER_LENGTH_LIMIT_FOR_COMPRESSION;
105 extern char *compress_buffer(char *buffer, size_t *buffer_length, int compression_level);
106 #endif
107
108 /*
109  * Text generators
110  */
111 extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
112 extern char *add_help_link(const char *item, struct configuration_spec *config);
113 extern char *make_menu(const char *self, const unsigned feature_flags);
114 extern char *dump_map(const struct map *the_map);
115
116 /*
117  * Ad replacement images
118  */
119 extern const char image_pattern_data[];
120 extern const size_t  image_pattern_length;
121 extern const char image_blank_data[];
122 extern const size_t  image_blank_length;
123
124 #endif /* ndef CGI_H_INCLUDED */
125
126 /*
127   Local Variables:
128   tab-width: 3
129   end:
130 */