Replaced the hard limit for the maximum number of matches
[privoxy.git] / cgi.h
1 #ifndef CGI_H_INCLUDED
2 #define CGI_H_INCLUDED
3 #define CGI_H_VERSION "$Id: cgi.h,v 1.10 2001/08/01 21:19:22 jongfoster 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 the SourceForge
15  *                IJBSWA team.  http://ijbswa.sourceforge.net
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  * Revisions   :
40  *    $Log: cgi.h,v $
41  *    Revision 1.10  2001/08/01 21:19:22  jongfoster
42  *    Moving file version information to a separate CGI page.
43  *
44  *    Revision 1.9  2001/08/01 00:17:54  jongfoster
45  *    Adding prototype for map_conditional
46  *
47  *    Revision 1.8  2001/07/30 22:08:36  jongfoster
48  *    Tidying up #defines:
49  *    - All feature #defines are now of the form FEATURE_xxx
50  *    - Permanently turned off WIN_GUI_EDIT
51  *    - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
52  *
53  *    Revision 1.7  2001/07/29 18:43:08  jongfoster
54  *    Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
55  *    ANSI C rules.
56  *
57  *    Revision 1.6  2001/06/29 21:45:41  oes
58  *    Indentation, CRLF->LF, Tab-> Space
59  *
60  *    Revision 1.5  2001/06/29 13:22:44  oes
61  *    - Cleaned up
62  *    - Added new functions: default_exports(), make_menu(),
63  *      error_response() etc, ranamed others and changed
64  *      param and return types.
65  *    - Removed HTTP/HTML snipplets
66  *    - Removed logentry from cancelled commit
67  *
68  *    Revision 1.4  2001/06/09 10:50:58  jongfoster
69  *    Changing "show URL info" handler to new style.
70  *    Adding "extern" to some function prototypes.
71  *
72  *    Revision 1.3  2001/06/03 19:12:16  oes
73  *    introduced new cgi handling
74  *
75  *    No revisions before 1.3
76  *
77  **********************************************************************/
78 \f
79
80 #include "project.h"
81
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85
86 /*
87  * Dispatch & parameter parsing functions
88  */
89 extern struct http_response *dispatch_cgi(struct client_state *csp);
90 extern struct map *parse_cgi_parameters(char *argstring);
91
92 /*
93  * CGI functions
94  */
95 extern int cgi_show_version(struct client_state *csp, struct http_response *rsp,
96                             struct map *parameters);
97 extern int cgi_default(struct client_state *csp, struct http_response *rsp,
98                        struct map *parameters);
99 extern int cgi_show_status(struct client_state *csp, struct http_response *rsp,
100                            struct map *parameters);
101 extern int cgi_show_url_info(struct client_state *csp, struct http_response *rsp,
102                              struct map *parameters);
103 extern int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
104                                   struct map *parameters);
105
106 /* Not exactly a CGI */
107 extern struct http_response *error_response(struct client_state *csp, const char *template, int err);
108
109 /*
110  * CGI support functions
111  */
112 extern struct http_response *finish_http_response(struct http_response *rsp);
113 extern void free_http_response(struct http_response *rsp);
114
115 extern struct map * default_exports(const struct client_state *csp, const char *caller);
116 extern void map_block_killer(struct map *map, const char *name);
117 extern void map_conditional(struct map *exports, const char *name, int choose_first);
118 extern char *fill_template(struct client_state *csp, const char *templatename, struct map *exports);
119
120
121 /*
122  * Text generators
123  */
124 extern char *make_menu(const char *self);
125 extern char *dump_map(const struct map *map);
126
127 #ifdef FEATURE_STATISTICS
128 extern struct map *add_stats(struct map *exports);
129 #endif /* def FEATURE_STATISTICS */
130
131
132 /*
133  * Hint: You can encode your own GIFs like that:
134  * perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o,", unpack("C", $c)); }'
135  */
136
137 static const char JBGIF[] =
138    "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
139    "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
140    "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
141    "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
142    "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
143    "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
144    "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
145    "\037Q\000\000;";
146
147 static const char BLANKGIF[] =
148    "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
149    "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
150    "\000\001\000\000\002\002D\001\000;";
151
152
153 /* Revision control strings from this header and associated .c file */
154 extern const char cgi_rcs[];
155 extern const char cgi_h_rcs[];
156
157 #ifdef __cplusplus
158 } /* extern "C" */
159 #endif
160
161 #endif /* ndef CGI_H_INCLUDED */
162
163 /*
164   Local Variables:
165   tab-width: 3
166   end:
167 */