3 #define PROJECT_H_VERSION "$Id: project.h,v 1.1 2001/05/13 21:57:07 administrator Exp $"
4 /*********************************************************************
6 * File : $Source: /home/administrator/cvs/ijb/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.
40 *********************************************************************/
43 /* Declare struct FILE for vars and funcs. */
46 /* Need time_t for file_list */
50 * Include appropriate regular expression libraries.
52 * PCRS ==> Include pcre
53 * REGEX && PCRE ==> Include pcre and pcreposix
54 * REGEX && !PCRE ==> Include gnu_regex
56 * STATIC ==> Use #include "pcre.h" (compiling at same time)
57 * !STATIC ==> Use #include <pcre.h> (System library)
60 #if (defined(REGEX) && defined(PCRE)) || defined(PCRS)
66 #endif /* (defined(REGEX) && defined(PCRE)) || defined(PCRS) */
68 #if defined(REGEX) && defined(PCRE)
70 # include "pcreposix.h"
72 # include <pcreposix.h>
74 #endif /* defined(REGEX) && defined(PCRE) */
76 #if defined(REGEX) && !defined(PCRE)
77 # include "gnu_regex.h"
86 #endif /* def AMIGA */
94 /* Default IP and port to listen on */
95 #define HADDR_DEFAULT "127.0.0.1"
96 #define HADDR_PORT 8000
99 /* Need this for struct gateway */
111 char *hostport; /* "host[:port]" */
118 /* generic attributes */
120 int (*conn)(const struct gateway *, struct http_request *, struct client_state *);
123 /* domain specific attributes */
156 #define IOB_PEEK(CSP) ((CSP->iob->cur > CSP->iob->eod) ? (CSP->iob->eod - CSP->iob->cur) : 0)
157 #define IOB_RESET(CSP) if(CSP->iob->buf) free(CSP->iob->buf); memset(CSP->iob, '\0', sizeof(CSP->iob));
160 /* Constants defining bitmask for csp->accept_types */
162 #ifdef DETECT_MSIE_IMAGES
164 /* MSIE detected by user-agent string */
165 #define ACCEPT_TYPE_IS_MSIE 0x0001
168 * *If* this is MSIE, it wants an image. (Or this is a shift-reload, or
169 * it's got an image from this URL before... yuck!)
170 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
172 #define ACCEPT_TYPE_MSIE_IMAGE 0x0002
175 * *If* this is MSIE, it wants a HTML document.
176 * Only meaningful if ACCEPT_TYPE_IS_MSIE set
178 #define ACCEPT_TYPE_MSIE_HTML 0x0004
180 #endif /* def DETECT_MSIE_IMAGES */
185 int send_user_cookie;
186 int accept_server_cookie;
191 /* 1 if this URL was rejected, 0 otherwise. Allows actual stats inc to
192 * occur in main thread only for thread-safety.
195 #endif /* def STATISTICS */
199 #endif /* def FORCE_LOAD */
203 * by haroon - most of credit to srt19170
204 * We add an "on/off" toggle here that is used to effectively toggle
205 * the Junkbuster off or on
214 #if defined(DETECT_MSIE_IMAGES)
215 /* Types the client will accept.
216 * Bitmask - see ACCEPT_TYPE_XXX constants.
219 #endif /* defined(DETECT_MSIE_IMAGES) */
221 const struct gateway *gw;
222 struct http_request http[1];
226 struct list headers[1];
227 struct list cookie_list[1];
230 #endif /* def PCRS */
236 /* files associated with this client */
237 struct file_list *blist; /* blockfile */
238 struct file_list *clist; /* cookiefile */
239 struct file_list *flist; /* forwardfile */
242 struct file_list *alist; /* aclfile */
243 #endif /* def ACL_FILES */
245 #ifdef USE_IMAGE_LIST
246 struct file_list *ilist; /* imagefile */
247 #endif /* def USE_IMAGE_LIST */
250 struct file_list *plist; /* kill popup file */
251 #endif /* def KILLPOPUPS */
254 struct file_list *rlist; /* Perl re_filterfile */
255 #endif /* def PCRS */
258 struct file_list *tlist; /* trustfile */
259 #endif /* def TRUST_FILES */
261 struct client_state *next;
269 char *(*parser)(const struct parsers *, char *, struct client_state *);
277 char *(*interceptor)(struct http_request *http, struct client_state *csp);
281 /* this allows the proxy to permit/block access to any host and/or path */
304 * this is a pointer to the data structures associated with the file.
305 * Read-only once the structure has been created.
309 /* Normally NULL. When we are finished with file (i.e. when we have
310 * loaded a new one), set to a pointer to an unloader function.
311 * Unloader will be called by sweep() (called from main loop) when
312 * all clients using this file are done. This prevents threading
315 void (*unloader)(void *);
317 /* Used internally by sweep(). Do not access from elsewhere. */
320 #ifndef SPLIT_PROXY_ARGS
321 /* String to be displayed as part of show-proxy-args display.
322 * Read-only once the structure has been created.
325 #endif /* ndef SPLIT_PROXY_ARGS */
327 /* Following variables allow us to check if file has been changed.
328 * Read-only once the structure has been created.
333 /* Pointer to next entry in the linked list of all "file_list"s.
334 * This linked list is so that sweep() can navigate it.
335 * Since sweep() can remove items from the list, we must be careful
336 * to only access this value from main thread (when we know sweep
339 struct file_list *next;
345 struct url_spec url[1];
347 struct block_spec *next;
353 struct url_spec url[1];
354 int send_user_cookie;
355 int accept_server_cookie;
356 struct cookie_spec *next;
362 struct url_spec url[1];
364 struct gateway gw[1];
365 struct forward_spec *next;
370 struct re_filterfile_spec
372 struct list patterns[1];
373 /* See README.re_filter */
376 #endif /* def PCRS */
380 /* Entries on popup blocklist */
381 struct popup_blocklist
384 struct popup_blocklist *next;
387 /* Actual type used in file object */
388 struct popup_settings
390 struct popup_blocklist *blocked;
391 struct popup_blocklist *allowed;
393 #endif /* def KILLPOPUPS */
396 #define ACL_PERMIT 1 /* accept connection request */
397 #define ACL_DENY 2 /* reject connection request */
399 struct access_control_addr
406 struct access_control_list
408 struct access_control_addr src[1];
409 struct access_control_addr dst[1];
412 struct access_control_list *next;
414 #endif /* def ACL_FILES */
416 #define SZ(X) (sizeof(X) / sizeof(*X))
418 #define WHITEBG "<body bgcolor=\"#ffffff\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
419 #define BODY "<body bgcolor=\"#f8f8f0\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
420 #define BANNER "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
424 * FIXME: Unfortunately, IE lowercases the domain name. JunkBuster does
\r
425 * a case-sensitive compare. JunkBuster should be modified to do a
\r
426 * case-insensitive compatison. As a temporary workaround, I've lowercased
\r
427 * the FORCE_PREFIX.
\r
429 * #define FORCE_PREFIX "IJB-FORCE-LOAD-"
\r
431 #define FORCE_PREFIX "ijb-force-load-"
\r
432 #endif /* def FORCE_LOAD */
434 #define HOME_PAGE_URL "http://ijbswa.sourceforge.net/"
435 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
441 #endif /* ndef _PROJECT_H */