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