Remove CVS revision logs. TODO item #33.
[privoxy.git] / cgi.h
1 #ifndef CGI_H_INCLUDED
2 #define CGI_H_INCLUDED
3 #define CGI_H_VERSION "$Id: cgi.h,v 1.35 2008/05/21 15:24:37 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-2007 the SourceForge
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                                              int err);
57
58 /*
59  * CGI support functions
60  */
61 extern struct http_response * alloc_http_response(void);
62 extern void free_http_response(struct http_response *rsp);
63
64 extern struct http_response *finish_http_response(const struct client_state *csp,
65                                                   struct http_response *rsp);
66
67 extern struct map * default_exports(const struct client_state *csp, const char *caller);
68
69 extern jb_err map_block_killer (struct map *exports, const char *name);
70 extern jb_err map_block_keep   (struct map *exports, const char *name);
71 extern jb_err map_conditional  (struct map *exports, const char *name, int choose_first);
72
73 extern jb_err template_load(const struct client_state *csp, char ** template_ptr, 
74                             const char *templatename, int recursive);
75 extern jb_err template_fill(char ** template_ptr, const struct map *exports);
76 extern jb_err template_fill_for_cgi(const struct client_state *csp,
77                                     const char *templatename,
78                                     struct map *exports,
79                                     struct http_response *rsp);
80
81 extern void cgi_init_error_messages(void);
82 extern struct http_response *cgi_error_memory(void);
83 extern jb_err cgi_redirect (struct http_response * rsp, const char *target);
84
85 extern jb_err cgi_error_no_template(const struct client_state *csp,
86                                     struct http_response *rsp,
87                                     const char *template_name);
88 extern jb_err cgi_error_bad_param(const struct client_state *csp,
89                                   struct http_response *rsp);
90 extern jb_err cgi_error_disabled(const struct client_state *csp,
91                                  struct http_response *rsp);
92 extern jb_err cgi_error_unknown(const struct client_state *csp,
93                          struct http_response *rsp,
94                          jb_err error_to_report);
95
96 extern jb_err get_number_param(struct client_state *csp,
97                                const struct map *parameters,
98                                char *name,
99                                unsigned *pvalue);
100 extern jb_err get_string_param(const struct map *parameters,
101                                const char *param_name,
102                                const char **pparam);
103 extern char   get_char_param(const struct map *parameters,
104                              const char *param_name);
105
106 /*
107  * Text generators
108  */
109 extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
110 extern char *add_help_link(const char *item, struct configuration_spec *config);
111 extern char *make_menu(const char *self, const unsigned feature_flags);
112 extern char *dump_map(const struct map *the_map);
113
114 /*
115  * Ad replacement images
116  */
117 extern const char image_pattern_data[];
118 extern const size_t  image_pattern_length;
119 extern const char image_blank_data[];
120 extern const size_t  image_blank_length;
121
122 /* Revision control strings from this header and associated .c file */
123 extern const char cgi_rcs[];
124 extern const char cgi_h_rcs[];
125
126 #ifdef __cplusplus
127 } /* extern "C" */
128 #endif
129
130 #endif /* ndef CGI_H_INCLUDED */
131
132 /*
133   Local Variables:
134   tab-width: 3
135   end:
136 */