3 #define PROJECT_H_VERSION "$Id: project.h,v 1.2 2001/05/17 23:01:01 oes Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/project.h,v $
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).
12 * Copyright : Written by and Copyright (C) 2001 the SourceForge
13 * IJBSWA team. http://ijbswa.sourceforge.net
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
39 * Revision 1.2 2001/05/17 23:01:01 oes
40 * - Cleaned CRLF's from the sources and related files
42 * Revision 1.1.1.1 2001/05/15 13:59:03 oes
43 * Initial import of version 2.9.3 source tree
46 *********************************************************************/
49 /* Declare struct FILE for vars and funcs. */
52 /* Need time_t for file_list */
56 * Include appropriate regular expression libraries.
58 * PCRS ==> Include pcre
59 * REGEX && PCRE ==> Include pcre and pcreposix
60 * REGEX && !PCRE ==> Include gnu_regex
62 * STATIC ==> Use #include "pcre.h" (compiling at same time)
63 * !STATIC ==> Use #include <pcre.h> (System library)
66 #if (defined(REGEX) && defined(PCRE)) || defined(PCRS)
72 #endif /* (defined(REGEX) && defined(PCRE)) || defined(PCRS) */
74 #if defined(REGEX) && defined(PCRE)
76 # include "pcreposix.h"
78 # include <pcreposix.h>
80 #endif /* defined(REGEX) && defined(PCRE) */
82 #if defined(REGEX) && !defined(PCRE)
83 # include "gnu_regex.h"
92 #endif /* def AMIGA */
100 /* Default IP and port to listen on */
101 #define HADDR_DEFAULT "127.0.0.1"
102 #define HADDR_PORT 8000
105 /* Need this for struct gateway */
117 char *hostport; /* "host[:port]" */
124 /* generic attributes */
126 int (*conn)(const struct gateway *, struct http_request *, struct client_state *);
129 /* domain specific attributes */
162 #define IOB_PEEK(CSP) ((CSP->iob->cur > CSP->iob->eod) ? (CSP->iob->eod - CSP->iob->cur) : 0)
163 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
166 /* Constants defining bitmask for csp->accept_types */
168 #ifdef DETECT_MSIE_IMAGES
170 /* MSIE detected by user-agent string */
171 #define ACCEPT_TYPE_IS_MSIE 0x0001
174 * *If* this is MSIE, it wants an image. (Or this is a shift-reload, or
175 * it's got an image from this URL before... yuck!)
176 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
178 #define ACCEPT_TYPE_MSIE_IMAGE 0x0002
181 * *If* this is MSIE, it wants a HTML document.
182 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
184 #define ACCEPT_TYPE_MSIE_HTML 0x0004
186 #endif /* def DETECT_MSIE_IMAGES */
197 /* 1 if this URL was rejected, 0 otherwise. Allows actual stats inc to
198 * occur in main thread only for thread-safety.
201 #endif /* def STATISTICS */
205 #endif /* def FORCE_LOAD */
209 * by haroon - most of credit to srt19170
210 * We add an "on/off" toggle here that is used to effectively toggle
211 * the Junkbuster off or on
220 #if defined(DETECT_MSIE_IMAGES)
221 /* Types the client will accept.
222 * Bitmask - see ACCEPT_TYPE_XXX constants.
225 #endif /* defined(DETECT_MSIE_IMAGES) */
227 const struct gateway *gw;
228 struct http_request http[1];
232 struct list headers[1];
233 struct list cookie_list[1];
234 #if defined(PCRS) || defined(KILLPOPUPS)
236 #endif /* defined(PCRS) || defined(KILLPOPUPS) */
242 /* files associated with this client */
243 struct file_list *blist; /* blockfile */
244 struct file_list *flist; /* forwardfile */
245 struct file_list *permissions_list;
\r
249 struct file_list *alist; /* aclfile */
250 #endif /* def ACL_FILES */
252 #ifdef USE_IMAGE_LIST
253 struct file_list *ilist; /* imagefile */
254 #endif /* def USE_IMAGE_LIST */
257 struct file_list *rlist; /* Perl re_filterfile */
258 #endif /* def PCRS */
261 struct file_list *tlist; /* trustfile */
262 #endif /* def TRUST_FILES */
264 struct client_state *next;
272 char *(*parser)(const struct parsers *, char *, struct client_state *);
280 char *(*interceptor)(struct http_request *http, struct client_state *csp);
284 /* this allows the proxy to permit/block access to any host and/or path */
307 * this is a pointer to the data structures associated with the file.
308 * Read-only once the structure has been created.
312 /* Normally NULL. When we are finished with file (i.e. when we have
313 * loaded a new one), set to a pointer to an unloader function.
314 * Unloader will be called by sweep() (called from main loop) when
315 * all clients using this file are done. This prevents threading
318 void (*unloader)(void *);
320 /* Used internally by sweep(). Do not access from elsewhere. */
323 #ifndef SPLIT_PROXY_ARGS
324 /* String to be displayed as part of show-proxy-args display.
325 * Read-only once the structure has been created.
328 #endif /* ndef SPLIT_PROXY_ARGS */
330 /* Following variables allow us to check if file has been changed.
331 * Read-only once the structure has been created.
336 /* Pointer to next entry in the linked list of all "file_list"s.
337 * This linked list is so that sweep() can navigate it.
338 * Since sweep() can remove items from the list, we must be careful
339 * to only access this value from main thread (when we know sweep
342 struct file_list *next;
348 struct url_spec url[1];
350 struct block_spec *next;
354 #define PERMIT_COOKIE_SET 0x0001
\r
355 #define PERMIT_COOKIE_READ 0x0002
\r
356 #define PERMIT_RE_FILTER 0x0004
\r
357 #define PERMIT_POPUPS 0x0008
\r
359 struct permissions_spec
\r
361 struct url_spec url[1];
\r
363 struct permissions_spec * next;
\r
368 struct url_spec url[1];
370 struct gateway gw[1];
371 struct forward_spec *next;
376 struct re_filterfile_spec
378 struct list patterns[1];
379 /* See README.re_filter */
382 #endif /* def PCRS */
386 #define ACL_PERMIT 1 /* accept connection request */
387 #define ACL_DENY 2 /* reject connection request */
389 struct access_control_addr
396 struct access_control_list
398 struct access_control_addr src[1];
399 struct access_control_addr dst[1];
402 struct access_control_list *next;
404 #endif /* def ACL_FILES */
406 #define SZ(X) (sizeof(X) / sizeof(*X))
408 #define WHITEBG "<body bgcolor=\"#ffffff\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
409 #define BODY "<body bgcolor=\"#f8f8f0\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
410 #define BANNER "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
414 * FIXME: Unfortunately, IE lowercases the domain name. JunkBuster does
415 * a case-sensitive compare. JunkBuster should be modified to do a
416 * case-insensitive compatison. As a temporary workaround, I've lowercased
419 * #define FORCE_PREFIX "IJB-FORCE-LOAD-"
421 #define FORCE_PREFIX "ijb-force-load-"
422 #endif /* def FORCE_LOAD */
424 #define HOME_PAGE_URL "http://ijbswa.sourceforge.net/"
425 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
431 #endif /* ndef _PROJECT_H */