Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

loaders.h

Go to the documentation of this file.
00001 #ifndef LOADERS_H_INCLUDED
00002 #define LOADERS_H_INCLUDED
00003 #define LOADERS_H_VERSION "$Id: loaders.h,v 2.1 2002/06/04 17:22:37 jongfoster Exp $"
00004 /* ******************************************************************
00005  * $Source: /cvsroot/ijbswa/current/src/loaders.h,v $
00006  * ******************************************************************
00007  *
00008  * Written by and Copyright (C) 2001 the SourceForge
00009  * Privoxy team. http://www.privoxy.org/
00010  * 
00011  * Based on the Internet Junkbuster originally written
00012  * by and Copyright (C) 1997 Anonymous Coders and
00013  * Junkbusters Corporation.  http://www.junkbusters.com
00014  * 
00015  * This program is free software; you can redistribute it
00016  * and/or modify it under the terms of the GNU General
00017  * Public License as published by the Free Software
00018  * Foundation; either version 2 of the License, or (at
00019  * your option) any later version.
00020  * 
00021  * This program is distributed in the hope that it will
00022  * be useful, but WITHOUT ANY WARRANTY; without even the
00023  * implied warranty of MERCHANTABILITY or FITNESS FOR A
00024  * PARTICULAR PURPOSE.  See the GNU General Public
00025  * License for more details.
00026  * 
00027  * The GNU General Public License should be included with
00028  * this file.  If not, you can view it at
00029  * http://www.gnu.org/copyleft/gpl.html
00030  * or write to the Free Software Foundation, Inc., 59
00031  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00032  * 
00033  * *****************************************************************/
00034 /**
00035  * @file
00036  *
00037  * Functions to load and unload the various
00038  * configuration files.  Also contains code to manage
00039  * the list of active loaders, and to automatically
00040  * unload files that are no longer in use.
00041  * 
00042  *
00043  * $Log: loaders.h,v $
00044  * Revision 2.1  2002/06/04 17:22:37  jongfoster
00045  * Adding comments
00046  * 
00047  * Revision 2.0  2002/06/04 14:34:21  jongfoster
00048  * Moving source files to src/
00049  * 
00050  * Revision 1.19  2002/03/26 22:29:55  swa
00051  * we have a new homepage!
00052  * 
00053  * Revision 1.18  2002/03/24 13:25:43  swa
00054  * name change related issues
00055  * 
00056  * Revision 1.17  2002/03/16 23:54:06  jongfoster
00057  * Adding graceful termination feature, to help look for memory leaks.
00058  * If you enable this (which, by design, has to be done by hand
00059  * editing config.h) and then go to http://i.j.b/die, then the program
00060  * will exit cleanly after the *next* request.  It should free all the
00061  * memory that was used.
00062  * 
00063  * Revision 1.16  2002/03/07 03:46:17  oes
00064  * Fixed compiler warnings
00065  * 
00066  * Revision 1.15  2002/01/22 23:46:18  jongfoster
00067  * Moving edit_read_line() and simple_read_line() to loaders.c, and
00068  * extending them to support reading MS-DOS, Mac and UNIX style files
00069  * on all platforms.
00070  * 
00071  * Modifying read_config_line() (without changing it's prototype) to
00072  * be a trivial wrapper for edit_read_line().  This means that we have
00073  * one function to read a line and handle comments, which is common
00074  * between the initialization code and the edit interface.
00075  * 
00076  * Revision 1.14  2002/01/17 21:03:08  jongfoster
00077  * Moving all our URL and URL pattern parsing code to urlmatch.c.
00078  * 
00079  * Renaming free_url to free_url_spec, since it frees a struct url_spec.
00080  * 
00081  * Revision 1.13  2001/12/30 14:07:32  steudten
00082  * - Add signal handling (unix)
00083  * - Add SIGHUP handler (unix)
00084  * - Add creation of pidfile (unix)
00085  * - Add action 'top' in rc file (RH)
00086  * - Add entry 'SIGNALS' to manpage
00087  * - Add exit message to logfile (unix)
00088  * 
00089  * Revision 1.12  2001/11/07 00:02:13  steudten
00090  * Add line number in error output for lineparsing for
00091  * actionsfile and configfile.
00092  * Special handling for CLF added.
00093  * 
00094  * Revision 1.11  2001/10/23 21:38:53  jongfoster
00095  * Adding error-checking to create_url_spec()
00096  * 
00097  * Revision 1.10  2001/09/22 16:36:59  jongfoster
00098  * Removing unused parameter fs from read_config_line()
00099  * 
00100  * Revision 1.9  2001/07/30 22:08:36  jongfoster
00101  * Tidying up #defines:
00102  * - All feature #defines are now of the form FEATURE_xxx
00103  * - Permanently turned off WIN_GUI_EDIT
00104  * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
00105  * 
00106  * Revision 1.8  2001/07/29 18:58:15  jongfoster
00107  * Removing nested #includes, adding forward declarations for needed
00108  * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
00109  * 
00110  * Revision 1.7  2001/07/13 14:01:54  oes
00111  * Removed all #ifdef PCRS
00112  * 
00113  * Revision 1.6  2001/06/07 23:14:38  jongfoster
00114  * Removing ACL and forward file loaders - these files have
00115  * been merged into the config file.
00116  * 
00117  * Revision 1.5  2001/05/31 21:28:49  jongfoster
00118  * Removed all permissionsfile code - it's now called the actions
00119  * file, and (almost) all the code is in actions.c
00120  * 
00121  * Revision 1.4  2001/05/29 09:50:24  jongfoster
00122  * Unified blocklist/imagelist/permissionslist.
00123  * File format is still under discussion, but the internal changes
00124  * are (mostly) done.
00125  * 
00126  * Also modified interceptor behaviour:
00127  * - We now intercept all URLs beginning with one of the following
00128  *   prefixes (and *only* these prefixes):
00129  *     * http://i.j.b/
00130  *     * http://ijbswa.sf.net/config/
00131  *     * http://ijbswa.sourceforge.net/config/
00132  * - New interceptors "home page" - go to http://i.j.b/ to see it.
00133  * - Internal changes so that intercepted and fast redirect pages
00134  *   are not replaced with an image.
00135  * - Interceptors now have the option to send a binary page direct
00136  *   to the client. (i.e. ijb-send-banner uses this)
00137  * - Implemented show-url-info interceptor.  (Which is why I needed
00138  *   the above interceptors changes - a typical URL is
00139  *   "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
00140  *   The previous mechanism would not have intercepted that, and
00141  *   if it had been intercepted then it then it would have replaced
00142  *   it with an image.)
00143  * 
00144  * Revision 1.3  2001/05/26 00:28:36  jongfoster
00145  * Automatic reloading of config file.
00146  * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
00147  * Most of the global variables have been moved to a new
00148  * struct configuration_spec, accessed through csp->config->globalname
00149  * Most of the globals remaining are used by the Win32 GUI.
00150  * 
00151  * Revision 1.2  2001/05/20 01:21:20  jongfoster
00152  * Version 2.9.4 checkin.
00153  * - Merged popupfile and cookiefile, and added control over PCRS
00154  *   filtering, in new "permissionsfile".
00155  * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
00156  *   file error you now get a message box (in the Win32 GUI) rather
00157  *   than the program exiting with no explanation.
00158  * - Made killpopup use the PCRS MIME-type checking and HTTP-header
00159  *   skipping.
00160  * - Removed tabs from "config"
00161  * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
00162  * - Bumped up version number.
00163  * 
00164  * Revision 1.1.1.1  2001/05/15 13:59:00  oes
00165  * Initial import of version 2.9.3 source tree
00166  * 
00167  * 
00168  */
00169 /* *****************************************************************/
00170 
00171 
00172 #ifdef __cplusplus
00173 extern "C" {
00174 #endif
00175 
00176 /* Structures taken from project.h */
00177 struct client_state;
00178 struct file_list;
00179 struct configuration_spec;
00180 struct url_spec;
00181 
00182 extern void sweep(void);
00183 extern char *read_config_line(char *buf, size_t buflen, FILE *fp, unsigned long *linenum);
00184 extern int check_file_changed(const struct file_list * current,
00185                               const char * filename,
00186                               struct file_list ** newfl);
00187 
00188 extern jb_err edit_read_line(FILE *fp,
00189                              char **raw_out,
00190                              char **prefix_out,
00191                              char **data_out,
00192                              int *newline,
00193                              unsigned long *line_number);
00194 
00195 extern jb_err simple_read_line(FILE *fp, char **dest, int *newline);
00196 
00197 /*
00198  * Various types of newlines that a file may contain.
00199  */
00200 #define NEWLINE_UNKNOWN 0  /**< Newline convention in file is unknown */
00201 #define NEWLINE_UNIX    1  /**< Newline convention in file is '\n'   (ASCII 10) */
00202 #define NEWLINE_DOS     2  /**< Newline convention in file is '\r\n' (ASCII 13,10) */
00203 #define NEWLINE_MAC     3  /**< Newline convention in file is '\r'   (ASCII 13) */
00204 
00205 /**
00206  * Types of newlines that a file may contain, as strings.  If you have an
00207  * extremely wierd compiler that does not have '\r' == CR == ASCII 13 and
00208  * '\n' == LF == ASCII 10), then fix CHAR_CR and CHAR_LF in loaders.c as
00209  * well as these definitions.
00210  */
00211 #define NEWLINE(style) ((style)==NEWLINE_DOS ? "\r\n" : \
00212                         ((style)==NEWLINE_MAC ? "\r" : "\n"))
00213 
00214 
00215 extern short int MustReload;
00216 extern int load_actions_file(struct client_state *csp);
00217 extern int load_re_filterfile(struct client_state *csp);
00218 
00219 #ifdef FEATURE_TRUST
00220 extern int load_trustfile(struct client_state *csp);
00221 #endif /* def FEATURE_TRUST */
00222 
00223 #ifdef FEATURE_GRACEFUL_TERMINATION
00224 #ifdef FEATURE_TRUST
00225 void unload_current_trust_file(void);
00226 #endif
00227 void unload_current_re_filterfile(void);
00228 #endif /* FEATURE_GRACEFUL_TERMINATION */
00229 
00230 
00231 extern void add_loader(int (*loader)(struct client_state *), 
00232                        struct configuration_spec * config);
00233 extern int run_loader(struct client_state *csp);
00234 
00235 /* Revision control strings from this header and associated .c file */
00236 
00237 /** Version information about loaders.c. */
00238 extern const char loaders_rcs[];
00239 
00240 /** Version information about loaders.h. */
00241 extern const char loaders_h_rcs[];
00242 
00243 #ifdef __cplusplus
00244 } /* extern "C" */
00245 #endif
00246 
00247 #endif /* ndef LOADERS_H_INCLUDED */
00248 
00249 /*
00250   Local Variables:
00251   tab-width: 3
00252   end:
00253 */

Generated on Tue Jun 4 18:54:48 2002 for Privoxy 3.1.1 by doxygen1.2.15