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