Check requests more carefully before serving them forcefully
[privoxy.git] / jcc.h
1 #ifndef JCC_H_INCLUDED
2 #define JCC_H_INCLUDED
3 #define JCC_H_VERSION "$Id: jcc.h,v 1.34 2014/06/02 06:19:06 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/jcc.h,v $
7  *
8  * Purpose     :  Main file.  Contains main() method, main loop, and
9  *                the main connection-handling function.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001-2014 the
12  *                Privoxy team. http://www.privoxy.org/
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  *********************************************************************/
37
38
39 struct client_state;
40 struct file_list;
41
42 /* Global variables */
43
44 #ifdef FEATURE_STATISTICS
45 extern int urls_read;
46 extern int urls_rejected;
47 #endif /*def FEATURE_STATISTICS*/
48
49 extern struct client_states clients[1];
50 extern struct file_list    files[1];
51
52 #ifdef unix
53 extern const char *pidfile;
54 #endif
55 extern int daemon_mode;
56
57 #ifdef FEATURE_GRACEFUL_TERMINATION
58 extern int g_terminate;
59 #endif
60
61 #if defined(FEATURE_PTHREAD) || defined(_WIN32)
62 #define MUTEX_LOCKS_AVAILABLE
63
64 #ifdef FEATURE_PTHREAD
65 #include <pthread.h>
66
67 typedef pthread_mutex_t privoxy_mutex_t;
68
69 #else
70
71 typedef CRITICAL_SECTION privoxy_mutex_t;
72
73 #endif
74
75 extern void privoxy_mutex_lock(privoxy_mutex_t *mutex);
76 extern void privoxy_mutex_unlock(privoxy_mutex_t *mutex);
77
78 extern privoxy_mutex_t log_mutex;
79 extern privoxy_mutex_t log_init_mutex;
80 extern privoxy_mutex_t connection_reuse_mutex;
81
82 #ifdef FEATURE_EXTERNAL_FILTERS
83 extern privoxy_mutex_t external_filter_mutex;
84 #endif
85
86 #ifndef HAVE_GMTIME_R
87 extern privoxy_mutex_t gmtime_mutex;
88 #endif /* ndef HAVE_GMTIME_R */
89
90 #ifndef HAVE_LOCALTIME_R
91 extern privoxy_mutex_t localtime_mutex;
92 #endif /* ndef HAVE_GMTIME_R */
93
94 #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R)
95 extern privoxy_mutex_t resolver_mutex;
96 #endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */
97
98 #ifndef HAVE_RANDOM
99 extern privoxy_mutex_t rand_mutex;
100 #endif /* ndef HAVE_RANDOM */
101
102 #endif /* FEATURE_PTHREAD */
103
104 /* Functions */
105
106 #ifdef __MINGW32__
107 int real_main(int argc, char **argv);
108 #else
109 int main(int argc, char **argv);
110 #endif
111
112 /* Revision control strings from this header and associated .c file */
113 extern const char jcc_rcs[];
114 extern const char jcc_h_rcs[];
115
116 #endif /* ndef JCC_H_INCLUDED */
117
118 /*
119   Local Variables:
120   tab-width: 3
121   end:
122 */