3 #define PROJECT_H_VERSION "$Id: project.h,v 1.1.1.1 2001/05/15 13:59:03 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.1.1.1 2001/05/15 13:59:03 oes
40 * Initial import of version 2.9.3 source tree
43 *********************************************************************/
46 /* Declare struct FILE for vars and funcs. */
49 /* Need time_t for file_list */
53 * Include appropriate regular expression libraries.
55 * PCRS ==> Include pcre
56 * REGEX && PCRE ==> Include pcre and pcreposix
57 * REGEX && !PCRE ==> Include gnu_regex
59 * STATIC ==> Use #include "pcre.h" (compiling at same time)
60 * !STATIC ==> Use #include <pcre.h> (System library)
63 #if (defined(REGEX) && defined(PCRE)) || defined(PCRS)
69 #endif /* (defined(REGEX) && defined(PCRE)) || defined(PCRS) */
71 #if defined(REGEX) && defined(PCRE)
73 # include "pcreposix.h"
75 # include <pcreposix.h>
77 #endif /* defined(REGEX) && defined(PCRE) */
79 #if defined(REGEX) && !defined(PCRE)
80 # include "gnu_regex.h"
89 #endif /* def AMIGA */
97 /* Default IP and port to listen on */
98 #define HADDR_DEFAULT "127.0.0.1"
99 #define HADDR_PORT 8000
102 /* Need this for struct gateway */
114 char *hostport; /* "host[:port]" */
121 /* generic attributes */
123 int (*conn)(const struct gateway *, struct http_request *, struct client_state *);
126 /* domain specific attributes */
159 #define IOB_PEEK(CSP) ((CSP->iob->cur > CSP->iob->eod) ? (CSP->iob->eod - CSP->iob->cur) : 0)
160 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
163 /* Constants defining bitmask for csp->accept_types */
165 #ifdef DETECT_MSIE_IMAGES
167 /* MSIE detected by user-agent string */
168 #define ACCEPT_TYPE_IS_MSIE 0x0001
171 * *If* this is MSIE, it wants an image. (Or this is a shift-reload, or
172 * it's got an image from this URL before... yuck!)
173 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
175 #define ACCEPT_TYPE_MSIE_IMAGE 0x0002
178 * *If* this is MSIE, it wants a HTML document.
179 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
181 #define ACCEPT_TYPE_MSIE_HTML 0x0004
183 #endif /* def DETECT_MSIE_IMAGES */
188 int send_user_cookie;
189 int accept_server_cookie;
194 /* 1 if this URL was rejected, 0 otherwise. Allows actual stats inc to
195 * occur in main thread only for thread-safety.
198 #endif /* def STATISTICS */
202 #endif /* def FORCE_LOAD */
206 * by haroon - most of credit to srt19170
207 * We add an "on/off" toggle here that is used to effectively toggle
208 * the Junkbuster off or on
217 #if defined(DETECT_MSIE_IMAGES)
218 /* Types the client will accept.
219 * Bitmask - see ACCEPT_TYPE_XXX constants.
222 #endif /* defined(DETECT_MSIE_IMAGES) */
224 const struct gateway *gw;
225 struct http_request http[1];
229 struct list headers[1];
230 struct list cookie_list[1];
233 #endif /* def PCRS */
239 /* files associated with this client */
240 struct file_list *blist; /* blockfile */
241 struct file_list *clist; /* cookiefile */
242 struct file_list *flist; /* forwardfile */
245 struct file_list *alist; /* aclfile */
246 #endif /* def ACL_FILES */
248 #ifdef USE_IMAGE_LIST
249 struct file_list *ilist; /* imagefile */
250 #endif /* def USE_IMAGE_LIST */
253 struct file_list *plist; /* kill popup file */
254 #endif /* def KILLPOPUPS */
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;
356 struct url_spec url[1];
357 int send_user_cookie;
358 int accept_server_cookie;
359 struct cookie_spec *next;
365 struct url_spec url[1];
367 struct gateway gw[1];
368 struct forward_spec *next;
373 struct re_filterfile_spec
375 struct list patterns[1];
376 /* See README.re_filter */
379 #endif /* def PCRS */
383 /* Entries on popup blocklist */
384 struct popup_blocklist
387 struct popup_blocklist *next;
390 /* Actual type used in file object */
391 struct popup_settings
393 struct popup_blocklist *blocked;
394 struct popup_blocklist *allowed;
396 #endif /* def KILLPOPUPS */
399 #define ACL_PERMIT 1 /* accept connection request */
400 #define ACL_DENY 2 /* reject connection request */
402 struct access_control_addr
409 struct access_control_list
411 struct access_control_addr src[1];
412 struct access_control_addr dst[1];
415 struct access_control_list *next;
417 #endif /* def ACL_FILES */
419 #define SZ(X) (sizeof(X) / sizeof(*X))
421 #define WHITEBG "<body bgcolor=\"#ffffff\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
422 #define BODY "<body bgcolor=\"#f8f8f0\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
423 #define BANNER "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
427 * FIXME: Unfortunately, IE lowercases the domain name. JunkBuster does
428 * a case-sensitive compare. JunkBuster should be modified to do a
429 * case-insensitive compatison. As a temporary workaround, I've lowercased
432 * #define FORCE_PREFIX "IJB-FORCE-LOAD-"
434 #define FORCE_PREFIX "ijb-force-load-"
435 #endif /* def FORCE_LOAD */
437 #define HOME_PAGE_URL "http://ijbswa.sourceforge.net/"
438 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
444 #endif /* ndef _PROJECT_H */