Adding missing #include project.h
[privoxy.git] / project.h
1 #ifndef PROJECT_H_INCLUDED
2 #define PROJECT_H_INCLUDED
3 #define PROJECT_H_VERSION "$Id: project.h,v 1.24 2001/07/25 17:20:27 oes Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
7  *
8  * Purpose     :  Defines data structures which are widely used in the
9  *                project.  Does not define any variables or functions
10  *                (though it does declare some macros).
11  *
12  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
13  *                IJBSWA team.  http://ijbswa.sourceforge.net
14  *
15  *                Based on the Internet Junkbuster originally written
16  *                by and Copyright (C) 1997 Anonymous Coders and 
17  *                Junkbusters Corporation.  http://www.junkbusters.com
18  *
19  *                This program is free software; you can redistribute it 
20  *                and/or modify it under the terms of the GNU General
21  *                Public License as published by the Free Software
22  *                Foundation; either version 2 of the License, or (at
23  *                your option) any later version.
24  *
25  *                This program is distributed in the hope that it will
26  *                be useful, but WITHOUT ANY WARRANTY; without even the
27  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
28  *                PARTICULAR PURPOSE.  See the GNU General Public
29  *                License for more details.
30  *
31  *                The GNU General Public License should be included with
32  *                this file.  If not, you can view it at
33  *                http://www.gnu.org/copyleft/gpl.html
34  *                or write to the Free Software Foundation, Inc., 59
35  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
36  *
37  * Revisions   :
38  *    $Log: project.h,v $
39  *    Revision 1.24  2001/07/25 17:20:27  oes
40  *    Introduced http->user_agent
41  *
42  *    Revision 1.23  2001/07/18 12:32:23  oes
43  *    - Added ACTION_STRING_DEANIMATE
44  *    - moved #define freez from jcc.h to project.h
45  *
46  *    Revision 1.22  2001/07/15 17:51:41  jongfoster
47  *    Renaming #define STATIC to STATIC_PCRE
48  *
49  *    Revision 1.21  2001/07/13 14:03:19  oes
50  *     - Reorganized regex header inclusion and #defines to
51  *       comply to the scheme in configure.in
52  *     - Added csp->content_type and its CT_* keys
53  *     - Added ACTION_DEANIMATE
54  *     - Removed all #ifdef PCRS
55  *
56  *    Revision 1.20  2001/06/29 21:45:41  oes
57  *    Indentation, CRLF->LF, Tab-> Space
58  *
59  *    Revision 1.19  2001/06/29 13:33:36  oes
60  *    - Improved comments
61  *    - Introduced http_request.host_ip_addr_str
62  *    - Introduced http_response.head_length
63  *    - Introduced config.my_ip_addr_str, config.my_hostname,
64  *      config.admin_address and config.proxy_info_url
65  *    - Removed config.proxy_args_header and config.proxy_args_trailer,
66  *      renamed config.proxy_args_invocation to config.proxy_args
67  *    - Removed HTML snipplets and GIFs
68  *    - Removed logentry from cancelled commit
69  *
70  *    Revision 1.18  2001/06/09 10:57:39  jongfoster
71  *    Adding definition of BUFFER_SIZE.
72  *    Changing struct cgi_dispatcher to use "const" strings.
73  *
74  *    Revision 1.17  2001/06/07 23:15:09  jongfoster
75  *    Merging ACL and forward files into config file.
76  *    Moving struct gateway members into struct forward_spec
77  *    Removing config->proxy_args_gateways
78  *    Cosmetic: Adding a few comments
79  *
80  *    Revision 1.16  2001/06/04 18:31:58  swa
81  *    files are now prefixed with either `confdir' or `logdir'.
82  *    `make redhat-dist' replaces both entries confdir and logdir
83  *    with redhat values
84  *
85  *    Revision 1.15  2001/06/04 11:28:53  swa
86  *    redirect did not work due to missing /
87  *
88  *    Revision 1.14  2001/06/03 11:03:48  oes
89  *    Added struct map,
90  *    added struct http_response,
91  *    changed struct interceptors to struct cgi_dispatcher,
92  *    moved HTML stuff to cgi.h
93  *
94  *    Revision 1.13  2001/06/01 20:05:36  jongfoster
95  *    Support for +image-blocker{}: added ACTION_IMAGE_BLOCKER
96  *    constant, and removed csp->tinygif.
97  *
98  *    Revision 1.12  2001/06/01 18:49:17  jongfoster
99  *    Replaced "list_share" with "list" - the tiny memory gain was not
100  *    worth the extra complexity.
101  *
102  *    Revision 1.11  2001/06/01 10:32:47  oes
103  *    Added constants for anchoring selection bitmap
104  *
105  *    Revision 1.10  2001/05/31 21:33:53  jongfoster
106  *    Changes for new actions file, replacing permissionsfile
107  *    and parts of the config file.  Also added support for
108  *    list_shared.
109  *
110  *    Revision 1.9  2001/05/31 17:32:31  oes
111  *
112  *     - Enhanced domain part globbing with infix and prefix asterisk
113  *       matching and optional unanchored operation
114  *
115  *    Revision 1.8  2001/05/29 20:09:15  joergs
116  *    HTTP_REDIRECT_TEMPLATE fixed.
117  *
118  *    Revision 1.7  2001/05/29 09:50:24  jongfoster
119  *    Unified blocklist/imagelist/actionslist.
120  *    File format is still under discussion, but the internal changes
121  *    are (mostly) done.
122  *
123  *    Also modified interceptor behaviour:
124  *    - We now intercept all URLs beginning with one of the following
125  *      prefixes (and *only* these prefixes):
126  *        * http://i.j.b/
127  *        * http://ijbswa.sf.net/config/
128  *        * http://ijbswa.sourceforge.net/config/
129  *    - New interceptors "home page" - go to http://i.j.b/ to see it.
130  *    - Internal changes so that intercepted and fast redirect pages
131  *      are not replaced with an image.
132  *    - Interceptors now have the option to send a binary page direct
133  *      to the client. (i.e. ijb-send-banner uses this)
134  *    - Implemented show-url-info interceptor.  (Which is why I needed
135  *      the above interceptors changes - a typical URL is
136  *      "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
137  *      The previous mechanism would not have intercepted that, and
138  *      if it had been intercepted then it then it would have replaced
139  *      it with an image.)
140  *
141  *    Revision 1.6  2001/05/27 22:17:04  oes
142  *
143  *    - re_process_buffer no longer writes the modified buffer
144  *      to the client, which was very ugly. It now returns the
145  *      buffer, which it is then written by chat.
146  *
147  *    - content_length now adjusts the Content-Length: header
148  *      for modified documents rather than crunch()ing it.
149  *      (Length info in csp->content_length, which is 0 for
150  *      unmodified documents)
151  *
152  *    - For this to work, sed() is called twice when filtering.
153  *
154  *    Revision 1.5  2001/05/26 00:28:36  jongfoster
155  *    Automatic reloading of config file.
156  *    Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
157  *    Most of the global variables have been moved to a new
158  *    struct configuration_spec, accessed through csp->config->globalname
159  *    Most of the globals remaining are used by the Win32 GUI.
160  *
161  *    Revision 1.4  2001/05/22 18:46:04  oes
162  *
163  *    - Enabled filtering banners by size rather than URL
164  *      by adding patterns that replace all standard banner
165  *      sizes with the "Junkbuster" gif to the re_filterfile
166  *
167  *    - Enabled filtering WebBugs by providing a pattern
168  *      which kills all 1x1 images
169  *
170  *    - Added support for PCRE_UNGREEDY behaviour to pcrs,
171  *      which is selected by the (nonstandard and therefore
172  *      capital) letter 'U' in the option string.
173  *      It causes the quantifiers to be ungreedy by default.
174  *      Appending a ? turns back to greedy (!).
175  *
176  *    - Added a new interceptor ijb-send-banner, which
177  *      sends back the "Junkbuster" gif. Without imagelist or
178  *      MSIE detection support, or if tinygif = 1, or the
179  *      URL isn't recognized as an imageurl, a lame HTML
180  *      explanation is sent instead.
181  *
182  *    - Added new feature, which permits blocking remote
183  *      script redirects and firing back a local redirect
184  *      to the browser.
185  *      The feature is conditionally compiled, i.e. it
186  *      can be disabled with --disable-fast-redirects,
187  *      plus it must be activated by a "fast-redirects"
188  *      line in the config file, has its own log level
189  *      and of course wants to be displayed by show-proxy-args
190  *      Note: Boy, all the #ifdefs in 1001 locations and
191  *      all the fumbling with configure.in and acconfig.h
192  *      were *way* more work than the feature itself :-(
193  *
194  *    - Because a generic redirect template was needed for
195  *      this, tinygif = 3 now uses the same.
196  *
197  *    - Moved GIFs, and other static HTTP response templates
198  *      to project.h
199  *
200  *    - Some minor fixes
201  *
202  *    - Removed some >400 CRs again (Jon, you really worked
203  *      a lot! ;-)
204  *
205  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
206  *    Version 2.9.4 checkin.
207  *    - Merged popupfile and cookiefile, and added control over PCRS
208  *      filtering, in new "actionsfile".
209  *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
210  *      file error you now get a message box (in the Win32 GUI) rather
211  *      than the program exiting with no explanation.
212  *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
213  *      skipping.
214  *    - Removed tabs from "config"
215  *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
216  *    - Bumped up version number.
217  *
218  *    Revision 1.2  2001/05/17 23:01:01  oes
219  *     - Cleaned CRLF's from the sources and related files
220  *
221  *    Revision 1.1.1.1  2001/05/15 13:59:03  oes
222  *    Initial import of version 2.9.3 source tree
223  *
224  *
225  *********************************************************************/
226 \f
227
228 /* Declare struct FILE for vars and funcs. */
229 #include <stdio.h>
230
231 /* Need time_t for file_list */
232 #include <time.h>
233
234 /*
235  * Include appropriate regular expression libraries.
236  * Note that pcrs and pcre (native) are needed for cgi
237  * and are included anyway.
238  */
239
240 #if defined(REGEX_PCRE) || defined (REGEX_GNU)
241 # define REGEX
242 #endif /* defined(REGEX_PCRE) || defined (REGEX_GNU) */
243
244 #ifdef STATIC_PCRE
245 #  include "pcre.h"
246 #else
247 #  include <pcre.h>
248 #endif
249
250 #ifdef STATIC_PCRS
251 #  include "pcrs.h" 
252 #else
253 #  include <pcrs.h> 
254 #endif
255
256 #if defined(REGEX_PCRE)
257 #  ifdef STATIC_PCRE
258 #    include "pcreposix.h"
259 #  else
260 #    include <pcreposix.h>
261 #  endif
262 #endif /* defined(REGEX_PCRE) */
263
264 #if defined(REGEX_GNU)
265 #  include "gnu_regex.h"
266 #endif
267
268 #ifdef AMIGA 
269 #include "amiga.h" 
270 #endif /* def AMIGA */
271
272 #ifdef __cplusplus
273 extern "C" {
274 #endif
275
276 #define freez(X)  if(X) free(X); X = NULL
277
278 #define BUFFER_SIZE 5000
279
280 #define FOREVER 1
281
282 /* Default IP and port to listen on */
283 #define HADDR_DEFAULT   "127.0.0.1"
284 #define HADDR_PORT      8000
285
286
287 /* Need this for struct client_state */
288 struct configuration_spec;
289
290 /* Generic linked list of strings */
291 struct list /* FIXME: Why not separate entries and header? */
292 {
293    char *       str;  /* valid in an entry */
294    struct list *last; /* valid in header */
295    struct list *next;
296 };
297
298 struct map
299 {
300   char *name;
301   char *value;
302   struct map *next;
303 };
304
305 struct http_request
306 {
307    char *cmd;
308    char *gpc;
309    char *host;
310    char *host_ip_addr_str; /* NULL before connect_to() */
311    int   port;
312    char *path;
313    char *ver;
314    char *hostport; /* "host[:port]" */
315    int   ssl;
316    char *user_agent; /* Client's User-Agent: header value */
317 };
318
319 /* Response generated by CGI, blocker, or error handler */
320 struct http_response
321 {
322   char *status;           /* HTTP status (string)*/
323   struct list headers[1]; /* List of header lines */
324   char *head;             /* Formatted http response head */
325   int   head_length;      /* Length of http response head */
326   char *body;             /* HTTP document body */
327   int   content_length;   /* Length of body, REQUIRED if binary body*/
328 };
329
330 /* A URL pattern */
331 struct url_spec
332 {
333    char  *spec;        /* The string which was parsed to produce this       */
334                        /* url_spec.  Used for debugging or display only.    */
335
336    /* Hostname matching: */
337    char  *domain;      /* Fully qalified domain name (FQDN) pattern.        */
338                        /* May contain "*".                                  */
339    char  *dbuf;        /* Buffer with '\0'-delimited fqdn                   */
340    char **dvec;        /* Domain ptr vector into dbuf                       */
341    int    dcnt;        /* How many domains in fqdn?                         */
342    int    unanchored;  /* Bitmap - flags are ANCHOR_LEFT and ANCHOR_RIGHT   */
343
344    /* Port matching: */
345    int   port;         /* The port number, or 0 to match all ports.         */
346
347    /* Path matching: */
348    char *path;         /* The path prefix (if not using regex), or source   */
349                        /* for the regex.                                    */
350    int   pathlen;      /* ==strlen(path).  Needed for prefix matching.      */
351 #ifdef REGEX
352    regex_t *preg;      /* Regex for matching path part                      */
353 #endif
354 };
355
356 /* Constants for host part matching in URLs */
357 #define ANCHOR_LEFT  1
358 #define ANCHOR_RIGHT 2
359
360
361 /* An I/O buffer */
362 struct iob
363 {
364    char *buf;
365    char *cur;
366    char *eod;
367 };
368
369
370 #define IOB_PEEK(CSP) ((CSP->iob->cur > CSP->iob->eod) ? (CSP->iob->eod - CSP->iob->cur) : 0)
371 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
372
373 /* Keys for csp->content_type */
374 #define CT_TEXT 0x01U
375 #define CT_GIF  0x02U
376
377 #define ACTION_MASK_ALL        (~0U)
378
379 #define ACTION_MOST_COMPATIBLE 0x0000U
380
381 #define ACTION_BLOCK           0x0001U
382 #define ACTION_DEANIMATE       0x2000U
383 #define ACTION_FAST_REDIRECTS  0x0002U
384 #define ACTION_FILTER          0x0004U
385 #define ACTION_HIDE_FORWARDED  0x0008U
386 #define ACTION_HIDE_FROM       0x0010U
387 #define ACTION_HIDE_REFERER    0x0020U /* sic - follow HTTP, not English */
388 #define ACTION_HIDE_USER_AGENT 0x0040U
389 #define ACTION_IMAGE           0x0080U
390 #define ACTION_IMAGE_BLOCKER   0x0100U
391 #define ACTION_NO_COOKIE_READ  0x0200U
392 #define ACTION_NO_COOKIE_SET   0x0400U
393 #define ACTION_NO_POPUPS       0x0800U
394 #define ACTION_VANILLA_WAFER   0x1000U
395
396 #define ACTION_STRING_DEANIMATE     0
397 #define ACTION_STRING_FROM          1
398 #define ACTION_STRING_IMAGE_BLOCKER 2
399 #define ACTION_STRING_REFERER       3
400 #define ACTION_STRING_USER_AGENT    4
401 #define ACTION_STRING_COUNT         5
402
403
404 #define ACTION_MULTI_ADD_HEADER     0
405 #define ACTION_MULTI_WAFER          1
406 #define ACTION_MULTI_COUNT          2
407
408 /*
409  * This structure contains a list of actions to apply to a URL.
410  * It only contains positive instructions - no "-" options.
411  * It is not used to store the actions list itself, only for
412  * url_actions() to return the current values.
413  */
414 struct current_action_spec
415 {
416    unsigned flags;    /* a bit set to "1" = add action    */
417
418    /* For those actions that require parameters: */
419
420    /* each entry is valid if & only if corresponding entry in "add" set. */
421    char * string[ACTION_STRING_COUNT];
422
423    /* Strings to add */
424    struct list multi[ACTION_MULTI_COUNT][1];
425 };
426
427
428 /*
429  * This structure contains a set of changes to actions.
430  * It can contain both positive and negative instructions.
431  * It is used to store an entry in the actions list.
432  */
433 struct action_spec
434 {
435    unsigned mask;   /* a bit set to "0" = remove action */
436    unsigned add;    /* a bit set to "1" = add action    */
437
438    /* For those actions that require parameters: */
439
440    /* each entry is valid if & only if corresponding entry in "add" set. */
441    char * string[ACTION_STRING_COUNT];
442
443    /* Strings to remove. */
444    struct list multi_remove[ACTION_MULTI_COUNT][1];
445
446    /* If nonzero, remove *all* strings. */
447    int         multi_remove_all[ACTION_MULTI_COUNT];
448
449    /* Strings to add */
450    struct list multi_add[ACTION_MULTI_COUNT][1];
451 };
452
453 /*
454  * This structure is used to store the actions list.
455  *
456  * It contains a URL pattern, and the chages to the actions.
457  * It is a linked list.
458  */
459 struct url_actions
460 {
461    struct url_spec url[1];
462
463    struct action_spec action[1];
464
465    struct url_actions * next;
466 };
467
468
469 /* Constants defining bitmask for csp->accept_types */
470
471 #ifdef DETECT_MSIE_IMAGES
472
473 /* MSIE detected by user-agent string */
474 #define ACCEPT_TYPE_IS_MSIE     0x0001
475
476 /*
477  * *If* this is MSIE, it wants an image.  (Or this is a shift-reload, or
478  * it's got an image from this URL before...  yuck!)
479  * Only meaningful if ACCEPT_TYPE_IS_MSIE set 
480  */
481 #define ACCEPT_TYPE_MSIE_IMAGE  0x0002
482
483 /*
484  * *If* this is MSIE, it wants a HTML document.
485  * Only meaningful if ACCEPT_TYPE_IS_MSIE set
486  */
487 #define ACCEPT_TYPE_MSIE_HTML   0x0004
488
489 #endif /* def DETECT_MSIE_IMAGES */
490
491
492 struct client_state
493 {
494    /* The proxy's configuration */
495    struct configuration_spec * config;
496
497    /* The actions to perform on the current request */
498    struct current_action_spec  action[1];
499
500    /* socket to talk to client (web browser) */
501    int  cfd;
502
503    /* socket to talk to server (web server or proxy) */
504    int  sfd;
505
506
507 #ifdef STATISTICS
508    /* 1 if this URL was rejected, 0 otherwise. Allows actual stats inc to 
509     * occur in main thread only for thread-safety. 
510     */
511    int  rejected;
512 #endif /* def STATISTICS */
513
514 #ifdef FORCE_LOAD
515    int force;
516 #endif /* def FORCE_LOAD */
517
518 #ifdef TOGGLE
519    int   toggled_on;
520 #endif /* def TOGGLE */
521
522    /*
523     * Client PC's IP address, as reported by the accept()_ function.
524     * Both as string and number
525     */
526    char *ip_addr_str;
527    long  ip_addr_long;
528
529
530    /* Our IP address and hostname, i.e. the IP address that
531       the client used to reach us, and the associated hostname,
532       both as strings
533     */
534    char *my_ip_addr_str;
535    char *my_hostname;
536
537 #ifdef TRUST_FILES
538    /* The referer in this request, if one was specified. */
539    char *referrer;
540 #endif /* def TRUST_FILES */
541
542 #if defined(DETECT_MSIE_IMAGES)
543    /* Types the client will accept.
544     * Bitmask - see ACCEPT_TYPE_XXX constants.
545     */
546    int accept_types;
547 #endif /* defined(DETECT_MSIE_IMAGES) */
548
549    /* The URL that was requested */
550    struct http_request http[1];
551
552    /* An I/O buffer used for buffering data read from the client */
553    struct iob iob[1];
554
555    /* List of all headers for this request */
556    struct list headers[1];
557
558    /* List of all cookies for this request */
559    struct list cookie_list[1];
560
561    /* MIME-Type bitmap, see CT_* above */
562    unsigned char content_type;
563
564    /* The "X-Forwarded-For:" header sent by the client */
565    char   *x_forwarded;
566
567    /*
568     * Nonzero if this client is processing data.
569     * Set to zero when the thread associated with this structure dies.
570     */
571    int active;
572
573    /* files associated with this client */
574    struct file_list *actions_list;
575
576    struct file_list *rlist;   /* pcrs job file */
577    size_t content_length;     /* Length after content modification */ 
578
579 #ifdef TRUST_FILES
580    struct file_list *tlist;   /* trustfile */
581 #endif /* def TRUST_FILES */
582
583    struct client_state *next;
584 };
585
586
587 struct parsers
588 {
589    char *str;
590    char  len;
591    char *(*parser)(const struct parsers *, char *, struct client_state *);
592 };
593
594 struct cgi_dispatcher
595 {
596    const char *name;
597    int         name_length;
598    int         (*handler)(struct client_state *csp, struct http_response *rsp, struct map *parameters);
599    const char *description;
600 };
601
602 struct file_list
603 {
604    /*
605     * this is a pointer to the data structures associated with the file.
606     * Read-only once the structure has been created.
607     */
608    void *f;
609    
610    /* Normally NULL.  When we are finished with file (i.e. when we have
611     * loaded a new one), set to a pointer to an unloader function.
612     * Unloader will be called by sweep() (called from main loop) when
613     * all clients using this file are done.  This prevents threading 
614     * problems.
615     */
616    void (*unloader)(void *);
617
618    /* Used internally by sweep().  Do not access from elsewhere. */
619    int active;
620
621 #ifndef SPLIT_PROXY_ARGS
622    /* String to be displayed as part of show-proxy-args display.
623     * Read-only once the structure has been created.
624     */
625    char *proxy_args;
626 #endif /* ndef SPLIT_PROXY_ARGS */
627
628    /* Following variables allow us to check if file has been changed.
629     * Read-only once the structure has been created.
630     */
631    time_t lastmodified;
632    char * filename;
633
634    /* Pointer to next entry in the linked list of all "file_list"s.
635     * This linked list is so that sweep() can navigate it.
636     * Since sweep() can remove items from the list, we must be careful
637     * to only access this value from main thread (when we know sweep
638     * won't be running).
639     */
640    struct file_list *next;
641 };
642
643
644 #ifdef TRUST_FILES
645 struct block_spec
646 {
647    struct url_spec url[1];
648    int    reject;
649    struct block_spec *next;
650 };
651 #endif /* def TRUST_FILES */
652
653
654 #define SOCKS_NONE    0    /* Don't use a SOCKS server */
655 #define SOCKS_4      40    /* original SOCKS 4 protocol */
656 #define SOCKS_4A     41    /* as modified for hosts w/o external DNS */
657
658 struct forward_spec
659 {
660    struct url_spec url[1];
661
662    /* Connection type - must be a SOCKS_xxx constant */
663    int   type;
664
665    /* SOCKS server */
666    char *gateway_host;
667    int   gateway_port;
668
669    /* Parent HTTP proxy */
670    char *forward_host;
671    int   forward_port;
672
673    /* For the linked list */
674    struct forward_spec *next;
675 };
676
677 struct re_filterfile_spec
678 {
679    char *username;
680    char *filtername;
681    struct list patterns[1];
682    pcrs_job *joblist;
683 };
684
685 #ifdef ACL_FILES
686 #define ACL_PERMIT   1  /* accept connection request */
687 #define ACL_DENY     2  /* reject connection request */
688
689 struct access_control_addr
690 {
691    unsigned long addr;
692    unsigned long mask;
693    unsigned long port;
694 };
695
696 struct access_control_list
697 {
698    struct access_control_addr src[1];
699    struct access_control_addr dst[1];
700
701    short action;
702    struct access_control_list *next;
703 };
704 #endif /* def ACL_FILES */
705
706
707 /* Maximum number of loaders (actions, re_filter, ...) */
708 #define NLOADERS 8
709
710 /*
711  * Data loaded from the configuration file.
712  *
713  * (Anomaly: toggle is still handled through a global, not this structure)
714  */
715 struct configuration_spec
716 {
717    int debug;
718    int multi_threaded;
719
720    const char *logfile;
721
722    const char *confdir;
723    const char *logdir;
724    const char *actions_file;
725
726    /* The administrator's email address */
727    char *admin_address;
728
729    /* A URL with info on this proxy */
730    char *proxy_info_url;
731
732    const char *re_filterfile;
733
734 #ifdef JAR_FILES
735    const char * jarfile;
736    FILE * jar;
737 #endif /* def JAR_FILES */
738
739    /*
740     * Port and IP to bind to.
741     * Defaults to HADDR_DEFAULT:HADDR_PORT == 127.0.0.1:8000
742     */
743    const char *haddr;
744    int         hport;
745
746 #ifndef SPLIT_PROXY_ARGS
747    const char *suppress_message;
748 #endif /* ndef SPLIT_PROXY_ARGS */
749
750 #ifndef SPLIT_PROXY_ARGS
751    /* suppress listing config files */
752    int suppress_blocklists;
753 #endif /* ndef SPLIT_PROXY_ARGS */
754
755 #ifdef TRUST_FILES
756    const char * trustfile;
757
758    struct list trust_info[1];
759    struct url_spec *trust_list[64];
760 #endif /* def TRUST_FILES */
761
762 #ifdef ACL_FILES
763    struct access_control_list *acl;
764 #endif /* def ACL_FILES */
765
766    struct forward_spec *forward;
767
768    /* All options from the config file, HTML-formatted */
769    char *proxy_args;
770
771    /* the configuration file object. */
772    struct file_list *config_file_list;
773
774    /* List of loaders */
775    int (*loaders[NLOADERS])(struct client_state *);
776
777    /* bool, nonzero if we need to bind() to the new port */
778    int need_bind;
779 };
780
781
782 #define SZ(X)  (sizeof(X) / sizeof(*X))
783
784 #ifdef FORCE_LOAD
785 #define FORCE_PREFIX "/IJB-FORCE-LOAD"
786 #endif /* def FORCE_LOAD */
787
788 /* Hardwired URLs */
789 #define HOME_PAGE_URL  "http://ijbswa.sourceforge.net"
790 #define REDIRECT_URL HOME_PAGE_URL "/redirect.php?v=" VERSION "&to="
791 #define CGI_PREFIX_HOST "i.j.b"
792
793 /* HTTP snipplets */
794 static const char CSUCCEED[] =
795    "HTTP/1.0 200 Connection established\n"
796    "Proxy-Agent: IJ/" VERSION "\n\n";
797
798 static const char CHEADER[] =
799    "HTTP/1.0 400 Invalid header received from browser\n\n";
800
801 #ifdef __cplusplus
802 } /* extern "C" */
803 #endif
804
805 #endif /* ndef PROJECT_H_INCLUDED */
806
807 /*
808   Local Variables:
809   tab-width: 3
810   end:
811 */