1 #ifndef LOADERS_H_INCLUDED
2 #define LOADERS_H_INCLUDED
3 #define LOADERS_H_VERSION "$Id: loaders.h,v 1.14 2002/01/17 21:03:08 jongfoster Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/loaders.h,v $
8 * Purpose : Functions to load and unload the various
9 * configuration files. Also contains code to manage
10 * the list of active loaders, and to automatically
11 * unload files that are no longer in use.
13 * Copyright : Written by and Copyright (C) 2001 the SourceForge
14 * IJBSWA team. http://ijbswa.sourceforge.net
16 * Based on the Internet Junkbuster originally written
17 * by and Copyright (C) 1997 Anonymous Coders and
18 * Junkbusters Corporation. http://www.junkbusters.com
20 * This program is free software; you can redistribute it
21 * and/or modify it under the terms of the GNU General
22 * Public License as published by the Free Software
23 * Foundation; either version 2 of the License, or (at
24 * your option) any later version.
26 * This program is distributed in the hope that it will
27 * be useful, but WITHOUT ANY WARRANTY; without even the
28 * implied warranty of MERCHANTABILITY or FITNESS FOR A
29 * PARTICULAR PURPOSE. See the GNU General Public
30 * License for more details.
32 * The GNU General Public License should be included with
33 * this file. If not, you can view it at
34 * http://www.gnu.org/copyleft/gpl.html
35 * or write to the Free Software Foundation, Inc., 59
36 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 * Revision 1.14 2002/01/17 21:03:08 jongfoster
41 * Moving all our URL and URL pattern parsing code to urlmatch.c.
43 * Renaming free_url to free_url_spec, since it frees a struct url_spec.
45 * Revision 1.13 2001/12/30 14:07:32 steudten
46 * - Add signal handling (unix)
47 * - Add SIGHUP handler (unix)
48 * - Add creation of pidfile (unix)
49 * - Add action 'top' in rc file (RH)
50 * - Add entry 'SIGNALS' to manpage
51 * - Add exit message to logfile (unix)
53 * Revision 1.12 2001/11/07 00:02:13 steudten
54 * Add line number in error output for lineparsing for
55 * actionsfile and configfile.
56 * Special handling for CLF added.
58 * Revision 1.11 2001/10/23 21:38:53 jongfoster
59 * Adding error-checking to create_url_spec()
61 * Revision 1.10 2001/09/22 16:36:59 jongfoster
62 * Removing unused parameter fs from read_config_line()
64 * Revision 1.9 2001/07/30 22:08:36 jongfoster
65 * Tidying up #defines:
66 * - All feature #defines are now of the form FEATURE_xxx
67 * - Permanently turned off WIN_GUI_EDIT
68 * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
70 * Revision 1.8 2001/07/29 18:58:15 jongfoster
71 * Removing nested #includes, adding forward declarations for needed
72 * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
74 * Revision 1.7 2001/07/13 14:01:54 oes
75 * Removed all #ifdef PCRS
77 * Revision 1.6 2001/06/07 23:14:38 jongfoster
78 * Removing ACL and forward file loaders - these files have
79 * been merged into the config file.
81 * Revision 1.5 2001/05/31 21:28:49 jongfoster
82 * Removed all permissionsfile code - it's now called the actions
83 * file, and (almost) all the code is in actions.c
85 * Revision 1.4 2001/05/29 09:50:24 jongfoster
86 * Unified blocklist/imagelist/permissionslist.
87 * File format is still under discussion, but the internal changes
90 * Also modified interceptor behaviour:
91 * - We now intercept all URLs beginning with one of the following
92 * prefixes (and *only* these prefixes):
94 * * http://ijbswa.sf.net/config/
95 * * http://ijbswa.sourceforge.net/config/
96 * - New interceptors "home page" - go to http://i.j.b/ to see it.
97 * - Internal changes so that intercepted and fast redirect pages
98 * are not replaced with an image.
99 * - Interceptors now have the option to send a binary page direct
100 * to the client. (i.e. ijb-send-banner uses this)
101 * - Implemented show-url-info interceptor. (Which is why I needed
102 * the above interceptors changes - a typical URL is
103 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
104 * The previous mechanism would not have intercepted that, and
105 * if it had been intercepted then it then it would have replaced
108 * Revision 1.3 2001/05/26 00:28:36 jongfoster
109 * Automatic reloading of config file.
110 * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
111 * Most of the global variables have been moved to a new
112 * struct configuration_spec, accessed through csp->config->globalname
113 * Most of the globals remaining are used by the Win32 GUI.
115 * Revision 1.2 2001/05/20 01:21:20 jongfoster
116 * Version 2.9.4 checkin.
117 * - Merged popupfile and cookiefile, and added control over PCRS
118 * filtering, in new "permissionsfile".
119 * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
120 * file error you now get a message box (in the Win32 GUI) rather
121 * than the program exiting with no explanation.
122 * - Made killpopup use the PCRS MIME-type checking and HTTP-header
124 * - Removed tabs from "config"
125 * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
126 * - Bumped up version number.
128 * Revision 1.1.1.1 2001/05/15 13:59:00 oes
129 * Initial import of version 2.9.3 source tree
132 *********************************************************************/
139 /* Structures taken from project.h */
142 struct configuration_spec;
145 extern void sweep(void);
146 extern char *read_config_line(char *buf, int buflen, FILE *fp, unsigned long *linenum);
147 extern int check_file_changed(const struct file_list * current,
148 const char * filename,
149 struct file_list ** newfl);
151 extern jb_err edit_read_line(FILE *fp,
156 unsigned long *line_number);
158 extern jb_err simple_read_line(FILE *fp, char **dest, int *newline);
161 * Various types of newlines that a file may contain.
163 #define NEWLINE_UNKNOWN 0 /* Newline convention in file is unknown */
164 #define NEWLINE_UNIX 1 /* Newline convention in file is '\n' (ASCII 10) */
165 #define NEWLINE_DOS 2 /* Newline convention in file is '\r\n' (ASCII 13,10) */
166 #define NEWLINE_MAC 3 /* Newline convention in file is '\r' (ASCII 13) */
169 * Types of newlines that a file may contain, as strings. If you have an
170 * extremely wierd compiler that does not have '\r' == CR == ASCII 13 and
171 * '\n' == LF == ASCII 10), then fix CHAR_CR and CHAR_LF in loaders.c as
172 * well as these definitions.
174 #define NEWLINE(style) ((style)==NEWLINE_DOS ? "\r\n" : \
175 ((style)==NEWLINE_MAC ? "\r" : "\n"))
178 extern short int MustReload;
179 extern int load_actions_file(struct client_state *csp);
180 extern int load_re_filterfile(struct client_state *csp);
183 extern int load_trustfile(struct client_state *csp);
184 #endif /* def FEATURE_TRUST */
188 extern void add_loader(int (*loader)(struct client_state *),
189 struct configuration_spec * config);
190 extern int run_loader(struct client_state *csp);
192 /* Revision control strings from this header and associated .c file */
193 extern const char loaders_rcs[];
194 extern const char loaders_h_rcs[];
200 #endif /* ndef LOADERS_H_INCLUDED */