Sync with upstream 2011-06-03/5669ec08b530b9bbed5848ec414f8c029e41ab02
[privoxy.git] / loaders.h
1 #ifndef LOADERS_H_INCLUDED
2 #define LOADERS_H_INCLUDED
3 #define LOADERS_H_VERSION "$Id: loaders.h,v 1.27 2011/03/03 14:38:36 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/loaders.h,v $
7  *
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.
12  *
13  * Copyright   :  Written by and Copyright (C) 2001-2010 the
14  *                Privoxy team. http://www.privoxy.org/
15  *
16  *                Based on the Internet Junkbuster originally written
17  *                by and Copyright (C) 1997 Anonymous Coders and 
18  *                Junkbusters Corporation.  http://www.junkbusters.com
19  *
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.
25  *
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.
31  *
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.
37  *
38  *********************************************************************/
39
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /* Structures taken from project.h */
46 struct client_state;
47 struct file_list;
48 struct configuration_spec;
49 struct url_spec;
50
51 extern unsigned int sweep(void);
52 extern char *read_config_line(FILE *fp, unsigned long *linenum, char **buf);
53 extern int check_file_changed(const struct file_list * current,
54                               const char * filename,
55                               struct file_list ** newfl);
56
57 extern jb_err edit_read_line(FILE *fp,
58                              char **raw_out,
59                              char **prefix_out,
60                              char **data_out,
61                              int *newline,
62                              unsigned long *line_number);
63
64 extern jb_err simple_read_line(FILE *fp, char **dest, int *newline);
65
66 /*
67  * Various types of newlines that a file may contain.
68  */
69 #define NEWLINE_UNKNOWN 0  /* Newline convention in file is unknown */
70 #define NEWLINE_UNIX    1  /* Newline convention in file is '\n'   (ASCII 10) */
71 #define NEWLINE_DOS     2  /* Newline convention in file is '\r\n' (ASCII 13,10) */
72 #define NEWLINE_MAC     3  /* Newline convention in file is '\r'   (ASCII 13) */
73
74 /*
75  * Types of newlines that a file may contain, as strings.  If you have an
76  * extremely weird compiler that does not have '\r' == CR == ASCII 13 and
77  * '\n' == LF == ASCII 10), then fix CHAR_CR and CHAR_LF in loaders.c as
78  * well as these definitions.
79  */
80 #define NEWLINE(style) ((style)==NEWLINE_DOS ? "\r\n" : \
81                         ((style)==NEWLINE_MAC ? "\r" : "\n"))
82
83
84 extern short int MustReload;
85 extern int load_action_files(struct client_state *csp);
86 extern int load_re_filterfiles(struct client_state *csp);
87
88 #ifdef FEATURE_TRUST
89 extern int load_trustfile(struct client_state *csp);
90 #endif /* def FEATURE_TRUST */
91
92 #ifdef FEATURE_GRACEFUL_TERMINATION
93 #ifdef FEATURE_TRUST
94 void unload_current_trust_file(void);
95 #endif
96 void unload_current_re_filterfile(void);
97 #endif /* FEATURE_GRACEFUL_TERMINATION */
98
99 void unload_forward_spec(struct forward_spec *fwd);
100
101 extern void add_loader(int (*loader)(struct client_state *), 
102                        struct configuration_spec * config);
103 extern int run_loader(struct client_state *csp);
104
105 extern int any_loaded_file_changed(const struct file_list *files_to_check);
106
107 /* Revision control strings from this header and associated .c file */
108 extern const char loaders_rcs[];
109 extern const char loaders_h_rcs[];
110
111 #ifdef __cplusplus
112 } /* extern "C" */
113 #endif
114
115 #endif /* ndef LOADERS_H_INCLUDED */
116
117 /*
118   Local Variables:
119   tab-width: 3
120   end:
121 */