3 #define CGI_H_VERSION "$Id: cgi.h,v 1.41 2011/09/04 11:10:56 fabiankeil Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/cgi.h,v $
8 * Purpose : Declares functions to intercept request, generate
9 * html or gif answers, and to compose HTTP resonses.
11 * Functions declared include:
14 * Copyright : Written by and Copyright (C) 2001-2009 the
15 * Privoxy team. http://www.privoxy.org/
17 * Based on the Internet Junkbuster originally written
18 * by and Copyright (C) 1997 Anonymous Coders and
19 * Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
39 **********************************************************************/
49 * Main dispatch function
51 extern struct http_response *dispatch_cgi(struct client_state *csp);
53 /* Not exactly a CGI */
54 extern struct http_response *error_response(struct client_state *csp,
55 const char *templatename);
58 * CGI support functions
60 extern struct http_response * alloc_http_response(void);
61 extern void free_http_response(struct http_response *rsp);
63 extern struct http_response *finish_http_response(struct client_state *csp,
64 struct http_response *rsp);
66 extern struct map * default_exports(const struct client_state *csp, const char *caller);
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);
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,
78 struct http_response *rsp);
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);
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);
95 extern jb_err get_number_param(struct client_state *csp,
96 const struct map *parameters,
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
106 * Minimum length which a buffer has to reach before
107 * we bother to (re-)compress it. Completely arbitrary.
109 extern const size_t LOWER_LENGTH_LIMIT_FOR_COMPRESSION;
110 extern char *compress_buffer(char *buffer, size_t *buffer_length, int compression_level);
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);
122 * Ad replacement images
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;
129 /* Revision control strings from this header and associated .c file */
130 extern const char cgi_rcs[];
131 extern const char cgi_h_rcs[];
137 #endif /* ndef CGI_H_INCLUDED */