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